id ) { return; } wp_enqueue_script( 'wcs-gifting-welcome-announcement', plugins_url( '/build/gifting-welcome-announcement.js', WC_Subscriptions::$plugin_file ), array( 'wp-components', 'wp-i18n' ), WC_Subscriptions::$version, true ); wp_localize_script( 'wcs-gifting-welcome-announcement', 'wcsGiftingSettings', array( 'imagesPath' => plugins_url( '/assets/images', WC_Subscriptions::$plugin_file ), 'pluginsUrl' => admin_url( 'plugins.php' ), 'subscriptionsUrl' => WC_Subscriptions_Admin::settings_tab_url() . '#woocommerce_subscriptions_gifting_enable_gifting', 'isStandaloneGiftingEnabled' => is_plugin_active( 'woocommerce-subscriptions-gifting/woocommerce-subscriptions-gifting.php' ), ) ); wp_enqueue_style( 'wcs-gifting-welcome-announcement', plugins_url( '/build/style-gifting-welcome-announcement.css', WC_Subscriptions::$plugin_file ), array(), WC_Subscriptions::$version ); wp_set_script_translations( 'wcs-gifting-welcome-announcement', 'woocommerce-subscriptions', plugin_dir_path( WC_Subscriptions::$plugin_file ) . 'languages' ); } /** * Output the tour HTML in the admin footer */ public static function output_tour() { $screen = get_current_screen(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $dashboard_path = isset( $_GET['path'] ) ? wc_clean( wp_unslash( $_GET['path'] ) ) : ''; // Only load on WooCommerce admin pages if ( ! $screen || 'woocommerce_page_wc-admin' !== $screen->id || '/setup-wizard' === $dashboard_path ) { return; } // Add a div for the tour to be rendered into echo '
'; } /** * Checks if the welcome tour has been dismissed. * * @return bool */ public static function is_welcome_announcement_dismissed() { return '1' === get_option( 'woocommerce_subscriptions_gifting_is_welcome_announcement_dismissed', '' ); } }