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' ), 'isSubscriptionsListing' => 'woocommerce_page_wc-orders--shop_subscription' === $screen->id, ) ); } /** * Output the tour HTML in the admin footer */ public static function output_tour() { if ( ! self::is_woocommerce_admin_or_subscriptions_listing() ) { 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', '' ); } /** * Checks if the current screen is WooCommerce Admin or subscriptions listing. * * @return bool */ private static function is_woocommerce_admin_or_subscriptions_listing() { $screen = get_current_screen(); if ( ! $screen ) { return false; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended $action_param = isset( $_GET['action'] ) ? wc_clean( wp_unslash( $_GET['action'] ) ) : ''; $is_woocommerce_admin = 'woocommerce_page_wc-admin' === $screen->id; $is_subscriptions_listing = 'woocommerce_page_wc-orders--shop_subscription' === $screen->id && empty( $action_param ); return $is_woocommerce_admin || $is_subscriptions_listing; } }