diff --git a/lib/experimental/fonts/bc-layer/class-gutenberg-fonts-api-bc-layer.php b/lib/experimental/fonts/bc-layer/class-gutenberg-fonts-api-bc-layer.php new file mode 100644 index 0000000000000..7cf041148eedd --- /dev/null +++ b/lib/experimental/fonts/bc-layer/class-gutenberg-fonts-api-bc-layer.php @@ -0,0 +1,49 @@ +` element for wrapping the `@font-face` CSS. + * + * @since X.X.X + * @deprecated 16.3.0 Get style element is not supported. + * + * @return string Empty string. + */ + protected function get_style_element() { + _deprecated_function( __METHOD__, 'Gutenberg 16.3.0' ); + return ''; + } +} diff --git a/lib/experimental/fonts/bc-layer/class-wp-fonts-resolver.php b/lib/experimental/fonts/bc-layer/class-wp-fonts-resolver.php new file mode 100644 index 0000000000000..c2702348b9523 --- /dev/null +++ b/lib/experimental/fonts/bc-layer/class-wp-fonts-resolver.php @@ -0,0 +1,64 @@ +get_registered_font_families(). + * @deprecated 16.3.0 Register is not supported. + * + * @return array Empty array. + */ + public function get_registered_font_families() { + _deprecated_function( __METHOD__, 'Gutenberg 15.8.0' ); + return array(); + } + + /** + * Gets the list of registered fonts. + * + * @since 6.0.0 + * @deprecated 14.9.1 Use wp_fonts()->get_registered(). + * @deprecated 16.3.0 Register is not supported. + * + * @return array Empty array. + */ + public function get_registered_webfonts() { + _deprecated_function( __METHOD__, 'Gutenberg 14.9.1' ); + + return array(); + } + + /** + * Gets the list of enqueued fonts. + * + * @since 6.0.0 + * @deprecated 14.9.1 Use wp_fonts()->get_enqueued(). + * @deprecated 16.3.0 Enqueue is not supported. + * + * @return array Empty array. + */ + public function get_enqueued_webfonts() { + _deprecated_function( __METHOD__, 'Gutenberg 14.9.1' ); + return array(); + } + + /** + * Gets the list of all fonts. + * + * @since X.X.X + * @deprecated GB 14.9.1 Use wp_fonts()->get_registered(). + * @deprecated 16.3.0 This method is not supported. + * + * @return array[] + */ + public function get_all_webfonts() { + _deprecated_function( __METHOD__, 'Gutenberg 14.9.1', 'wp_fonts()->get_registered()' ); + return array(); + } + + /** + * Registers a webfont. + * + * @since 6.0.0 + * @deprecated GB 14.9.1 Use wp_register_fonts(). + * @deprecated 16.3.0 Register is not supported. + * + * @return bool False. + */ + public function register_webfont() { + _deprecated_function( __METHOD__, 'GB 14.9.1', 'wp_register_fonts()' ); + return false; + } + + /** + * Enqueue a font-family that has been already registered. + * + * @since XX.X + * @deprecated 14.9.1 Use wp_enqueue_fonts(). + * @deprecated 16.3.0 Register is not supported. + * + * @return bool False. + */ + public function enqueue_webfont() { + _deprecated_function( __METHOD__, 'Gutenberg 14.9.1' ); + return false; + } +} diff --git a/lib/experimental/fonts/bc-layer/webfonts-deprecations.php b/lib/experimental/fonts/bc-layer/webfonts-deprecations.php new file mode 100644 index 0000000000000..4de2e6221d50b --- /dev/null +++ b/lib/experimental/fonts/bc-layer/webfonts-deprecations.php @@ -0,0 +1,291 @@ +get_providers(). + * @deprecated 16.3.0 Providers are not supported. + * + * @return array Empty array. + */ + function wp_get_webfont_providers() { + _deprecated_function( __FUNCTION__, '14.9.1' ); + + return array(); + } +} + +if ( ! function_exists( 'wp_register_webfont_provider' ) ) { + /** + * Registers a custom font service provider. + * + * @since X.X.X + * @deprecated 15.1 Use wp_register_font_provider() instead. + * @deprecated 16.3.0 Providers are not supported. + * + * @return bool False. + */ + function wp_register_webfont_provider() { + _deprecated_function( __FUNCTION__, 'GB 15.1', 'wp_register_font_provider' ); + return false; + } +} + +if ( ! function_exists( 'wp_print_webfonts' ) ) { + /** + * Invokes each provider to process and print its styles. + * + * @since 14.9.1 + * @deprecated 15.1 Use wp_print_fonts() instead. + * @deprecated 16.3.0 Webfonts API is not supported. + * + * @return array Empty array. + */ + function wp_print_webfonts() { + _deprecated_function( __FUNCTION__, 'Gutenberg 15.1', 'wp_print_font_faces' ); + return array(); + } +} + +if ( ! function_exists( 'wp_fonts' ) ) { + /** + * Initialize $wp_fonts if it has not been set. + * + * @since X.X.X + * @deprecated 16.3.0 Use Fonts Library and Font Face. Fonts API is not supported. + * + * @global WP_Fonts $wp_fonts + * + * @return WP_Fonts WP_Fonts instance. + */ + function wp_fonts() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + + global $wp_fonts; + + if ( ! ( $wp_fonts instanceof WP_Fonts ) ) { + $wp_fonts = new WP_Fonts(); + } + + return $wp_fonts; + } +} + +if ( ! function_exists( 'wp_register_fonts' ) ) { + /** + * Registers one or more font-families and each of their variations. + * + * @since X.X.X + * @deprecated 16.3.0 Register is not supported. + * + * @return array Empty array. + */ + function wp_register_fonts() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + return array(); + } +} + +if ( ! function_exists( 'wp_enqueue_fonts' ) ) { + /** + * Enqueues one or more font family and all of its variations. + * + * @since X.X.X + * @deprecated 16.3.0 Enqueue is not supported. + */ + function wp_enqueue_fonts() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + } +} + +if ( ! function_exists( 'wp_enqueue_font_variations' ) ) { + /** + * Enqueues a specific set of font variations. + * + * @since X.X.X + * @deprecated 16.3.0 Enqueue is not supported. + */ + function wp_enqueue_font_variations() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + } +} + +if ( ! function_exists( 'wp_deregister_font_family' ) ) { + /** + * Deregisters a font family and all of its registered variations. + * + * @since X.X.X + * @deprecated 16.3.0 Deregister is not supported. + */ + function wp_deregister_font_family() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + } +} + +if ( ! function_exists( 'wp_deregister_font_variation' ) ) { + /** + * Deregisters a font variation. + * + * @since X.X.X + * @deprecated 16.3.0 Deregister is not supported. + */ + function wp_deregister_font_variation() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + } +} + +if ( ! function_exists( 'wp_register_font_provider' ) ) { + /** + * Registers a custom font service provider. + * + * @since X.X.X + * @deprecated 16.3.0 Providers are not supported. + * + * @return bool False. + */ + function wp_register_font_provider() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3' ); + return false; + } +} + +if ( ! function_exists( 'wp_print_fonts' ) ) { + /** + * Invokes each provider to process and print its styles. + * + * @since X.X.X + * @deprecated 16.3.0 For classic themes, use wp_print_font_faces(). For all other sites, + * Font Face will automatically print all fonts in theme.json merged data layer, + * including in theme and user activated fonts from the Fonts Library. + * + * @return array Empty array. + */ + function wp_print_fonts() { + _deprecated_function( __FUNCTION__, 'Gutenberg 16.3', 'wp_print_font_faces' ); + return array(); + } +} diff --git a/lib/load.php b/lib/load.php index 340a900130405..7ec11252e72e8 100644 --- a/lib/load.php +++ b/lib/load.php @@ -142,6 +142,20 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/fonts/class-wp-font-face.php'; require __DIR__ . '/experimental/fonts/class-wp-font-face-resolver.php'; require __DIR__ . '/experimental/fonts/fonts.php'; + + // Load the BC Layer. Do no backport to WP Core. + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-fonts-provider.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-fonts-utils.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-fonts.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-fonts-provider-local.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-fonts-resolver.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-gutenberg-fonts-api-bc-layer.php'; + require __DIR__ . '/experimental/fonts/bc-layer/webfonts-deprecations.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-webfonts-utils.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-webfonts-provider.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-webfonts-provider-local.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-webfonts.php'; + require __DIR__ . '/experimental/fonts/bc-layer/class-wp-web-fonts.php'; } } elseif ( ! class_exists( 'WP_Fonts' ) ) { // Fonts API files.