Changeset 4657 in subversion
- Timestamp:
- Apr 15, 2011 11:26:16 AM (2 years ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 3 edited
-
include/rcube_contacts.php (modified) (1 diff)
-
include/rcube_vcard.php (modified) (3 diffs)
-
steps/addressbook/export.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_contacts.php
r4584 r4657 552 552 } 553 553 } 554 $out['vcard'] = $vcard->export( );554 $out['vcard'] = $vcard->export(false); 555 555 556 556 foreach ($this->table_cols as $col) { -
trunk/roundcubemail/program/include/rcube_vcard.php
r4656 r4657 207 207 * Convert the data structure into a vcard 3.0 string 208 208 */ 209 public function export() 210 { 211 return self::rfc2425_fold(self::vcard_encode($this->raw)); 209 public function export($folded = true) 210 { 211 $vcard = self::vcard_encode($this->raw); 212 return $folded ? self::rfc2425_fold($vcard) : $vcard; 212 213 } 213 214 … … 466 467 private static function rfc2425_fold_callback($matches) 467 468 { 468 // use mb string function if available469 if (function_exists('mb_ereg_replace')) {470 return ":\n " . mb_ereg_replace('(.{70})', "\\1\n ", $matches[1]);471 }472 473 469 // chunk_split string and avoid lines breaking multibyte characters 474 $c = 66;475 $out = ":\n " .substr($matches[1], 0, $c);470 $c = 71; 471 $out .= substr($matches[1], 0, $c); 476 472 for ($n = $c; $c < strlen($matches[1]); $c++) { 477 // break if length > 7 0 or mutlibyte character starts after position 66478 if ($n > 7 0 || ($n > 66&& ord($matches[1][$c]) >> 6 == 3)) {479 $out .= "\n ";473 // break if length > 75 or mutlibyte character starts after position 71 474 if ($n > 75 || ($n > 71 && ord($matches[1][$c]) >> 6 == 3)) { 475 $out .= "\n "; 480 476 $n = 0; 481 477 } … … 487 483 } 488 484 489 p rivatestatic function rfc2425_fold($val)490 { 491 return preg_replace_callback('/ :([^\n]{72,})/', array('self', 'rfc2425_fold_callback'), $val) . "\n";485 public static function rfc2425_fold($val) 486 { 487 return preg_replace_callback('/([^\n]{72,})/', array('self', 'rfc2425_fold_callback'), $val); 492 488 } 493 489 -
trunk/roundcubemail/program/steps/addressbook/export.inc
r4501 r4657 33 33 // we already have a vcard record 34 34 if ($row['vcard']) { 35 echo $row['vcard']. "\n";35 echo rcube_vcard::rfc2425_fold($row['vcard']) . "\n"; 36 36 } 37 37 // copy values into vcard object … … 47 47 } 48 48 49 echo $vcard->export( ) . "\n";49 echo $vcard->export(true) . "\n"; 50 50 } 51 51 }
Note: See TracChangeset
for help on using the changeset viewer.
