WP_Font_Utils::get_allowed_font_mime_types()
Returns the expected mime-type values for font files, depending on PHP version.
This is needed because font mime types vary by PHP version, so checking the PHP version is necessary until a list of valid mime-types for each file extension can be provided to the upload_mimes
Метод класса: WP_Font_Utils{}
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Строку[]
. A collection of mime types keyed by file extension.
Использование
$result = WP_Font_Utils::get_allowed_font_mime_types();
Список изменений
С версии 6.5.0 | Введена. |
Код WP_Font_Utils::get_allowed_font_mime_types() WP Font Utils::get allowed font mime types WP 6.7.1
public static function get_allowed_font_mime_types() { $php_7_ttf_mime_type = PHP_VERSION_ID >= 70300 ? 'application/font-sfnt' : 'application/x-font-ttf'; return array( 'otf' => 'application/vnd.ms-opentype', 'ttf' => PHP_VERSION_ID >= 70400 ? 'font/sfnt' : $php_7_ttf_mime_type, 'woff' => PHP_VERSION_ID >= 80112 ? 'font/woff' : 'application/font-woff', 'woff2' => PHP_VERSION_ID >= 80112 ? 'font/woff2' : 'application/font-woff2', ); }