Merge branch 'MDL-44773-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE
[moodle.git] / lib / lessphp / Mime.php
blob36067955c9bfafe9b2dd40c8023daa49c853ed3c
1 <?php
3 /**
4 * Mime lookup
6 * @package Less
7 * @subpackage node
8 */
9 class Less_Mime{
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'
22 static function lookup( $filepath ){
23 $parts = explode('.',$filepath);
24 $ext = '.'.strtolower(array_pop($parts));
26 if( !isset(self::$_types[$ext]) ){
27 return null;
29 return self::$_types[$ext];
32 static function charsets_lookup( $type = null ){
33 // assumes all text types are UTF-8
34 return $type && preg_match('/^text\//',$type) ? 'UTF-8' : '';