get_screen_ids(), true ) ) { return; } // Register styles wp_register_style( 'aistpr-admin', AISTPR_ASSETS_URL . 'css/admin/dashboard.css', array(), AISTPR_VERSION ); // Register scripts wp_register_script( 'aistpr-admin', AISTPR_ASSETS_URL . 'js/admin/dashboard.js', array( 'jquery' ), AISTPR_VERSION, true ); // Localize script wp_localize_script( 'aistpr-admin', 'aistprDashboard', array( 'adminUrl' => admin_url( 'admin.php' ), 'nonce' => wp_create_nonce( 'aistpr_dashboard' ), 'i18n' => array( 'confirmRefresh' => __( 'Are you sure you want to refresh all predictions? This may take a while.', 'ai-stock-predictor' ), 'loading' => __( 'Loading...', 'ai-stock-predictor' ), ), ) ); // Enqueue assets wp_enqueue_style( 'aistpr-admin' ); wp_enqueue_script( 'aistpr-admin' ); } /** * Add screen IDs to WooCommerce. * * @since 1.0.0 * @param array $screen_ids Screen IDs. * @return array */ public function add_screen_ids( $screen_ids ) { return array_merge( $screen_ids, $this->get_screen_ids() ); } /** * Get screen IDs. * * @since 1.0.0 * @return array */ private function get_screen_ids() { $screen_ids = array( 'woocommerce_page_ai-stock-predictor', 'product', ); return apply_filters( 'aistpr_screen_ids', $screen_ids ); } }