Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: remove "has_font_mime_type" function #57364

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ public static function merge_fonts_data( $font1, $font2 ) {
return $merged_font;
}

/**
* Returns whether the given file has a font MIME type.
*
* @since 6.5.0
*
* @param string $filepath The file to check.
* @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 );

return in_array( $filetype['type'], $allowed_mime_types, true );
}

/**
* Format font family to make it valid CSS.
*
Expand Down
11 changes: 0 additions & 11 deletions lib/experimental/fonts/font-library/class-wp-font-family.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ private function get_upload_overrides( $filename ) {
* False if the download failed.
*/
private function download_asset( $url, $filename ) {
// Checks if the file to be downloaded has a font mime type.
if ( ! WP_Font_Family_Utils::has_font_mime_type( $filename ) ) {
return false;
}

// Include file with download_url() if function doesn't exist.
if ( ! function_exists( 'download_url' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
Expand Down Expand Up @@ -263,12 +258,6 @@ private function move_font_face_asset( $font_face, $file ) {
// because it is no longer needed.
unset( $new_font_face['uploadedFile'] );

// If the filename has no font mime type, don't move the file and
// return the font face definition without src to be ignored later.
if ( ! WP_Font_Family_Utils::has_font_mime_type( $filename ) ) {
return $new_font_face;
}

// Move the uploaded font asset from the temp folder to the fonts directory.
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
Expand Down

This file was deleted.