From 1a6a2a7c1dd955f3dcac0b857e5a4a8b4d9c359b Mon Sep 17 00:00:00 2001 From: hellofromtonya Date: Thu, 31 Aug 2023 21:43:33 -0500 Subject: [PATCH] Load file if ! class_exists --- lib/load.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/load.php b/lib/load.php index ede4a8674c7193..72bc0ab66a99b4 100644 --- a/lib/load.php +++ b/lib/load.php @@ -165,19 +165,21 @@ function gutenberg_is_experiment_enabled( $name ) { ( defined( 'FONTS_LIBRARY_ENABLE' ) && FONTS_LIBRARY_ENABLE ) ) { // Loads the Font Library. - require __DIR__ . '/experimental/fonts/font-library/class-wp-font-collection.php'; - require __DIR__ . '/experimental/fonts/font-library/class-wp-font-library.php'; - require __DIR__ . '/experimental/fonts/font-library/class-wp-font-family-utils.php'; - require __DIR__ . '/experimental/fonts/font-library/class-wp-font-family.php'; - require __DIR__ . '/experimental/fonts/font-library/class-wp-rest-font-library-controller.php'; - require __DIR__ . '/experimental/fonts/font-library/font-library.php'; + if ( ! class_exists( 'WP_Font_Library' ) ) { + require __DIR__ . '/experimental/fonts/font-library/class-wp-font-collection.php'; + require __DIR__ . '/experimental/fonts/font-library/class-wp-font-library.php'; + require __DIR__ . '/experimental/fonts/font-library/class-wp-font-family-utils.php'; + require __DIR__ . '/experimental/fonts/font-library/class-wp-font-family.php'; + require __DIR__ . '/experimental/fonts/font-library/class-wp-rest-font-library-controller.php'; + require __DIR__ . '/experimental/fonts/font-library/font-library.php'; + } // Load the Font Face. - require __DIR__ . '/compat/wordpress-6.4/fonts/font-face/class-wp-font-face.php'; - require __DIR__ . '/compat/wordpress-6.4/fonts/font-face/class-wp-font-face-resolver.php'; - - // A general purpose file for all fonts PHP functions and hooks. - require __DIR__ . '/compat/wordpress-6.4/fonts/fonts.php'; + if ( ! class_exists( 'WP_Font_Face' ) ) { + require __DIR__ . '/compat/wordpress-6.4/fonts/font-face/class-wp-font-face.php'; + require __DIR__ . '/compat/wordpress-6.4/fonts/font-face/class-wp-font-face-resolver.php'; + require __DIR__ . '/compat/wordpress-6.4/fonts/fonts.php'; + } // Load the BC Layer to avoid fatal errors of extenders using the Fonts API. // @core-merge: do not merge the BC layer files into WordPress Core.