Index: branches/resourceloader/phase3/includes/CSSMin.php |
— | — | @@ -18,15 +18,15 @@ |
19 | 19 | * Gets a list of local file paths which are referenced in a CSS style sheet |
20 | 20 | * |
21 | 21 | * @param $source string CSS data to remap |
22 | | - * @param $path string File path where the source was read from |
| 22 | + * @param $path string File path where the source was read from (optional) |
23 | 23 | * @return array List of local file references |
24 | 24 | */ |
25 | | - public static function getLocalFileReferences( $source, $path ) { |
| 25 | + public static function getLocalFileReferences( $source, $path = null ) { |
26 | 26 | $pattern = '/url\([\'"]?(?<file>[^\?\)\:]*)\??[^\)]*[\'"]?\)/'; |
27 | 27 | $files = array(); |
28 | 28 | if ( preg_match_all( $pattern, $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER ) ) { |
29 | 29 | foreach ( $matches as $match ) { |
30 | | - $file = "{$path}/{$match['file'][0]}"; |
| 30 | + $file = ( isset( $path ) ? rtrim( $path, '/' ) . '/' : '' ) . "{$match['file'][0]}"; |
31 | 31 | // Only proceed if we can access the file |
32 | 32 | if ( file_exists( $file ) ) { |
33 | 33 | $files[] = $file; |