]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/oyejorge/less.php/lib/Less/Mime.php
MediaWiki 1.30.2-scripts
[autoinstalls/mediawiki.git] / vendor / oyejorge / less.php / lib / Less / Mime.php
1 <?php
2
3 /**
4  * Mime lookup
5  *
6  * @package Less
7  * @subpackage node
8  */
9 class Less_Mime{
10
11         // this map is intentionally incomplete
12         // if you want more, install 'mime' dep
13         static $_types = array(
14                 '.htm' => 'text/html',
15                 '.html'=> 'text/html',
16                 '.gif' => 'image/gif',
17                 '.jpg' => 'image/jpeg',
18                 '.jpeg'=> 'image/jpeg',
19                 '.png' => 'image/png',
20                 '.ttf' => 'application/x-font-ttf',
21                 '.otf' => 'application/x-font-otf',
22                 '.eot' => 'application/vnd.ms-fontobject',
23                 '.woff' => 'application/x-font-woff',
24                 '.svg' => 'image/svg+xml',
25                 );
26
27         public static function lookup( $filepath ){
28                 $parts = explode('.',$filepath);
29                 $ext = '.'.strtolower(array_pop($parts));
30
31                 if( !isset(self::$_types[$ext]) ){
32                         return null;
33                 }
34                 return self::$_types[$ext];
35         }
36
37         public static function charsets_lookup( $type = null ){
38                 // assumes all text types are UTF-8
39                 return $type && preg_match('/^text\//',$type) ? 'UTF-8' : '';
40         }
41 }