Resolves remaining issues in r82000 with remapping relative CSS URLs that contained...
authorTrevor Parscal <tparscal@users.mediawiki.org>
Tue, 15 Feb 2011 00:49:34 +0000 (00:49 +0000)
committerTrevor Parscal <tparscal@users.mediawiki.org>
Tue, 15 Feb 2011 00:49:34 +0000 (00:49 +0000)
includes/libs/CSSMin.php

index 65268e1..5cd5a7d 100644 (file)
@@ -36,7 +36,7 @@ class CSSMin {
         * which when base64 encoded will result in a 1/3 increase in size.
         */
        const EMBED_SIZE_LIMIT = 24576;
-       const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)\??[^\)\'"]*[\'"]?\s*\)';
+       const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)(?P<query>\??[^\)\'"]*)[\'"]?\s*\)';
        
        /* Protected Static Members */
        
@@ -130,6 +130,7 @@ class CSSMin {
                        $embed = $match['embed'][0];
                        $pre = $match['pre'][0];
                        $post = $match['post'][0];
+                       $query = $match['query'][0];
                        $url = "{$remote}/{$match['file'][0]}";
                        $file = "{$local}/{$match['file'][0]}";
                        $replacement = false;
@@ -163,7 +164,7 @@ class CSSMin {
                                }
                        } else if ( $local === false ) {
                                // Assume that all paths are relative to $remote, and make them absolute
-                               $replacement = "{$embed}{$pre}url({$url}){$post};";
+                               $replacement = "{$embed}{$pre}url({$url}{$query}){$post};";
                        }
                        if ( $replacement !== false ) {
                                // Perform replacement on the source