mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-25 00:21:29 +08:00
Folder unread count view fix.
Add MailSo HtmlUtils ClearHtmlSimple function
This commit is contained in:
parent
e0d6c9bb34
commit
c8a5d45f37
9 changed files with 52 additions and 6270 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
/.idea
|
||||
/nbproject
|
||||
/npm-debug.log
|
||||
/rainloop/v/0.0.0/static/css/less.css
|
||||
/node_modules
|
||||
/build/local
|
||||
/build/dist
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
}
|
||||
|
||||
.count {
|
||||
position: relative;
|
||||
display: none;
|
||||
margin-top: 5px;
|
||||
line-height: 19px;
|
||||
|
|
|
@ -147,10 +147,11 @@ class HtmlUtils
|
|||
* @param array $aFoundCIDs
|
||||
* @param array $aContentLocationUrls
|
||||
* @param array $aFoundedContentLocationUrls
|
||||
* @param bool $bDoNotReplaceExternalUrl = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls)
|
||||
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl = false)
|
||||
{
|
||||
$sStyle = \trim($sStyle);
|
||||
$aOutStyles = array();
|
||||
|
@ -215,21 +216,24 @@ class HtmlUtils
|
|||
if (\preg_match('/http[s]?:\/\//i', $sUrl))
|
||||
{
|
||||
$bHasExternals = true;
|
||||
if (\in_array($sName, array('background-image', 'list-style-image', 'content')))
|
||||
if (!$bDoNotReplaceExternalUrl)
|
||||
{
|
||||
$sStyleItem = '';
|
||||
if (\in_array($sName, array('background-image', 'list-style-image', 'content')))
|
||||
{
|
||||
$sStyleItem = '';
|
||||
}
|
||||
|
||||
$sTemp = '';
|
||||
if ($oElement->hasAttribute('data-x-style-url'))
|
||||
{
|
||||
$sTemp = \trim($oElement->getAttribute('data-x-style-url'));
|
||||
}
|
||||
|
||||
$sTemp = empty($sTemp) ? '' : (';' === \substr($sTemp, -1) ? $sTemp.' ' : $sTemp.'; ');
|
||||
|
||||
$oElement->setAttribute('data-x-style-url', \trim($sTemp.
|
||||
('background' === $sName ? 'background-image' : $sName).': '.$sFullUrl, ' ;'));
|
||||
}
|
||||
|
||||
$sTemp = '';
|
||||
if ($oElement->hasAttribute('data-x-style-url'))
|
||||
{
|
||||
$sTemp = \trim($oElement->getAttribute('data-x-style-url'));
|
||||
}
|
||||
|
||||
$sTemp = empty($sTemp) ? '' : (';' === \substr($sTemp, -1) ? $sTemp.' ' : $sTemp.'; ');
|
||||
|
||||
$oElement->setAttribute('data-x-style-url', \trim($sTemp.
|
||||
('background' === $sName ? 'background-image' : $sName).': '.$sFullUrl, ' ;'));
|
||||
}
|
||||
else if ('data:image/' !== \strtolower(\substr(\trim($sUrl), 0, 11)))
|
||||
{
|
||||
|
@ -257,17 +261,36 @@ class HtmlUtils
|
|||
return \implode(';', $aOutStyles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sHtml
|
||||
* @param bool $bDoNotReplaceExternalUrl = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function ClearHtmlSimple($sHtml, $bDoNotReplaceExternalUrl = false)
|
||||
{
|
||||
$bHasExternals = false;
|
||||
$aFoundCIDs = array();
|
||||
$aContentLocationUrls = array();
|
||||
$aFoundedContentLocationUrls = array();
|
||||
|
||||
return \MailSo\Base\HtmlUtils::ClearHtml($sHtml, $bHasExternals, $aFoundCIDs,
|
||||
$aContentLocationUrls, $aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHtml
|
||||
* @param bool $bHasExternals = false
|
||||
* @param array $aFoundCIDs = array()
|
||||
* @param array $aContentLocationUrls = array()
|
||||
* @param array $aFoundedContentLocationUrls = array()
|
||||
* @param bool $bDoNotReplaceExternalUrl = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function ClearHtml($sHtml, &$bHasExternals = false, &$aFoundCIDs = array(),
|
||||
$aContentLocationUrls = array(), &$aFoundedContentLocationUrls = array())
|
||||
$aContentLocationUrls = array(), &$aFoundedContentLocationUrls = array(), $bDoNotReplaceExternalUrl = false)
|
||||
{
|
||||
$sHtml = null === $sHtml ? '' : (string) $sHtml;
|
||||
$sHtml = \trim($sHtml);
|
||||
|
@ -402,7 +425,15 @@ class HtmlUtils
|
|||
{
|
||||
if (\preg_match('/http[s]?:\/\//i', $sSrc))
|
||||
{
|
||||
$oElement->setAttribute('data-x-src', $sSrc);
|
||||
if ($bDoNotReplaceExternalUrl)
|
||||
{
|
||||
$oElement->setAttribute('src', $sSrc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oElement->setAttribute('data-x-src', $sSrc);
|
||||
}
|
||||
|
||||
$bHasExternals = true;
|
||||
}
|
||||
else if ('data:image/' === \strtolower(\substr(\trim($sSrc), 0, 11)))
|
||||
|
@ -446,7 +477,7 @@ class HtmlUtils
|
|||
{
|
||||
$oElement->setAttribute('style',
|
||||
\MailSo\Base\HtmlUtils::ClearStyle($oElement->getAttribute('style'), $oElement, $bHasExternals,
|
||||
$aFoundCIDs, $aContentLocationUrls, $aFoundedContentLocationUrls));
|
||||
$aFoundCIDs, $aContentLocationUrls, $aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6201,6 +6201,7 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle {
|
|||
color: grey;
|
||||
}
|
||||
.b-folders .e-item .e-link .count {
|
||||
position: relative;
|
||||
display: none;
|
||||
margin-top: 5px;
|
||||
line-height: 19px;
|
||||
|
|
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
2
rainloop/v/0.0.0/static/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 613 B |
Binary file not shown.
Before Width: | Height: | Size: 845 B |
Loading…
Reference in a new issue