Skip to content

Commit

Permalink
Fix SEF plugin breaking HTML while trying to make inline background u…
Browse files Browse the repository at this point in the history
…rl paths absolute (#11266)

* Fix SEF plugin some times breaking HTML while trying to make inline background url paths absolute

* Added handling of " and '

* Code style, fix too long line

* Removed redudant pipe character

* Update sef.php
  • Loading branch information
ggppdk authored and rdeutz committed Jan 20, 2017
1 parent 339eb9a commit 7d34d41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/system/sef/sef.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ public function onAfterRender()
// Replace all unknown protocols in CSS background image.
if (strpos($buffer, 'style=') !== false)
{
$regex = '#style=\s*[\'\"](.*):\s*url\s*\([\'\"]?(?!/|' . $protocols . '|\#)([^\)\'\"]+)[\'\"]?\)#m';
$buffer = preg_replace($regex, 'style="$1: url(\'' . $base . '$2$3\')', $buffer);
$regex_url = '\s*url\s*\(([\'\"]|\&\#0?3[49];)?(?!/|\&\#0?3[49];|' . $protocols . '|\#)([^\)\'\"]+)([\'\"]|\&\#0?3[49];)?\)';
$regex = '#style=\s*([\'\"])(.*):' . $regex_url . '#m';
$buffer = preg_replace($regex, 'style=$1$2: url($3' . $base . '$4$5)', $buffer);
$this->checkBuffer($buffer);
}

Expand Down

0 comments on commit 7d34d41

Please sign in to comment.