Fix html parser

Add "login.active_backgroud" setting
This commit is contained in:
RainLoop Team 2016-10-20 22:38:29 +03:00
parent 52018b40e8
commit 1b7c6f76d1
5 changed files with 32 additions and 66 deletions

View file

@ -117,7 +117,7 @@ class HtmlUtils
/**
* @param \DOMDocument|\DOMElement $oElem
*
* @return type
* @return string
*/
private static function domToString($oElem, $oDom = null)
{
@ -196,7 +196,6 @@ class HtmlUtils
else
{
$sResult = self::domToString($oDiv, $oDom);
$sResult = \MailSo\Base\HtmlUtils::UnWrapTag($sResult);
}
}
else
@ -210,36 +209,6 @@ class HtmlUtils
return $sResult;
}
/**
* @param string $sHtml
* @param string $sTag = 'div'
* @param string $iUnwrapCount = 10
*
* @return string
*/
public static function UnWrapTag($sHtml, $sTag = 'div', $iUnwrapCount = 5)
{
$iUnwrapCount = 0 < $iUnwrapCount ? $iUnwrapCount : 1;
$iUnwrapCount = 10 < $iUnwrapCount ? 10 : $iUnwrapCount;
$sTag = $sTag ? $sTag : 'div';
$iTagLen = \strlen($sTag);
while (0 < $iUnwrapCount)
{
$sHtml = \trim($sHtml);
if (0 === \strpos($sHtml, '<'.$sTag.'>') && '</'.$sTag.'>' === \substr($sHtml, -3 - $iTagLen))
{
$sHtml = \substr(\substr($sHtml, 2 + $iTagLen), 0, -3 - $iTagLen);
$sHtml = \trim($sHtml);
}
$iUnwrapCount--;
}
return $sHtml;
}
/**
* @param string $sHtml
* @param string $sHtmlAttrs = ''
@ -288,8 +257,6 @@ class HtmlUtils
$sHtmlAttrs = trim($sHtmlAttrs);
$sBodyAttrs = trim($sBodyAttrs);
$sHtml = \MailSo\Base\HtmlUtils::UnWrapTag($sHtml);
return $sHtml;
}
@ -1242,7 +1209,8 @@ class HtmlUtils
if (\MailSo\Config::$HtmlStrictDebug && 0 < \count($aRemovedAttrs))
{
unset($aRemovedAttrs['class'], $aRemovedAttrs['target'], $aRemovedAttrs['id'], $aRemovedAttrs['name']);
unset($aRemovedAttrs['class'], $aRemovedAttrs['target'], $aRemovedAttrs['id'], $aRemovedAttrs['name'],
$aRemovedAttrs['itemprop'], $aRemovedAttrs['itemscope'], $aRemovedAttrs['itemtype']);
$aRemovedAttrs = \array_keys($aRemovedAttrs);
if (0 < \count($aRemovedAttrs))

View file

@ -1457,6 +1457,7 @@ class Actions
'registrationLinkUrl' => \trim($oConfig->Get('login', 'registration_link_url', '')),
'loginGlassStyle' => (bool) $oConfig->Get('login', 'glass_style', true),
'hideSubmitButton' => (bool) $oConfig->Get('login', 'hide_submit_button', true),
'activeBackgroud' => (bool) $oConfig->Get('login', 'active_backgroud', true),
'jsHash' => \md5(\RainLoop\Utils::GetConnectionToken()),
'useImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false),
'useImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true),

View file

@ -249,8 +249,9 @@ class Application extends \RainLoop\Config\AbstractConfig
'welcome_page' => array(false, ''),
'glass_style' => array(true, ''),
'hide_submit_button' => array(true, ''),
'glass_style' => array(true),
'hide_submit_button' => array(true),
'active_backgroud' => array(true),
'forgot_password_link_url' => array('', ''),
'registration_link_url' => array('', ''),