Changeset 13682
- Timestamp:
- 03/12/2010 12:38:04 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/ms-files.php
r13514 r13682 20 20 die( '404 — File not found.' ); 21 21 } 22 23 if ( !function_exists('wp_check_filetype') ) :24 function wp_check_filetype($filename, $mimes = null) {25 // Accepted MIME types are set here as PCRE unless provided.26 $mimes = is_array($mimes) ? $mimes : array (27 'jpg|jpeg|jpe' => 'image/jpeg',28 'gif' => 'image/gif',29 'png' => 'image/png',30 'bmp' => 'image/bmp',31 'tif|tiff' => 'image/tiff',32 'ico' => 'image/x-icon',33 'asf|asx|wax|wmv|wmx' => 'video/asf',34 'avi' => 'video/avi',35 'mov|qt' => 'video/quicktime',36 'mpeg|mpg|mpe' => 'video/mpeg',37 'txt|c|cc|h' => 'text/plain',38 'rtx' => 'text/richtext',39 'css' => 'text/css',40 'htm|html' => 'text/html',41 'mp3|mp4' => 'audio/mpeg',42 'ra|ram' => 'audio/x-realaudio',43 'wav' => 'audio/wav',44 'ogg' => 'audio/ogg',45 'mid|midi' => 'audio/midi',46 'wma' => 'audio/wma',47 'rtf' => 'application/rtf',48 'js' => 'application/javascript',49 'pdf' => 'application/pdf',50 'doc' => 'application/msword',51 'pot|pps|ppt' => 'application/vnd.ms-powerpoint',52 'wri' => 'application/vnd.ms-write',53 'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',54 'mdb' => 'application/vnd.ms-access',55 'mpp' => 'application/vnd.ms-project',56 'swf' => 'application/x-shockwave-flash',57 'class' => 'application/java',58 'tar' => 'application/x-tar',59 'zip' => 'application/zip',60 'gz|gzip' => 'application/x-gzip',61 'exe' => 'application/x-msdownload'62 );63 64 $type = false;65 $ext = false;66 67 foreach ( (array) $mimes as $ext_preg => $mime_match ) {68 $ext_preg = '!\.(' . $ext_preg . ')$!i';69 if ( preg_match($ext_preg, $filename, $ext_matches) ) {70 $type = $mime_match;71 $ext = $ext_matches[1];72 break;73 }74 }75 76 return compact('ext', 'type');77 }78 endif;79 22 80 23 $file = BLOGUPLOADDIR . str_replace( '..', '', $_GET[ 'file' ] );
Note: See TracChangeset
for help on using the changeset viewer.