X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flibs%2FCSSMin.php;h=dcaa6857a27172b402ebd2ec6f6009bf1dcd8b47;hb=2700298740509a3f98a9e2cd81cfbce4f67ed114;hp=6b10ae46bf1293777330e791722ebbd2f541a5af;hpb=731346a7cb686ffe9a0e2f8a1e1fb3f5e8431a16;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/CSSMin.php b/includes/libs/CSSMin.php index 6b10ae46bf..dcaa6857a2 100644 --- a/includes/libs/CSSMin.php +++ b/includes/libs/CSSMin.php @@ -44,7 +44,7 @@ class CSSMin { /* Protected Static Members */ - /** @var array List of common image files extensions and mime-types */ + /** @var array List of common image files extensions and MIME-types */ protected static $mimeTypes = array( 'gif' => 'image/gif', 'jpe' => 'image/jpeg', @@ -135,27 +135,21 @@ class CSSMin { */ public static function getMimeType( $file ) { $realpath = realpath( $file ); - // Try a couple of different ways to get the mime-type of a file, in order of - // preference if ( $realpath && function_exists( 'finfo_file' ) && function_exists( 'finfo_open' ) && defined( 'FILEINFO_MIME_TYPE' ) ) { - // As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo - // PECL extension return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath ); - } elseif ( function_exists( 'mime_content_type' ) ) { - // Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file - return mime_content_type( $file ); - } else { - // Worst-case scenario has happened, use the file extension to infer the mime-type - $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); - if ( isset( self::$mimeTypes[$ext] ) ) { - return self::$mimeTypes[$ext]; - } } + + // Infer the MIME-type from the file extension + $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); + if ( isset( self::$mimeTypes[$ext] ) ) { + return self::$mimeTypes[$ext]; + } + return false; } @@ -163,6 +157,8 @@ class CSSMin { * Build a CSS 'url()' value for the given URL, quoting parentheses (and other funny characters) * and escaping quotes as necessary. * + * See http://www.w3.org/TR/css-syntax-3/#consume-a-url-token + * * @param string $url URL to process * @return string 'url()' value, usually just `"url($url)"`, quoted/escaped if necessary */