wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_ext2type › WordPress Function

Od2.5.0
Przestarzałyn/a
wp_ext2type ( $ext )
Parametry:
  • (string) $ext The extension to search.
    Wymagane: Tak
Powrót:
  • (string|void) The file type, example: audio, video, document, spreadsheet, etc.
Zdefiniowane na:
Codex:

Retrieves the file type based on the extension name.



Źródło

function wp_ext2type( $ext ) {
	$ext = strtolower( $ext );

	$ext2type = wp_get_ext_types();
	foreach ( $ext2type as $type => $exts ) {
		if ( in_array( $ext, $exts, true ) ) {
			return $type;
		}
	}
}