From 8b8b0fc7e484ee84d526c5d77c934085042fb417 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 8 Feb 2023 12:12:02 +0100 Subject: [PATCH] small cleanup --- dev/Styles/User/Layout.less | 14 ------- .../app/libraries/MailSo/Base/HtmlUtils.php | 37 ++++++------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/dev/Styles/User/Layout.less b/dev/Styles/User/Layout.less index 3db97425a..87a38d301 100644 --- a/dev/Styles/User/Layout.less +++ b/dev/Styles/User/Layout.less @@ -71,25 +71,11 @@ html:not(.rl-left-panel-disabled) #rl-left { min-width: 320px; max-width: 60%; } -/* -.rl-side-preview-pane #V-MailMessageList .messageList { - resize: horizontal; overflow: auto; - min-width: 320px; - max-width: 60%; -} -*/ .rl-bottom-preview-pane #V-MailMessageList { resize: vertical; /*overflow: auto;*/ min-height: 200px; max-height: 60%; } -/* -.rl-side-preview-pane #V-MailMessageList .messageList { - resize: vertical; overflow: auto; - min-height: 200px; - max-height: 60%; -} -*/ .rl-bottom-preview-pane #V-MailMessageList > .resizer { cursor: ns-resize; height: 5px; 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 0a1947f32..1cfe9816a 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 @@ -23,8 +23,7 @@ abstract class HtmlUtils public static function BuildHtml(string $sHtml, array &$aFoundCids, array &$aFoundDataURL, array &$aFoundContentLocationUrls) : string { $bState = true; - if (\MailSo\Base\Utils::FunctionCallable('libxml_use_internal_errors')) - { + if (\MailSo\Base\Utils::FunctionCallable('libxml_use_internal_errors')) { $bState = \libxml_use_internal_errors(true); } @@ -86,13 +85,11 @@ abstract class HtmlUtils $oDoc->normalizeDocument(); - if (\MailSo\Base\Utils::FunctionCallable('libxml_clear_errors')) - { + if (\MailSo\Base\Utils::FunctionCallable('libxml_clear_errors')) { \libxml_clear_errors(); } - if (\MailSo\Base\Utils::FunctionCallable('libxml_use_internal_errors')) - { + if (\MailSo\Base\Utils::FunctionCallable('libxml_use_internal_errors')) { \libxml_use_internal_errors($bState); } @@ -110,12 +107,10 @@ abstract class HtmlUtils $sIdRight = \md5(\microtime()); $aNodes = $oBody->getElementsByTagName('*'); - foreach ($aNodes as /* @var $oElement \DOMElement */ $oElement) - { + foreach ($aNodes as /* @var $oElement \DOMElement */ $oElement) { $sTagNameLower = \strtolower($oElement->nodeName); - if (\in_array($sTagNameLower, $aRemoveTags)) - { + if (\in_array($sTagNameLower, $aRemoveTags)) { $aRemove[] = $oElement; continue; } @@ -147,16 +142,14 @@ abstract class HtmlUtils if ($aCid) { foreach ($aCid as $sCidName => $sCid) { $sCidName = \strtolower(\preg_replace('/([A-Z])/', '-\1', $sCidName)); - if (\in_array($sCidName, array('background-image', 'list-style-image', 'content'))) - { + if (\in_array($sCidName, array('background-image', 'list-style-image', 'content'))) { $sStyles = $oElement->hasAttribute('style') ? \trim(\trim($oElement->getAttribute('style')), ';') : ''; $sBack = $sCidName.':url(cid:'.$sCid.')'; $sStyles = \preg_replace('/'.\preg_quote($sCidName).'\\s*:\\s*[^;]+/i', $sBack, $sStyles); - if (false === \strpos($sStyles, $sBack)) - { + if (false === \strpos($sStyles, $sBack)) { $sStyles .= ";{$sBack}"; } @@ -169,30 +162,24 @@ abstract class HtmlUtils // Remove all remaining data-* attributes if ($oElement->hasAttributes()) { foreach ($oElement->attributes as $oAttr) { - if ('data-' === \substr(\strtolower($oAttr->nodeName), 0, 5)) - { + if ('data-' === \substr(\strtolower($oAttr->nodeName), 0, 5)) { $oElement->removeAttribute($oAttr->nodeName); } } } - if ('img' === $sTagNameLower) - { + if ('img' === $sTagNameLower) { $sSrc = $oElement->getAttribute('src'); - if ('data:image/' === \strtolower(\substr($sSrc, 0, 11))) - { + if ('data:image/' === \strtolower(\substr($sSrc, 0, 11))) { $sHash = \md5($sSrc) . '@' . $sIdRight; $aFoundDataURL[$sHash] = $sSrc; - $oElement->setAttribute('src', 'cid:'.$sHash); } } } - foreach ($aRemove as /* @var $oElement \DOMElement */ $oElement) - { - if (isset($oElement->parentNode)) - { + foreach ($aRemove as /* @var $oElement \DOMElement */ $oElement) { + if (isset($oElement->parentNode)) { @$oElement->parentNode->removeChild($oElement); } }