diff options
author | emkael <emkael@tlen.pl> | 2016-05-03 21:05:49 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-03 21:05:49 +0200 |
commit | 67580665e4379c1fa9d748b65823b9163c16bd0c (patch) | |
tree | 69fd4520d387c8ce4d44ba5bcc609ca86ae5f9cd /app/php/web/ClientScriptManager.php | |
parent | 31e38af744b850ba51b792df399a9e7b7e0d261a (diff) |
* do not fix absolute paths in stylesheets in client script manager
Diffstat (limited to 'app/php/web/ClientScriptManager.php')
-rw-r--r-- | app/php/web/ClientScriptManager.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/php/web/ClientScriptManager.php b/app/php/web/ClientScriptManager.php index 4b54be1..3b60b7a 100644 --- a/app/php/web/ClientScriptManager.php +++ b/app/php/web/ClientScriptManager.php @@ -322,15 +322,18 @@ class ClientScriptManager extends TClientScriptManager { ); } + // Resolve all "url(FILE)" CSS directives pointing to relative resources to specified path private function _fixStyleSheetPaths($content, $originalUrl) { $originalDir = dirname($originalUrl . '.'); return preg_replace_callback( '/url\s*\([\'"]?(.*?)[\'"]?\)/', function($matches) use($originalDir) { $url = parse_url($matches[1]); - if (isset($url['scheme']) || isset($url['host'])) { + // ignore absolute URLs and paths + if (isset($url['scheme']) || isset($url['host']) || $url['path'][0] == '/') { return $matches[0]; } + // resolve relative paths return str_replace( $matches[1], $originalDir . '/' . $matches[1], |