Changeset 37189 for trunk/src/wp-includes/functions.php
- Timestamp:
- 04/13/2016 03:11:25 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r36925 r37189 2186 2186 $ext = strtolower( $ext ); 2187 2187 2188 /** 2189 * Filter file type based on the extension name. 2190 * 2191 * @since 2.5.0 2192 * 2193 * @see wp_ext2type() 2194 * 2195 * @param array $ext2type Multi-dimensional array with extensions for a default set 2196 * of file types. 2197 */ 2198 $ext2type = apply_filters( 'ext2type', array( 2199 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ), 2200 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), 2201 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), 2202 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ), 2203 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ), 2204 'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ), 2205 'text' => array( 'asc', 'csv', 'tsv', 'txt' ), 2206 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ), 2207 'code' => array( 'css', 'htm', 'html', 'php', 'js' ), 2208 ) ); 2209 2188 $ext2type = wp_get_ext_types(); 2210 2189 foreach ( $ext2type as $type => $exts ) 2211 2190 if ( in_array( $ext, $exts ) ) … … 2452 2431 ) ); 2453 2432 } 2433 2434 /** 2435 * Retrieve list of common file extensions and their types. 2436 * 2437 * @since 4.6.0 2438 * 2439 * @return array Array of file extensions types keyed by the type of file. 2440 */ 2441 function wp_get_ext_types() { 2442 2443 /** 2444 * Filter file type based on the extension name. 2445 * 2446 * @since 2.5.0 2447 * 2448 * @see wp_ext2type() 2449 * 2450 * @param array $ext2type Multi-dimensional array with extensions for a default set 2451 * of file types. 2452 */ 2453 return apply_filters( 'ext2type', array( 2454 'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ), 2455 'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ), 2456 'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ), 2457 'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ), 2458 'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ), 2459 'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ), 2460 'text' => array( 'asc', 'csv', 'tsv', 'txt' ), 2461 'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ), 2462 'code' => array( 'css', 'htm', 'html', 'php', 'js' ), 2463 ) ); 2464 } 2465 2454 2466 /** 2455 2467 * Retrieve list of allowed mime types and file extensions.
Note: See TracChangeset
for help on using the changeset viewer.