diff --git a/changelog.txt b/changelog.txt
index fdf70081364e9..0149b4c2b7bf5 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -229,7 +229,7 @@
### Experiments
-- Fonts Library: Backend. ([52704](https://github.com/WordPress/gutenberg/pull/52704))
+- Font Library: Backend. ([52704](https://github.com/WordPress/gutenberg/pull/52704))
#### Block API
- /add custom connections inspector control. ([53241](https://github.com/WordPress/gutenberg/pull/53241))
diff --git a/lib/experimental/fonts/font-face/bc-layer/webfonts-deprecations.php b/lib/experimental/fonts/font-face/bc-layer/webfonts-deprecations.php
index 4de2e6221d50b..2534d8db16527 100644
--- a/lib/experimental/fonts/font-face/bc-layer/webfonts-deprecations.php
+++ b/lib/experimental/fonts/font-face/bc-layer/webfonts-deprecations.php
@@ -176,7 +176,7 @@ function wp_print_webfonts() {
* 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.
+ * @deprecated 16.3.0 Use Font Library and Font Face. Fonts API is not supported.
*
* @global WP_Fonts $wp_fonts
*
@@ -280,7 +280,7 @@ function wp_register_font_provider() {
* @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.
+ * including in theme and user activated fonts from the Font Library.
*
* @return array Empty array.
*/
diff --git a/lib/experimental/fonts/fonts-library/class-wp-font-family-utils.php b/lib/experimental/fonts/font-library/class-wp-font-family-utils.php
similarity index 90%
rename from lib/experimental/fonts/fonts-library/class-wp-font-family-utils.php
rename to lib/experimental/fonts/font-library/class-wp-font-family-utils.php
index ef239936b8e5a..607360d0c7e66 100644
--- a/lib/experimental/fonts/fonts-library/class-wp-font-family-utils.php
+++ b/lib/experimental/fonts/font-library/class-wp-font-family-utils.php
@@ -5,7 +5,7 @@
* This file contains utils fot Font Family class.
*
* @package WordPress
- * @subpackage Fonts Library
+ * @subpackage Font Library
* @since 6.4.0
*/
@@ -14,7 +14,7 @@
}
/**
- * A class of utilities for working with the Fonts Library.
+ * A class of utilities for working with the Font Library.
*
* @since 6.4.0
*/
@@ -85,8 +85,8 @@ public static function merge_fonts_data( $font1, $font2 ) {
* @return bool True if the file has a font MIME type, false otherwise.
*/
public static function has_font_mime_type( $filepath ) {
- $filetype = wp_check_filetype( $filepath, WP_Fonts_Library::ALLOWED_FONT_MIME_TYPES );
+ $filetype = wp_check_filetype( $filepath, WP_Font_Library::ALLOWED_FONT_MIME_TYPES );
- return in_array( $filetype['type'], WP_Fonts_Library::ALLOWED_FONT_MIME_TYPES, true );
+ return in_array( $filetype['type'], WP_Font_Library::ALLOWED_FONT_MIME_TYPES, true );
}
}
diff --git a/lib/experimental/fonts/fonts-library/class-wp-font-family.php b/lib/experimental/fonts/font-library/class-wp-font-family.php
similarity index 97%
rename from lib/experimental/fonts/fonts-library/class-wp-font-family.php
rename to lib/experimental/fonts/font-library/class-wp-font-family.php
index 363bbe9b47928..76ffcd402ac9d 100644
--- a/lib/experimental/fonts/fonts-library/class-wp-font-family.php
+++ b/lib/experimental/fonts/font-library/class-wp-font-family.php
@@ -5,7 +5,7 @@
* This file contains the Font Family class definition.
*
* @package WordPress
- * @subpackage Fonts Library
+ * @subpackage Font Library
* @since 6.4.0
*/
@@ -14,7 +14,7 @@
}
/**
- * Fonts Library class.
+ * Font Library class.
*
* @since 6.4.0
*/
@@ -135,7 +135,7 @@ public function uninstall() {
*/
private static function delete_asset( $src ) {
$filename = basename( $src );
- $file_path = path_join( WP_Fonts_Library::get_fonts_dir(), $filename );
+ $file_path = path_join( WP_Font_Library::get_fonts_dir(), $filename );
wp_delete_file( $file_path );
@@ -513,7 +513,7 @@ private function update_font_post( $post ) {
}
/**
- * Creates a post for a font in the fonts library if it doesn't exist,
+ * Creates a post for a font in the Font Library if it doesn't exist,
* or updates it if it does.
*
* @since 6.4.0
@@ -541,9 +541,9 @@ private function create_or_update_font_post() {
* @return array|WP_Error An array of font family data on success, WP_Error otherwise.
*/
public function install( $files = null ) {
- add_filter( 'upload_dir', array( 'WP_Fonts_Library', 'set_upload_dir' ) );
+ add_filter( 'upload_dir', array( 'WP_Font_Library', 'set_upload_dir' ) );
$were_assets_written = $this->download_or_move_font_faces( $files );
- remove_filter( 'upload_dir', array( 'WP_Fonts_Library', 'set_upload_dir' ) );
+ remove_filter( 'upload_dir', array( 'WP_Font_Library', 'set_upload_dir' ) );
if ( ! $were_assets_written ) {
return new WP_Error(
diff --git a/lib/experimental/fonts/fonts-library/class-wp-fonts-library.php b/lib/experimental/fonts/font-library/class-wp-font-library.php
similarity index 85%
rename from lib/experimental/fonts/fonts-library/class-wp-fonts-library.php
rename to lib/experimental/fonts/font-library/class-wp-font-library.php
index f0482ae9a864a..6459a91873fea 100644
--- a/lib/experimental/fonts/fonts-library/class-wp-fonts-library.php
+++ b/lib/experimental/fonts/font-library/class-wp-font-library.php
@@ -1,24 +1,24 @@
'font/otf',
diff --git a/lib/experimental/fonts/fonts-library/class-wp-rest-fonts-library-controller.php b/lib/experimental/fonts/font-library/class-wp-rest-font-library-controller.php
similarity index 90%
rename from lib/experimental/fonts/fonts-library/class-wp-rest-fonts-library-controller.php
rename to lib/experimental/fonts/font-library/class-wp-rest-font-library-controller.php
index d4abfec476b66..59e42d8716124 100644
--- a/lib/experimental/fonts/fonts-library/class-wp-rest-fonts-library-controller.php
+++ b/lib/experimental/fonts/font-library/class-wp-rest-font-library-controller.php
@@ -1,24 +1,24 @@
WP_REST_Server::EDITABLE,
'callback' => array( $this, 'install_fonts' ),
- 'permission_callback' => array( $this, 'update_fonts_library_permissions_check' ),
+ 'permission_callback' => array( $this, 'update_font_library_permissions_check' ),
'args' => array(
'fontFamilies' => array(
'required' => true,
@@ -62,7 +62,7 @@ public function register_routes() {
array(
'methods' => WP_REST_Server::DELETABLE,
'callback' => array( $this, 'uninstall_fonts' ),
- 'permission_callback' => array( $this, 'update_fonts_library_permissions_check' ),
+ 'permission_callback' => array( $this, 'update_font_library_permissions_check' ),
'args' => $this->uninstall_schema(),
),
)
@@ -216,7 +216,7 @@ public function uninstall_schema() {
}
/**
- * Removes font families from the fonts library and all their assets.
+ * Removes font families from the Font Library and all their assets.
*
* @since 6.4.0
*
@@ -240,17 +240,17 @@ public function uninstall_fonts( $request ) {
}
/**
- * Checks whether the user has permissions to update the fonts library.
+ * Checks whether the user has permissions to update the Font Library.
*
* @since 6.4.0
*
* @return true|WP_Error True if the request has write access for the item, WP_Error object otherwise.
*/
- public function update_fonts_library_permissions_check() {
+ public function update_font_library_permissions_check() {
if ( ! current_user_can( 'edit_theme_options' ) ) {
return new WP_Error(
- 'rest_cannot_update_fonts_library',
- __( 'Sorry, you are not allowed to update the fonts library on this site.', 'gutenberg' ),
+ 'rest_cannot_update_font_library',
+ __( 'Sorry, you are not allowed to update the Font Library on this site.', 'gutenberg' ),
array(
'status' => rest_authorization_required_code(),
)
@@ -277,13 +277,13 @@ public function update_fonts_library_permissions_check() {
* Installs new fonts.
*
* Takes a request containing new fonts to install, downloads their assets, and adds them
- * to the fonts library.
+ * to the Font Library.
*
* @since 6.4.0
*
* @param WP_REST_Request $request The request object containing the new fonts to install
* in the request parameters.
- * @return WP_REST_Response|WP_Error The updated fonts library post content.
+ * @return WP_REST_Response|WP_Error The updated Font Library post content.
*/
public function install_fonts( $request ) {
// Get new fonts to install.
diff --git a/lib/experimental/fonts/fonts-library/fonts-library.php b/lib/experimental/fonts/font-library/font-library.php
similarity index 66%
rename from lib/experimental/fonts/fonts-library/fonts-library.php
rename to lib/experimental/fonts/font-library/font-library.php
index 359442f231fc7..96a33923917ec 100644
--- a/lib/experimental/fonts/fonts-library/fonts-library.php
+++ b/lib/experimental/fonts/font-library/font-library.php
@@ -1,11 +1,11 @@
true,
@@ -29,9 +29,9 @@ function gutenberg_init_fonts_library() {
register_post_type( 'wp_font_family', $args );
// @core-merge: This code will go into Core's `create_initial_rest_routes()`.
- $fonts_library_controller = new WP_REST_Fonts_Library_Controller();
- $fonts_library_controller->register_routes();
+ $font_library_controller = new WP_REST_Font_Library_Controller();
+ $font_library_controller->register_routes();
}
-add_action( 'rest_api_init', 'gutenberg_init_fonts_library' );
+add_action( 'rest_api_init', 'gutenberg_init_font_library' );
diff --git a/lib/load.php b/lib/load.php
index 03416c8788769..cfd5c4f38d0c5 100644
--- a/lib/load.php
+++ b/lib/load.php
@@ -154,18 +154,21 @@ function gutenberg_is_experiment_enabled( $name ) {
remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WordPress 6.0's stopgap handler.
/*
- * If the Fonts Library is available, load the Font Face files, else load the Fonts API.
- * This strategy is temporary until the Fonts Library is merged. It's used here to allow
- * the Font Face (redesigned Fonts API) to be merged before the Fonts Library while
+ * If the Font Library is available, load the Font Face files, else load the Fonts API.
+ * This strategy is temporary until the Font Library is merged. It's used here to allow
+ * the Font Face (redesigned Fonts API) to be merged before the Font Library while
* keeping Fonts API available for sites that are using it.
*/
-if ( defined( 'FONTS_LIBRARY_ENABLE' ) && FONTS_LIBRARY_ENABLE ) {
- // Loads the Fonts Library.
- require __DIR__ . '/experimental/fonts/fonts-library/class-wp-fonts-library.php';
- require __DIR__ . '/experimental/fonts/fonts-library/class-wp-font-family-utils.php';
- require __DIR__ . '/experimental/fonts/fonts-library/class-wp-font-family.php';
- require __DIR__ . '/experimental/fonts/fonts-library/class-wp-rest-fonts-library-controller.php';
- require __DIR__ . '/experimental/fonts/fonts-library/fonts-library.php';
+if (
+ ( defined( 'FONT_LIBRARY_ENABLE' ) && FONT_LIBRARY_ENABLE ) ||
+ ( defined( 'FONTS_LIBRARY_ENABLE' ) && FONTS_LIBRARY_ENABLE )
+) {
+ // Loads the Font Library.
+ 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_Face' ) ) {
require __DIR__ . '/experimental/fonts/font-face/class-wp-font-face.php';
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 5cf01a02fef69..8e8a0fb2f0921 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -9,7 +9,7 @@
>
-
+
diff --git a/phpunit/fonts/fonts-library/class-wp-rest-fonts-library-controller-test.php b/phpunit/fonts/font-library/class-wp-rest-font-library-controller-test.php
similarity index 98%
rename from phpunit/fonts/fonts-library/class-wp-rest-fonts-library-controller-test.php
rename to phpunit/fonts/font-library/class-wp-rest-font-library-controller-test.php
index 1bbce5f7cb920..f55d221acba96 100644
--- a/phpunit/fonts/fonts-library/class-wp-rest-fonts-library-controller-test.php
+++ b/phpunit/fonts/font-library/class-wp-rest-font-library-controller-test.php
@@ -1,15 +1,15 @@
assertStringEndsWith( '/wp-content/uploads/fonts', WP_Font_Library::get_fonts_dir() );
+ }
+}
diff --git a/phpunit/fonts/fonts-library/wpFontsLibrary/setUploadDir-test.php b/phpunit/fonts/font-library/wpFontLibrary/setUploadDir-test.php
similarity index 65%
rename from phpunit/fonts/fonts-library/wpFontsLibrary/setUploadDir-test.php
rename to phpunit/fonts/font-library/wpFontLibrary/setUploadDir-test.php
index ad038260caa42..6d159d261f2f4 100644
--- a/phpunit/fonts/fonts-library/wpFontsLibrary/setUploadDir-test.php
+++ b/phpunit/fonts/font-library/wpFontLibrary/setUploadDir-test.php
@@ -1,16 +1,16 @@
'/var/www/html/wp-content/uploads/fonts',
'url' => 'http://example.com/wp-content/uploads/fonts',
);
- $this->assertSame( $expected, WP_Fonts_Library::set_upload_dir( $defaults ) );
+ $this->assertSame( $expected, WP_Font_Library::set_upload_dir( $defaults ) );
}
}
diff --git a/phpunit/fonts/fonts-library/wpFontsLibrary/getFontsDir-test.php b/phpunit/fonts/fonts-library/wpFontsLibrary/getFontsDir-test.php
deleted file mode 100644
index 4ed6616c813d0..0000000000000
--- a/phpunit/fonts/fonts-library/wpFontsLibrary/getFontsDir-test.php
+++ /dev/null
@@ -1,18 +0,0 @@
-assertStringEndsWith( '/wp-content/uploads/fonts', WP_Fonts_Library::get_fonts_dir() );
- }
-}
diff --git a/phpunit/multisite.xml b/phpunit/multisite.xml
index 23de57aa1d9bd..03b0b5314bc50 100644
--- a/phpunit/multisite.xml
+++ b/phpunit/multisite.xml
@@ -10,7 +10,7 @@
-
+