From 47f862d1e038979f4d2dd5bb0c3eaaa9d1ee8fee Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 12 Nov 2013 23:37:38 +0000 Subject: Fix an issue with style.ini replacements values not having relative locations corrected, when those values are "url(...)". Explanation: In the change to the less css extension, variable replacements now happen after the less/css files are processed for correction of relative locations. --- lib/exe/css.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index f0bd24b43..af7f9e4f1 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -271,7 +271,7 @@ function css_styleini($tpl) { // replacements if(is_array($data['replacements'])){ - $replacements = array_merge($replacements, $data['replacements']); + $replacements = array_merge($replacements, css_fixreplacementurls($data['replacements'],$webbase)); } } @@ -288,7 +288,7 @@ function css_styleini($tpl) { // replacements if(is_array($data['replacements'])){ - $replacements = array_merge($replacements, $data['replacements']); + $replacements = array_merge($replacements, css_fixreplacementurls($data['replacements'],$webbase)); } } @@ -306,7 +306,7 @@ function css_styleini($tpl) { // replacements if(is_array($data['replacements'])){ - $replacements = array_merge($replacements, $data['replacements']); + $replacements = array_merge($replacements, css_fixreplacementurls($data['replacements'],$webbase)); } } @@ -316,6 +316,13 @@ function css_styleini($tpl) { ); } +function css_fixreplacementurls($replacements, $location) { + foreach($replacements as $key => $value) { + $replacements[$key] = preg_replace('#(url\([ \'"]*)(?!/|data:|http://|https://| |\'|")#','\\1'.$location,$value); + } + return $replacements; +} + /** * Prints classes for interwikilinks * -- cgit v1.2.3