Merge "Add tags support to patrol, protect, unblock, and undelete"
[lhc/web/wiklou.git] / includes / libs / CSSMin.php
index 5f4dda9..2f2faed 100644 (file)
@@ -60,41 +60,13 @@ class CSSMin {
        /* Static Methods */
 
        /**
-        * Gets a list of local file paths which are referenced in a CSS style sheet.
-        *
-        * If you wish non-existent files to be listed too, use getAllLocalFileReferences().
-        *
-        * For backwards-compatibility, if the second parameter is not given or null,
-        * this function will return an empty array instead of erroring out.
-        *
-        * @param string $source CSS stylesheet source to process
-        * @param string $path File path where the source was read from
-        * @return array List of local file references
-        */
-       public static function getLocalFileReferences( $source, $path = null ) {
-               if ( $path === null ) {
-                       return [];
-               }
-
-               $files = self::getAllLocalFileReferences( $source, $path );
-
-               // Skip non-existent files
-               $files = array_filter( $files, function ( $file ) {
-                       return file_exists( $file );
-               } );
-
-               return $files;
-       }
-
-       /**
-        * Gets a list of local file paths which are referenced in a CSS style sheet, including
-        * non-existent files.
+        * Get a list of local files referenced in a stylesheet (includes non-existent files).
         *
         * @param string $source CSS stylesheet source to process
         * @param string $path File path where the source was read from
         * @return array List of local file references
         */
-       public static function getAllLocalFileReferences( $source, $path ) {
+       public static function getLocalFileReferences( $source, $path ) {
                $stripped = preg_replace( '/' . self::COMMENT_REGEX . '/s', '', $source );
                $path = rtrim( $path, '/' ) . '/';
                $files = [];
@@ -349,7 +321,7 @@ class CSSMin {
                                                        $url = $match['file'] . $match['query'];
                                                        $file = $local . $match['file'];
                                                        if (
-                                                               !CSSMin::isRemoteUrl( $url ) && !CSSMin::isLocalUrl( $url )
+                                                               !self::isRemoteUrl( $url ) && !self::isLocalUrl( $url )
                                                                && file_exists( $file )
                                                        ) {
                                                                $mimeTypes[ CSSMin::getMimeType( $file ) ] = true;
@@ -391,11 +363,10 @@ class CSSMin {
        /**
         * Is this CSS rule referencing a remote URL?
         *
-        * @private Until we require PHP 5.5 and we can access self:: from closures.
         * @param string $maybeUrl
         * @return bool
         */
-       public static function isRemoteUrl( $maybeUrl ) {
+       protected static function isRemoteUrl( $maybeUrl ) {
                if ( substr( $maybeUrl, 0, 2 ) === '//' || parse_url( $maybeUrl, PHP_URL_SCHEME ) ) {
                        return true;
                }
@@ -405,11 +376,10 @@ class CSSMin {
        /**
         * Is this CSS rule referencing a local URL?
         *
-        * @private Until we require PHP 5.5 and we can access self:: from closures.
         * @param string $maybeUrl
         * @return bool
         */
-       public static function isLocalUrl( $maybeUrl ) {
+       protected static function isLocalUrl( $maybeUrl ) {
                if ( $maybeUrl !== '' && $maybeUrl[0] === '/' && !self::isRemoteUrl( $maybeUrl ) ) {
                        return true;
                }