' ); // phpcs:ignore $pages = array( '' => __( 'Dashboard', 'bookzenix' ), 'calendar' => __( 'Calendar', 'bookzenix' ), 'appointments' => __( 'Appointments', 'bookzenix' ), 'services' => __( 'Services', 'bookzenix' ), 'employees' => __( 'Employees', 'bookzenix' ), 'customers' => __( 'Customers', 'bookzenix' ), 'settings' => __( 'Settings', 'bookzenix' ), ); $brand = 'Bookzenix'; add_menu_page( $brand, $brand, $cap, self::SLUG, array( $this, 'render' ), $icon, 26 ); foreach ( $pages as $route => $label ) { add_submenu_page( self::SLUG, $label, $label, $cap, $route ? self::SLUG . '#/' . $route : self::SLUG, array( $this, 'render' ) ); } } public function render() { echo '
' . esc_html__( 'Loading…', 'bookzenix' ) . '
'; } public function assets( $hook ) { if ( false === strpos( (string) $hook, self::SLUG ) ) { return; } $dir = BOOKZENIX_DIR . 'assets/admin/'; $url = BOOKZENIX_URL . 'assets/admin/'; $ver = file_exists( $dir . 'admin.js' ) ? filemtime( $dir . 'admin.js' ) : BOOKZENIX_VERSION; wp_enqueue_style( 'bookzenix-font', BOOKZENIX_URL . 'assets/fonts/manrope/manrope.css', array(), BOOKZENIX_VERSION ); wp_enqueue_style( 'bookzenix-admin', $url . 'admin.css', array(), $ver ); wp_enqueue_script( 'bookzenix-admin', $url . 'admin.js', array( 'wp-i18n' ), $ver, true ); // JS strings are wrapped in wp.i18n.__() at build time – load the JSON translations for them. wp_set_script_translations( 'bookzenix-admin', 'bookzenix', BOOKZENIX_DIR . 'languages' ); wp_enqueue_media(); wp_add_inline_script( 'bookzenix-admin', 'window.BookzenixAdmin = ' . wp_json_encode( array( 'api' => esc_url_raw( rest_url( Rest::NS ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'version' => BOOKZENIX_VERSION, 'adminUrl' => admin_url( 'admin.php?page=' . self::SLUG ), 'user' => wp_get_current_user()->display_name, 'upgradeUrl'=> esc_url_raw( apply_filters( 'bookzenix_upgrade_url', 'https://bookzenix.com/pricing/' ) ), 'lite' => (bool) BOOKZENIX_LITE, 'accountUrl'=> 'https://bookzenix.com/account/', 'uploadUrl' => admin_url( 'plugin-install.php?tab=upload' ), ) ) . ';', 'before' ); // Add module type so Vite's ES build loads correctly. add_filter( 'script_loader_tag', function ( $tag, $handle ) { return 'bookzenix-admin' === $handle ? str_replace( '