diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php
index 0ee1cd061..3131fd543 100644
--- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php
+++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/HtmlUtils.php
@@ -91,27 +91,17 @@ abstract class HtmlUtils
$sResult = '';
if ($oElem instanceof \DOMDocument)
{
- if (isset($oElem->documentElement))
- {
- $sResult = $oElem->saveHTML($oElem->documentElement);
- }
- else
- {
- $sResult = $oElem->saveHTML();
- }
+ $sResult = $oElem->saveHTML(isset($oElem->documentElement) ? $oElem->documentElement : null);
}
- else if ($oElem)
+ else if ($oDom)
{
- if ($oDom)
- {
- $sResult = $oDom->saveHTML($oElem);
- }
- else
- {
- $oTempDoc = self::createDOMDocument();
- $oTempDoc->appendChild($oTempDoc->importNode($oElem->cloneNode(true), true));
- $sResult = $oTempDoc->saveHTML();
- }
+ $sResult = $oDom->saveHTML($oElem);
+ }
+ else
+ {
+ $oTempDoc = self::createDOMDocument();
+ $oTempDoc->appendChild($oTempDoc->importNode($oElem->cloneNode(true), true));
+ $sResult = $oTempDoc->saveHTML();
}
return \trim($sResult);
@@ -188,8 +178,8 @@ abstract class HtmlUtils
$sBodyAttrs = \preg_replace('/xmlns:[a-z]="[^"]*"/i', '', $sBodyAttrs);
$sBodyAttrs = \preg_replace('/xmlns:[a-z]=\'[^\']*\'/i', '', $sBodyAttrs);
- $sHtmlAttrs = trim($sHtmlAttrs);
- $sBodyAttrs = trim($sBodyAttrs);
+ $sHtmlAttrs = \trim($sHtmlAttrs);
+ $sBodyAttrs = \trim($sBodyAttrs);
return $sHtml;
}
@@ -1078,8 +1068,8 @@ abstract class HtmlUtils
$sText = \strtr($sText, array(
"\n" => "
",
- "\t" => ' ',
- ' ' => ' '
+ "\t" => "\xC2\xA0\xC2\xA0\xC2\xA0\xC2\xA0",
+ ' ' => "\xC2\xA0\xC2\xA0"
));
return $sText;
@@ -1089,20 +1079,20 @@ abstract class HtmlUtils
{
$sText = \MailSo\Base\Utils::StripSpaces($sText);
+ $sText = \preg_replace_callback('/]*>/', function($m) {
+ return "\n\n" . \str_repeat('#', $m[1]) . ' ';
+ }, $sText);
+
$sText = \preg_replace(array(
"/\r/",
"/[\n\t]+/",
- '/