Changeset 1751 in subversion for trunk/roundcubemail/program/steps/mail/func.inc
- Timestamp:
- Sep 6, 2008 12:41:43 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/steps/mail/func.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/steps/mail/func.inc
r1739 r1751 643 643 $convert_replaces[] = "rcmail_str_replacement('<a href=\"mailto:\\1\" onclick=\"return ".JS_OBJECT_NAME.".command(\'compose\',\'\\1\',this)\">\\1</a>', \$replace_strings)"; 644 644 645 // if ($part->ctype_parameters['format'] != 'flowed')646 // $body = wordwrap(trim($body), 80);647 648 645 // search for patterns like links and e-mail addresses 649 646 $body = preg_replace($convert_patterns, $convert_replaces, $body); … … 1014 1011 1015 1012 1013 /** 1014 * Wrap text to a given number of characters per line 1015 * but respect the mail quotation of replies messages (>) 1016 * 1017 * @param string Text to wrap 1018 * @param int The line width 1019 * @return string The wrapped text 1020 */ 1021 function rcmail_wrap_quoted($text, $max = 76) 1022 { 1023 // Rebuild the message body with a maximum of $max chars, while keeping quoted message. 1024 $lines = preg_split('/\r?\n/', trim($text)); 1025 $out = ''; 1026 1027 foreach ($lines as $line) { 1028 if (strlen($line) > $max) { 1029 if (preg_match('/^([>\s]+)/', $line, $regs)) { 1030 $length = strlen($regs[0]); 1031 $prefix = substr($line, 0, $length); 1032 1033 // Remove '> ' from the line, then wordwrap() the line 1034 $line = wordwrap(substr($line, $length), $max - $length); 1035 1036 // Rebuild the line with '> ' at the beginning of each 'subline' 1037 $newline = ''; 1038 foreach (explode("\n", $line) as $l) { 1039 $newline .= $prefix . $l . "\n"; 1040 } 1041 1042 // Remove the righest newline char 1043 $line = rtrim($newline); 1044 } 1045 else { 1046 $line = wordwrap($line, $max); 1047 } 1048 } 1049 1050 // Append the line 1051 $out .= $line . "\n"; 1052 } 1053 1054 return $out; 1055 } 1056 1057 1016 1058 function rcmail_message_part_controls() 1017 1059 {
Note: See TracChangeset
for help on using the changeset viewer.
