Skip to content

Font Library: remove has_font_mime_type function #54875

@matiasbenedetto

Description

@matiasbenedetto

What?

We could simplify the code by entirely removing the WP_Font_Family_Utils::has_font_mime_type() function and its tests.
This was a workaround when we didn't have the wp_handle_upload() mime type checking in place.

public static function has_font_mime_type( $filepath ) {
$filetype = wp_check_filetype( $filepath, WP_Font_Library::ALLOWED_FONT_MIME_TYPES );
return in_array( $filetype['type'], WP_Font_Library::ALLOWED_FONT_MIME_TYPES, true );
}
}

Why?

We can remove it now because it's no longer necessary. The mime type check of the downloaded/uploaded files is done by the core function wp_handle_upload, and a custom check is no longer required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueAn issue that's suitable for someone looking to contribute for the first time[Feature] TypographyFont and typography-related issues and PRs[Type] Code QualityIssues or PRs that relate to code quality[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions