Welcome page branding option

This commit is contained in:
RainLoop Team 2015-04-10 02:05:49 +04:00
parent acb013fbb5
commit 351c12c002
50 changed files with 531 additions and 160 deletions

View file

@ -232,7 +232,7 @@ class HtmlUtils
{
if ($oElement)
{
if (\preg_match('/http[s]?:\/\//i', $sUrl))
if (\preg_match('/http[s]?:\/\//i', $sUrl) || '//' === \substr($sUrl, 0, 2))
{
$bHasExternals = true;
if (!$bDoNotReplaceExternalUrl)
@ -452,7 +452,7 @@ class HtmlUtils
foreach ($aNodes as /* @var $oElement \DOMElement */ $oElement)
{
if (\in_array(\strtolower($oElement->tagName), array('svg', 'head', 'link',
'base', 'meta', 'title', 'style', 'script', 'bgsound', 'keygen', 'source',
'base', 'meta', 'title', 'style', 'x-script', 'script', 'bgsound', 'keygen', 'source',
'object', 'embed', 'applet', 'mocha', 'iframe', 'frame', 'frameset', 'video', 'audio')) && isset($oElement->parentNode))
{
@$oElement->parentNode->removeChild($oElement);
@ -546,8 +546,8 @@ class HtmlUtils
// }
foreach (array(
'id', 'class', 'contenteditable', 'designmode', 'formaction', 'data-bind', 'xmlns',
'srcset'
'id', 'class', 'contenteditable', 'designmode', 'formaction',
'data-bind', 'xmlns', 'srcset'
) as $sAttr)
{
@$oElement->removeAttribute($sAttr);
@ -566,7 +566,8 @@ class HtmlUtils
if ($oElement->hasAttribute('href'))
{
$sHref = \trim($oElement->getAttribute('href'));
if (!\preg_match('/^(http[s]?|ftp|skype|mailto):/i', $sHref))
if (!\preg_match('/^(http[s]?|ftp|skype|mailto):/i', $sHref) ||
'//' !== \substr($sHref, 0, 2))
{
$oElement->setAttribute('data-x-broken-href', $sHref);
$oElement->setAttribute('href', 'javascript:false');
@ -594,7 +595,8 @@ class HtmlUtils
}
else
{
if (\preg_match('/http[s]?:\/\//i', $sSrc))
if (\preg_match('/^http[s]?:\/\//i', $sSrc) ||
'//' === \substr($sSrc, 0, 2))
{
if ($bDoNotReplaceExternalUrl)
{
@ -615,7 +617,7 @@ class HtmlUtils
$bHasExternals = true;
}
else if ('data:image/' === \strtolower(\substr(\trim($sSrc), 0, 11)))
else if ('data:image/' === \strtolower(\substr($sSrc, 0, 11)))
{
$oElement->setAttribute('src', $sSrc);
}
@ -745,7 +747,7 @@ class HtmlUtils
{
$oElement->removeAttribute('data-x-additional-src');
}
if ($oElement->hasAttribute('data-x-additional-style-url'))
{
$oElement->removeAttribute('data-x-additional-style-url');