Index: trunk/phase3/includes/libs/CSSMin.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | * This class provides minification, URL remapping, URL extracting, and data-URL embedding. |
20 | 20 | * |
21 | 21 | * @file |
22 | | - * @version 0.1.0 -- 2010-09-09 |
| 22 | + * @version 0.1.1 -- 2010-09-11 |
23 | 23 | * @author Trevor Parscal <tparscal@wikimedia.org> |
24 | 24 | * @copyright Copyright 2010 Wikimedia Foundation |
25 | 25 | * @license http://www.apache.org/licenses/LICENSE-2.0 |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | * @param $path string File path where the source was read from |
83 | 83 | * @return string Remapped CSS data |
84 | 84 | */ |
85 | | - public static function remap( $source, $path, $embed = true ) { |
| 85 | + public static function remap( $source, $local, $remote, $embed = true ) { |
86 | 86 | $pattern = '/((?<embed>\s*\/\*\s*\@embed\s*\*\/)(?<pre>[^\;\}]*))?' . self::URL_REGEX . '(?<post>[^;]*)[\;]?/'; |
87 | 87 | $offset = 0; |
88 | 88 | while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) { |
— | — | @@ -89,11 +89,12 @@ |
90 | 90 | $embed = $match['embed'][0]; |
91 | 91 | $pre = $match['pre'][0]; |
92 | 92 | $post = $match['post'][0]; |
93 | | - $file = "{$path}/{$match['file'][0]}"; |
94 | | - // Only proceed if we can access the file |
| 93 | + $file = "{$local}/{$match['file'][0]}"; |
| 94 | + $url = "{$remote}/{$match['file'][0]}"; |
| 95 | + // Only proceed if we can access the fill |
95 | 96 | if ( file_exists( $file ) ) { |
96 | 97 | // Add version parameter as a time-stamp in ISO 8601 format, using Z for the timezone, meaning GMT |
97 | | - $url = "{$file}?" . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) ); |
| 98 | + $url .= '?' . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) ); |
98 | 99 | // If we the mime-type can't be determined, no embedding will take place |
99 | 100 | $type = false; |
100 | 101 | // Try a couple of different ways to get the mime-type of a file, in order of preference |
Index: trunk/phase3/includes/ResourceLoaderModule.php |
— | — | @@ -684,8 +684,13 @@ |
685 | 685 | * @return string Remapped CSS |
686 | 686 | */ |
687 | 687 | protected static function remapStyle( $file ) { |
688 | | - global $wgUseDataURLs; |
689 | | - return CSSMin::remap( file_get_contents( self::remapFilename( $file ) ), dirname( $file ), $wgUseDataURLs ); |
| 688 | + global $wgUseDataURLs, $wgScriptPath; |
| 689 | + return CSSMin::remap( |
| 690 | + file_get_contents( self::remapFilename( $file ) ), |
| 691 | + dirname( $file ), |
| 692 | + $wgScriptPath . '/' . dirname( $file ), |
| 693 | + $wgUseDataURLs |
| 694 | + ); |
690 | 695 | } |
691 | 696 | } |
692 | 697 | |