banner_state = get_option( self::$banner_state_option_name ); // Current state of the banner. $this->banner_state = absint( false === $this->banner_state ? 1 : $this->banner_state ); // Enqueue styles. add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ) ); // Add banner. add_action('admin_notices', array($this, 'show_banner'), 999); // Ajax hook to save banner state. add_action( 'wp_ajax_' . self::$ajax_action_name, array( $this, 'update_banner_state' ) ); add_action( 'admin_head-edit.php', array($this, 'show_smart_coupon_BFCM_sbanner') ); // Ajax hook to hide Smart Coupons promotion banner. add_action( 'wp_ajax_wbte_sc_hide_promotion_banner', array( $this, 'hide_smart_coupon_promotion_banner' ) ); } /** * To add the banner styles */ public function enqueue_styles_and_scripts() { wp_enqueue_style( $this->banner_id . '-css', plugin_dir_url( __FILE__ ) . 'assets/css/wt-bfcm-twenty-twenty-five.css', array(), self::$banner_version, 'all' ); $params = array( 'ajax_url' => esc_url_raw( admin_url( 'admin-ajax.php' ) ), 'nonce' => wp_create_nonce( 'wt_bfcm_twenty_twenty_five_banner_nonce' ), 'action' => self::$ajax_action_name, 'cta_link' => self::$promotion_link, ); wp_enqueue_script( $this->banner_id . '-js', plugin_dir_url( __FILE__ ) . 'assets/js/wt-bfcm-twenty-twenty-five.js', array( 'jquery' ), self::$banner_version, false ); wp_localize_script( $this->banner_id . '-js', 'wt_bfcm_twenty_twenty_five_banner_js_params', $params ); } public function show_smart_coupon_BFCM_sbanner() { global $current_screen; include_once ABSPATH . 'wp-admin/includes/plugin.php'; $installed_plugins = get_plugins(); // Only show banner if SC Pro is not installed and current page is coupons page. if ( ! is_object( $current_screen ) || 'shop_coupon' !== $current_screen->post_type || array_key_exists( 'wt-smart-coupon-pro/wt-smart-coupon-pro.php', $installed_plugins ) ) { return; } ?> is_show_banner() ) { ?>
<?php esc_attr_e( 'Black Friday Cyber Monday 2025', 'users-customers-import-export-for-wp-woocommerce' ); ?>

30% OFF. esc_html__( 'Your Last Chance to Avail %1$s on WebToffee Plugins. Grab the deal before it`s gone!', 'users-customers-import-export-for-wp-woocommerce' ), '30% ' . esc_html__( 'OFF', 'users-customers-import-export-for-wp-woocommerce' ) . '' ); ?>

banner_state ) { self::$show_banner = false; return self::$show_banner; } // Check screens. $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; /** * Pages to show this black friday and cyber monday banner for 2025. * * @since 1.1.0 * @param string[] Default screen ids */ $screens_to_show = (array) apply_filters( 'wt_bfcm_banner_screens', array() ); self::$show_banner = in_array( $screen_id, $screens_to_show, true ); return self::$show_banner; } /** * Update banner state ajax hook */ public function update_banner_state() { check_ajax_referer( 'wt_bfcm_twenty_twenty_five_banner_nonce' ); if ( isset( $_POST['wt_bfcm_twenty_twenty_five_banner_action_type'] ) ) { $action_type = absint( sanitize_text_field( wp_unslash( $_POST['wt_bfcm_twenty_twenty_five_banner_action_type'] ) ) ); if ( in_array( $action_type, array( 2, 3 ), true ) ) { update_option( self::$banner_state_option_name, $action_type ); } } wp_send_json_success(); } /** * Hide Smart Coupons promotion banner * * @since 2.6.7 */ public function hide_smart_coupon_promotion_banner() { check_ajax_referer( 'wt_bfcm_twenty_twenty_five_banner_nonce', '_wpnonce' ); $hided_banners = get_option( 'wbte_sc_hidden_promotion_banners', array() ); $hided_banners[] = isset( $_POST['banner_id'] ) ? sanitize_text_field( wp_unslash( $_POST['banner_id'] ) ) : ''; update_option( 'wbte_sc_hidden_promotion_banners', $hided_banners ); wp_send_json_success(); } } new Wt_Bfcm_Twenty_Twenty_Five(); }