[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Font Utils class. Provides utility functions for working with font families.
File Size: | 259 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_Font_Utils:: (6 methods):
maybe_add_quotes()
sanitize_font_family()
get_font_face_slug()
sanitize_from_schema()
apply_sanitizer()
get_allowed_font_mime_types()
Class: WP_Font_Utils - X-Ref
A class of utilities for working with the Font Library.maybe_add_quotes( $item ) X-Ref |
Adds surrounding quotes to font family names that contain special characters. It follows the recommendations from the CSS Fonts Module Level 4. return: string The font family name with surrounding quotes, if necessary. param: string $item A font family name. |
sanitize_font_family( $font_family ) X-Ref |
Sanitizes and formats font family names. - Applies `sanitize_text_field`. - Adds surrounding quotes to names containing any characters that are not alphabetic or dashes. It follows the recommendations from the CSS Fonts Module Level 4. return: string Sanitized and formatted font family name(s). param: string $font_family Font family name(s), comma-separated. |
get_font_face_slug( $settings ) X-Ref |
Generates a slug from font face properties, e.g. `open sans;normal;400;100%;U+0-10FFFF` Used for comparison with other font faces in the same family, to prevent duplicates that would both match according the CSS font matching spec. Uses only simple case-insensitive matching for fontFamily and unicodeRange, so does not handle overlapping font-family lists or unicode ranges. return: string Font face slug. param: array $settings { |
sanitize_from_schema( $tree, $schema ) X-Ref |
No description |
apply_sanitizer( $value, $sanitizer ) X-Ref |
Applies a sanitizer function to a value. return: mixed The sanitized value. param: mixed $value The value to sanitize. param: callable $sanitizer The sanitizer function to apply. |
get_allowed_font_mime_types() X-Ref |
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' filter. return: string[] A collection of mime types keyed by file extension. |
Generated : Thu Dec 26 08:20:01 2024 | Cross-referenced by PHPXref |