mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 05:49:03 +01:00
preserving ampersands while converting html to text; improving linebreak behavior; switching off WordWrapn (by setting it to 0) in phpmailer, as we handle our linebreaking on our own
This commit is contained in:
parent
b37b1dc454
commit
28d5e5b49f
@ -766,7 +766,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$_mailObject->WordWrap = 76;
|
||||
//$_mailObject->WordWrap = 76; // as we break lines ourself, we will not need/use the buildin WordWrap
|
||||
#$_mailObject->Subject = $bofelamimail->encodeHeader($_formData['subject'], 'q');
|
||||
$_mailObject->Subject = $_formData['subject'];
|
||||
#$realCharset = mb_detect_encoding($_formData['body'] . 'a' , strtoupper($this->displayCharset).',UTF-8, ISO-8859-1');
|
||||
|
@ -1218,9 +1218,13 @@
|
||||
'-',
|
||||
'\'',
|
||||
'...',
|
||||
'+',
|
||||
'&',
|
||||
);
|
||||
if($singleBodyPart['mimeType'] == 'text/html' && strtoupper($singleBodyPart['charSet']) != 'UTF-8') $singleBodyPart['body'] = preg_replace($sar,$rar,$singleBodyPart['body']);
|
||||
if(($singleBodyPart['mimeType'] == 'text/html' || $singleBodyPart['mimeType'] == 'text/plain') &&
|
||||
strtoupper($singleBodyPart['charSet']) != 'UTF-8')
|
||||
{
|
||||
$singleBodyPart['body'] = preg_replace($sar,$rar,$singleBodyPart['body']);
|
||||
}
|
||||
$singleBodyPart['body'] = $GLOBALS['egw']->translation->convert(
|
||||
$singleBodyPart['body'],
|
||||
strtolower($singleBodyPart['charSet'])
|
||||
|
@ -1142,7 +1142,7 @@ class translation
|
||||
);
|
||||
$Replace = array ('',
|
||||
'"',
|
||||
'+',
|
||||
'#amper#sand#',
|
||||
'<',
|
||||
'>',
|
||||
' ',
|
||||
@ -1201,13 +1201,14 @@ class translation
|
||||
#$_html = preg_replace('~\s+$~m','',$_html);
|
||||
// restoring the preserved blockquote
|
||||
$_html = preg_replace('~#blockquote#type#cite#~s','<blockquote type="cite">',$_html);
|
||||
|
||||
// restoring ampersands
|
||||
$_html = str_replace('#amper#sand#','&',$_html);
|
||||
|
||||
$_html = html_entity_decode($_html, ENT_COMPAT, $displayCharset);
|
||||
//self::replaceEmailAdresses($_html);
|
||||
#error_log($text);
|
||||
$pos = strpos($_html, 'blockquote');
|
||||
#error_log("convert HTML2Text");
|
||||
//error_log("convert HTML2Text: $_html");
|
||||
if($pos === false) {
|
||||
return $_html;
|
||||
} else {
|
||||
@ -1232,9 +1233,10 @@ class translation
|
||||
$quoteParts3 = explode("\r\n", $quotePart2[0]);
|
||||
|
||||
foreach($quoteParts3 as $quotePart3) {
|
||||
//error_log(__METHOD__.__LINE__.'Line:'.$quotePart3);
|
||||
$allowedLength = 76-strlen("\r\n$indentString");
|
||||
// only break lines, if not already indented
|
||||
if ($quotePart3[0] != $indentString)
|
||||
if (substr($quotePart3,0,strlen($indentString)) != $indentString)
|
||||
{
|
||||
if (strlen($quotePart3) > $allowedLength) {
|
||||
$s=explode(" ", $quotePart3);
|
||||
@ -1245,11 +1247,13 @@ class translation
|
||||
// only break long words within the wordboundaries,
|
||||
// but it may destroy links, so we check for href and dont do it if we find it
|
||||
if($cnt > $allowedLength && stripos($v,'href=')===false) {
|
||||
//error_log(__METHOD__.__LINE__.'LongWordFound:'.$v);
|
||||
$v=wordwrap($v, $allowedLength, "\r\n$indentString", true);
|
||||
}
|
||||
// the rest should be broken at the start of the new word that exceeds the limit
|
||||
if ($linecnt+$cnt > $allowedLength) {
|
||||
$v="\r\n$indentString$v";
|
||||
//error_log(__METHOD__.__LINE__.'breaking here:'.$v);
|
||||
$linecnt = 0;
|
||||
} else {
|
||||
$linecnt += $cnt;
|
||||
@ -1258,6 +1262,7 @@ class translation
|
||||
}
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.'partString to return:'.$indentString . $quotePart3);
|
||||
$asciiTextBuff[] = $indentString . $quotePart3 ;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user