* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
* @return bool|string
*/
public static function getMimeType( $file ) {
+ // Infer the MIME-type from the file extension
+ $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
+ if ( isset( self::$mimeTypes[$ext] ) ) {
+ return self::$mimeTypes[$ext];
+ }
+
$realpath = realpath( $file );
if (
$realpath
return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
}
- // 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;
}
// * Otherwise remap the URL to work in generated stylesheets
// Guard against trailing slashes, because "some/remote/../foo.png"
- // resolves to "some/remote/foo.png" on (some?) clients (bug 27052).
+ // resolves to "some/remote/foo.png" on (some?) clients (T29052).
if ( substr( $remote, -1 ) == '/' ) {
$remote = substr( $remote, 0, -1 );
}