77 * This version integrates with the standard WordPress admin interface,
88 * keeping the wp-admin sidebar and scripts/styles intact.
99 *
10- * @package gutenberg
10+ * @package wp
1111 */
1212
1313// Global storage for font-library routes and menu items
14- global $ gutenberg_font_library_wp_admin_routes , $ gutenberg_font_library_wp_admin_menu_items ;
15- $ gutenberg_font_library_wp_admin_routes = array ();
16- $ gutenberg_font_library_wp_admin_menu_items = array ();
14+ global $ wp_font_library_wp_admin_routes , $ wp_font_library_wp_admin_menu_items ;
15+ $ wp_font_library_wp_admin_routes = array ();
16+ $ wp_font_library_wp_admin_menu_items = array ();
1717
18- if ( ! function_exists ( 'register_font_library_wp_admin_route ' ) ) {
18+ if ( ! function_exists ( 'wp_register_font_library_wp_admin_route ' ) ) {
1919 /**
2020 * Register a route for the font-library-wp-admin page.
2121 *
2222 * @param string $path Route path (e.g., '/types/$type/edit/$id').
2323 * @param string|null $content_module Script module ID for content (stage/inspector).
2424 * @param string|null $route_module Script module ID for route lifecycle hooks.
2525 */
26- function register_font_library_wp_admin_route ( $ path , $ content_module = null , $ route_module = null ) {
27- global $ gutenberg_font_library_wp_admin_routes ;
26+ function wp_register_font_library_wp_admin_route ( $ path , $ content_module = null , $ route_module = null ) {
27+ global $ wp_font_library_wp_admin_routes ;
2828
2929 $ route = array ( 'path ' => $ path );
3030 if ( ! empty ( $ content_module ) ) {
@@ -34,11 +34,11 @@ function register_font_library_wp_admin_route( $path, $content_module = null, $r
3434 $ route ['route_module ' ] = $ route_module ;
3535 }
3636
37- $ gutenberg_font_library_wp_admin_routes [] = $ route ;
37+ $ wp_font_library_wp_admin_routes [] = $ route ;
3838 }
3939}
4040
41- if ( ! function_exists ( 'register_font_library_wp_admin_menu_item ' ) ) {
41+ if ( ! function_exists ( 'wp_register_font_library_wp_admin_menu_item ' ) ) {
4242 /**
4343 * Register a menu item for the font-library-wp-admin page.
4444 * Note: Menu items are registered but not displayed in single-page mode.
@@ -48,8 +48,8 @@ function register_font_library_wp_admin_route( $path, $content_module = null, $r
4848 * @param string $to Route path to navigate to.
4949 * @param string $parent_id Optional. Parent menu item ID.
5050 */
51- function register_font_library_wp_admin_menu_item ( $ id , $ label , $ to , $ parent_id = '' ) {
52- global $ gutenberg_font_library_wp_admin_menu_items ;
51+ function wp_register_font_library_wp_admin_menu_item ( $ id , $ label , $ to , $ parent_id = '' ) {
52+ global $ wp_font_library_wp_admin_menu_items ;
5353
5454 $ menu_item = array (
5555 'id ' => $ id ,
@@ -61,40 +61,40 @@ function register_font_library_wp_admin_menu_item( $id, $label, $to, $parent_id
6161 $ menu_item ['parent ' ] = $ parent_id ;
6262 }
6363
64- $ gutenberg_font_library_wp_admin_menu_items [] = $ menu_item ;
64+ $ wp_font_library_wp_admin_menu_items [] = $ menu_item ;
6565 }
6666}
6767
68- if ( ! function_exists ( 'get_font_library_wp_admin_routes ' ) ) {
68+ if ( ! function_exists ( 'wp_get_font_library_wp_admin_routes ' ) ) {
6969 /**
7070 * Get all registered routes for the font-library-wp-admin page.
7171 *
7272 * @return array Array of route objects.
7373 */
74- function get_font_library_wp_admin_routes () {
75- global $ gutenberg_font_library_wp_admin_routes ;
76- return $ gutenberg_font_library_wp_admin_routes ?? array ();
74+ function wp_get_font_library_wp_admin_routes () {
75+ global $ wp_font_library_wp_admin_routes ;
76+ return $ wp_font_library_wp_admin_routes ?? array ();
7777 }
7878}
7979
80- if ( ! function_exists ( 'get_font_library_wp_admin_menu_items ' ) ) {
80+ if ( ! function_exists ( 'wp_get_font_library_wp_admin_menu_items ' ) ) {
8181 /**
8282 * Get all registered menu items for the font-library-wp-admin page.
8383 *
8484 * @return array Array of menu item objects.
8585 */
86- function get_font_library_wp_admin_menu_items () {
87- global $ gutenberg_font_library_wp_admin_menu_items ;
88- return $ gutenberg_font_library_wp_admin_menu_items ?? array ();
86+ function wp_get_font_library_wp_admin_menu_items () {
87+ global $ wp_font_library_wp_admin_menu_items ;
88+ return $ wp_font_library_wp_admin_menu_items ?? array ();
8989 }
9090}
9191
92- if ( ! function_exists ( 'font_library_wp_admin_preload_data ' ) ) {
92+ if ( ! function_exists ( 'wp_font_library_wp_admin_preload_data ' ) ) {
9393 /**
9494 * Preload REST API data for the font-library-wp-admin page.
9595 * Automatically called during page rendering.
9696 */
97- function font_library_wp_admin_preload_data () {
97+ function wp_font_library_wp_admin_preload_data () {
9898 // Define paths to preload - same for all pages
9999 $ preload_paths = array (
100100 '/?_fields=description,gmt_offset,home,name,site_icon,site_icon_url,site_logo,timezone_string,url,page_for_posts,page_on_front,show_on_front ' ,
@@ -120,14 +120,14 @@ function font_library_wp_admin_preload_data() {
120120 }
121121}
122122
123- if ( ! function_exists ( 'font_library_wp_admin_enqueue_scripts ' ) ) {
123+ if ( ! function_exists ( 'wp_font_library_wp_admin_enqueue_scripts ' ) ) {
124124 /**
125125 * Enqueue scripts and styles for the font-library-wp-admin page.
126126 * Hooked to admin_enqueue_scripts.
127127 *
128128 * @param string $hook_suffix The current admin page.
129129 */
130- function font_library_wp_admin_enqueue_scripts ( $ hook_suffix ) {
130+ function wp_font_library_wp_admin_enqueue_scripts ( $ hook_suffix ) {
131131 // Check all possible ways this page can be accessed:
132132 // 1. Menu page via admin.php?page=font-library-wp-admin (plugin)
133133 // 2. Direct file via font-library.php (Core) - screen ID will be 'font-library'
@@ -145,10 +145,10 @@ function font_library_wp_admin_enqueue_scripts( $hook_suffix ) {
145145 do_action ( 'font-library-wp-admin_init ' );
146146
147147 // Preload REST API data
148- font_library_wp_admin_preload_data ();
148+ wp_font_library_wp_admin_preload_data ();
149149
150150 // Get all registered routes
151- $ routes = get_font_library_wp_admin_routes ();
151+ $ routes = wp_get_font_library_wp_admin_routes ();
152152
153153 // Get boot module asset file for dependencies
154154 $ asset_file = ABSPATH . WPINC . '/js/dist/script-modules/boot/index.min.asset.php ' ;
@@ -218,13 +218,13 @@ function ( $handle ) {
218218 }
219219}
220220
221- if ( ! function_exists ( 'font_library_wp_admin_render_page ' ) ) {
221+ if ( ! function_exists ( 'wp_font_library_wp_admin_render_page ' ) ) {
222222 /**
223223 * Render the font-library-wp-admin page.
224224 * Call this function from add_menu_page or add_submenu_page.
225225 * This renders within the normal WordPress admin interface.
226226 */
227- function font_library_wp_admin_render_page () {
227+ function wp_font_library_wp_admin_render_page () {
228228 ?>
229229 <style>
230230 /* Critical styles to prevent layout shifts - inlined for immediate application */
@@ -285,5 +285,5 @@ function font_library_wp_admin_render_page() {
285285}
286286
287287// Hook the enqueue function to admin_enqueue_scripts
288- add_action ( 'admin_enqueue_scripts ' , 'font_library_wp_admin_enqueue_scripts ' );
288+ add_action ( 'admin_enqueue_scripts ' , 'wp_font_library_wp_admin_enqueue_scripts ' );
289289
0 commit comments