Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
linting changes
  • Loading branch information
pbking committed Sep 26, 2023
commit e49d7394af7cbd7df83e676d2fd4f3c709aaef27
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public static function merge_fonts_data( $font1, $font2 ) {
* @return bool True if the file has a font MIME type, false otherwise.
*/
public static function has_font_mime_type( $filepath ) {
$allowed_mime_types = WP_Font_Library::get_expected_font_mime_types_per_PHP_version();
$filetype = wp_check_filetype( $filepath, $allowed_mime_types );
$allowed_mime_types = WP_Font_Library::get_expected_font_mime_types_per_php_version();
$filetype = wp_check_filetype( $filepath, $allowed_mime_types );

return in_array( $filetype['type'], $allowed_mime_types, true );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private function get_upload_overrides( $filename ) {
// Seems mime type for files that are not images cannot be tested.
// See wp_check_filetype_and_ext().
'test_type' => true,
'mimes' => WP_Font_Library::get_expected_font_mime_types_per_PHP_version(),
'mimes' => WP_Font_Library::get_expected_font_mime_types_per_php_version(),
'unique_filename_callback' => static function () use ( $filename ) {
// Keep the original filename.
return $filename;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WP_Font_Library {
*
* @return Array A collection of mime types keyed by file extension.
*/
public static function get_expected_font_mime_types_per_PHP_version( $php_version_id = PHP_VERSION_ID ) {
public static function get_expected_font_mime_types_per_php_version( $php_version_id = PHP_VERSION_ID ) {

$php_7_ttf_mime_type = $php_version_id >= 70300 ? 'application/font-sfnt' : 'application/x-font-ttf';

Expand Down Expand Up @@ -144,6 +144,6 @@ public static function set_upload_dir( $defaults ) {
* @return array Modified upload directory.
*/
public static function set_allowed_mime_types( $mime_types ) {
return array_merge( $mime_types, self::get_expected_font_mime_types_per_PHP_version() );
return array_merge( $mime_types, self::get_expected_font_mime_types_per_php_version() );
}
}