wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
wp_check_filetype › WordPress Function
Od2.0.4
Przestarzałyn/a
› wp_check_filetype ( $filename, $mimes = null )
Parametry: (2) |
|
Powrót: |
|
Zdefiniowane na: |
|
Codex: |
Retrieves the file type from the file name.
You can optionally define the mime array, if needed.Powiązane Funkcje: wp_check_filetype_and_ext, wp_cache_delete, wp_checkdate, wp_match_mime_types, wp_get_mime_types
Źródło
function wp_check_filetype( $filename, $mimes = null ) { if ( empty( $mimes ) ) { $mimes = get_allowed_mime_types(); } $type = false; $ext = false; foreach ( $mimes as $ext_preg => $mime_match ) { $ext_preg = '!\.(' . $ext_preg . ')$!i'; if ( preg_match( $ext_preg, $filename, $ext_matches ) ) { $type = $mime_match; $ext = $ext_matches[1]; break; } } return compact( 'ext', 'type' ); }