widget-options
/
includes
/
widgets
/
gutenberg
/
lib
/
experimental
/
fonts-api
/
bc-layer
/
class-wp-webfonts-utils.php
widget-options
/
includes
/
widgets
/
gutenberg
/
lib
/
experimental
/
fonts-api
/
bc-layer
Last commit date
class-gutenberg-fonts-api-bc-layer.php
1 year ago
class-wp-web-fonts.php
1 year ago
class-wp-webfonts-provider-local.php
1 year ago
class-wp-webfonts-provider.php
1 year ago
class-wp-webfonts-utils.php
1 year ago
class-wp-webfonts.php
1 year ago
webfonts-deprecations.php
1 year ago
class-wp-webfonts-utils.php
86 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Webfont API's utility helpers. |
| 4 | * |
| 5 | * BACKPORT NOTE: Do not backport this file to Core. |
| 6 | * This file is now part of the API's Backwards-Compatibility (BC) layer. |
| 7 | * |
| 8 | * @package WordPress |
| 9 | * @subpackage Fonts API |
| 10 | * @since X.X.X |
| 11 | */ |
| 12 | |
| 13 | if ( class_exists( 'WP_Webfonts_Utils' ) ) { |
| 14 | return; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Utility helpers for the Webfonts API. |
| 19 | * |
| 20 | * @since X.X.X |
| 21 | * @deprecated GB 15.1 Use WP_Fonts_Utils instead. |
| 22 | */ |
| 23 | class WP_Webfonts_Utils { |
| 24 | |
| 25 | /** |
| 26 | * Converts the given font family into a handle. |
| 27 | * |
| 28 | * @since X.X.X |
| 29 | * @deprecated 15.1 Use WP_Fonts_Utils::convert_font_family_into_handle() instead. |
| 30 | * |
| 31 | * @param string $font_family Font family to convert into a handle. |
| 32 | * @return string|null The font family handle on success. Else, null. |
| 33 | */ |
| 34 | public static function convert_font_family_into_handle( $font_family ) { |
| 35 | _deprecated_function( __METHOD__, 'GB 15.1', 'WP_Fonts_Utils::convert_font_family_into_handle()' ); |
| 36 | |
| 37 | return WP_Fonts_Utils::convert_font_family_into_handle( $font_family ); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Converts the given variation and its font-family into a handle. |
| 42 | * |
| 43 | * @since X.X.X |
| 44 | * @deprecated 15.1 Use WP_Fonts_Utils::convert_variation_into_handle() instead. |
| 45 | * |
| 46 | * @param string $font_family The font family's handle for this variation. |
| 47 | * @param array $variation An array of variation properties. |
| 48 | * @return string|null The variation handle. |
| 49 | */ |
| 50 | public static function convert_variation_into_handle( $font_family, array $variation ) { |
| 51 | _deprecated_function( __METHOD__, 'GB 15.1', 'WP_Fonts_Utils::convert_variation_into_handle()' ); |
| 52 | |
| 53 | return WP_Fonts_Utils::convert_variation_into_handle( $variation ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Gets the font family from the variation. |
| 58 | * |
| 59 | * @since X.X.X |
| 60 | * @deprecated 15.1 Use WP_Fonts_Utils::get_font_family_from_variation() instead. |
| 61 | * |
| 62 | * @param array $variation An array of variation properties to search. |
| 63 | * @return string|null The font family if defined. Else, null. |
| 64 | */ |
| 65 | public static function get_font_family_from_variation( array $variation ) { |
| 66 | _deprecated_function( __METHOD__, 'GB 15.1', 'WP_Fonts_Utils::get_font_family_from_variation()' ); |
| 67 | |
| 68 | return WP_Fonts_Utils::get_font_family_from_variation( $variation ); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Checks if the given input is defined, i.e. meaning is a non-empty string. |
| 73 | * |
| 74 | * @since X.X.X |
| 75 | * @deprecated 15.1 Use WP_Fonts_Utils::is_defined() instead. |
| 76 | * |
| 77 | * @param string $input The input to check. |
| 78 | * @return bool True when non-empty string. Else false. |
| 79 | */ |
| 80 | public static function is_defined( $input ) { |
| 81 | _deprecated_function( __METHOD__, 'GB 15.1', 'WP_Fonts_Utils::is_defined()' ); |
| 82 | |
| 83 | return WP_Fonts_Utils::is_defined( $input ); |
| 84 | } |
| 85 | } |
| 86 |