1 | <?php |
---|
2 | |
---|
3 | // |
---|
4 | // Export iCal |
---|
5 | // |
---|
6 | |
---|
7 | // celui du core ne fonctionne pas comme la RFC 5545 |
---|
8 | |
---|
9 | // http://doc.spip.org/@filtrer_ical |
---|
10 | function filtrer_ical2($texte) { |
---|
11 | include_spip('inc/charsets'); |
---|
12 | $texte = html2unicode($texte); |
---|
13 | $texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset'], 1), 'utf-8'); |
---|
14 | # la RFC impose des lignes de 75 car max, |
---|
15 | # Lines of text SHOULD NOT be longer than 75 octets, excluding the line break |
---|
16 | if (strlen($texte) > 75) |
---|
17 | { |
---|
18 | # $texte = chunk_split($texte); |
---|
19 | } |
---|
20 | |
---|
21 | #$texte = preg_replace("/\\/", " antislash ", $texte); |
---|
22 | $texte = preg_replace("/,/", "\\\,", $texte); |
---|
23 | $texte = preg_replace("/\n/", "\\n", $texte); |
---|
24 | #$texte = chunk_split($texte, 74); |
---|
25 | #$texte = preg_replace("/\r\n /", "\\n", $texte); |
---|
26 | #$texte = preg_replace("/\r\n/", "\\n", $texte); |
---|
27 | $texte = preg_replace("/:/", "\\\:", $texte); |
---|
28 | $texte = preg_replace("/;/", "\\\;", $texte); |
---|
29 | #$texte = "TOTO" . $texte; |
---|
30 | return $texte; |
---|
31 | } |
---|
32 | |
---|
33 | function folding_ical($texte, $arg1='FIXME') { |
---|
34 | include_spip('inc/charsets'); |
---|
35 | $texte = html2unicode($texte); |
---|
36 | $texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset'], 1), 'utf-8'); |
---|
37 | # la RFC impose des lignes de 75 car max, |
---|
38 | # Lines of text SHOULD NOT be longer than 75 octets, excluding the line break |
---|
39 | $texte = $arg1 . ":" . $texte; |
---|
40 | $texte = chunk_split($texte, 70); |
---|
41 | $texte = preg_replace("/\\\\/", "\\\\\\\\", $texte); |
---|
42 | #$texte = addcslashes($texte, "\92"); |
---|
43 | $texte = preg_replace("/,/", "\\\,", $texte); |
---|
44 | #$texte = preg_replace("/:/", "\\\:", $texte); |
---|
45 | $texte = preg_replace("/;/", "\\\;", $texte); |
---|
46 | $texte = preg_replace("/\r\n/", "\r\n ", $texte); |
---|
47 | $texte = rtrim($texte); |
---|
48 | |
---|
49 | #$texte = "\b\r\n" . $arg1 . ":" . $texte; |
---|
50 | return $texte; |
---|
51 | } |
---|
52 | |
---|
53 | ?> |
---|