Plugin Directory

Changeset 3377246


Ignore:
Timestamp:
10/13/2025 06:29:42 AM (3 weeks ago)
Author:
webtoffee
Message:

1.2.6 2025-10-13

*[Compatibility] - Tested OK with WooCommerce 10.2

Location:
wt-gift-cards-woocommerce
Files:
147 added
7 edited

Legend:

Unmodified
Added
Removed
  • wt-gift-cards-woocommerce/trunk/README.txt

    r3365744 r3377246  
    11=== WebToffee Gift Cards for WooCommerce ===
    22Contributors: WebToffee
    3 Version: 1.2.5
     3Version: 1.2.6
    44Donate link:https://www.webtoffee.com/product/woocommerce-gift-cards/
    55Tags: gift cards, woocommerce gift cards,  gift certificates, gift voucher, advanced gift cards
     
    77Tested up to: 6.8
    88Requires PHP: 5.6
    9 Stable tag: 1.2.5
     9Stable tag: 1.2.6
    1010License: GPLv3
    1111License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    197197== Changelog ==
    198198
     199= 1.2.6 2025-10-13 =
     200*[Compatibility] - Tested OK with WooCommerce 10.2
     201
    199202[See changelog for all versions](https://plugins.svn.wordpress.org/wt-gift-cards-woocommerce/trunk/changelog.txt)
    200203
     
    202205== Upgrade Notice ==
    203206
    204 = 1.2.5 =
    205 *[Tweak] - Performance optimization and bug fixes.
     207= 1.2.6 2025-10-13 =
     208*[Compatibility] - Tested OK with WooCommerce 10.2
  • wt-gift-cards-woocommerce/trunk/admin/class-wbte-woocommerce-gift-cards-free-admin.php

    r3365744 r3377246  
    184184        $gc_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
    185185
    186         if ( WBTE_GC_FREE_PLUGIN_NAME === $gc_page || apply_filters( 'wt_gc_include_admin_css_file', false ) ) {
     186        if ( (isset( $_GET['post_type'] ) && 'shop_coupon' === $_GET['post_type'] ) || WBTE_GC_FREE_PLUGIN_NAME === $gc_page || apply_filters( 'wt_gc_include_admin_css_file', false ) ) {
    187187            wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wt-woocommerce-gift-cards-free-admin.css', array( 'wc-admin-layout' ), $this->version, 'all' );
    188188            wp_enqueue_style( 'wp-color-picker' );
     
    199199        $gc_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
    200200
    201         if ( WBTE_GC_FREE_PLUGIN_NAME === $gc_page || apply_filters( 'wt_gc_include_admin_js_file', false ) ) {
     201        if ( ( isset($_GET['post_type']) && 'shop_coupon' === $_GET['post_type'] ) || WBTE_GC_FREE_PLUGIN_NAME === $gc_page || apply_filters( 'wt_gc_include_admin_js_file', false ) ) {
    202202
    203203            $params = array(
     
    569569        }
    570570    }
     571
     572    /**
     573     * Smart coupon banner for BFCM on coupons page
     574     *
     575     *  @since 1.2.6
     576     */
     577    public function bfcm_banner_coupon_page_settings_button()
     578    {
     579        global $current_screen;
     580        include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     581
     582        if( 'shop_coupon' !== $current_screen->post_type )
     583        {
     584            return;
     585        }
     586        ?>
     587        <script type="text/javascript">
     588            jQuery(document).ready(function($){             
     589                <?php 
     590                $hidden_banners = get_option( 'wbte_sc_hidden_promotion_banners', array() );
     591       
     592                if( !defined('WBTE_BFCM_SC_COUPONS_PAGE') && ! in_array( 'sc_cpns_page', $hidden_banners ) )
     593                {
     594                    define('WBTE_BFCM_SC_COUPONS_PAGE', true);
     595                    $campaign_url = 'https://www.webtoffee.com/product/smart-coupons-for-woocommerce/?utm_source=free_plugin_add_coupon_menu&utm_medium=gift_card_free&utm_campaign=smart_coupons';
     596
     597                    $bulk_plugin_text = sprintf(
     598                        '<div data-wbte-gc-promotion-banner-id="sc_cpns_page" class="wbte_gc_promotion_banner_div"><span><img src="%s" style="width: 16px;" /></span>&nbsp;<span class="wbte_gc_promotion_banner_title">%s</span><div class="wbte_gc_promotion_banner_content"><p style="margin: 0; font-size: 14px;"> %s </p><div class="wbte_gc_promotion_banner_actions"> <a class="button button-secondary wbte_gc_promotion_banner_link_btn" href="%s" target="_blank"> %s <span class="dashicons dashicons-arrow-right-alt" style="font-size: 14px; line-height: 1.5;"></span> </a>&ensp;<button type="button" class="button button-secondary wbte_gc_promotion_banner_close wbte_gc_promotion_banner_later"> %s </button></div></div><span class="dashicons dashicons-no-alt wbte_gc_promotion_banner_close wbte_gc_promotion_banner_close_btn"></span></div>',
     599                        esc_url( WBTE_GC_FREE_URL . 'admin/images/idea_bulb_purple.svg' ),
     600                        esc_html__( 'Did you know?', 'wt-gift-cards-woocommerce' ),
     601                        sprintf(
     602                            // Translators: 1. Opening <a> tag with link to Smart Coupons campaign page. 2. Closing </a> tag.
     603                            esc_html__(
     604                                'With the %1$s Smart Coupons %2$s plugin, you can create Buy One Get One offers and advanced coupons that boost sales during BFCM.',
     605                                'wt-gift-cards-woocommerce'
     606                            ),
     607                            '<a href="' . esc_url( $campaign_url ) . '" target="_blank"><b>',
     608                            '</b></a>'
     609                        ),
     610                        esc_url( $campaign_url ),
     611                        esc_html__( "Get Plugin Now", "wt-gift-cards-woocommerce" ),
     612                        esc_html__( "Maybe later", "wt-gift-cards-woocommerce" )
     613                    );
     614                ?>
     615                    jQuery( '.page-title-action' ).after( '<?php echo wp_kses_post( $bulk_plugin_text ); ?>' );
     616                <?php 
     617                }
     618                ?>
     619            });
     620        </script>
     621        <?php
     622    }
     623   
     624     /**
     625     *  Hide promotion banner
     626     *
     627     *  @since 1.2.6
     628     */
     629    public static function hide_bfcm_promotion_banner(){
     630
     631        check_ajax_referer( 'wt_gc_admin_nonce', '_wpnonce' );
     632
     633        if ( ! current_user_can( 'manage_woocommerce' ) ) {
     634            wp_send_json_error( esc_html__( 'Access denied', 'wt-gift-cards-woocommerce' ) );
     635        }
     636
     637        $hided_banners = get_option( 'wbte_sc_hidden_promotion_banners', array() );     
     638        $banner_id = isset( $_POST['banner_id'] ) ? sanitize_text_field( wp_unslash( $_POST['banner_id'] ) ) : '';
     639        if ( ! empty( $banner_id ) && ! in_array( $banner_id, $hided_banners ) ) {
     640            $hided_banners[] = $banner_id;
     641            update_option( 'wbte_sc_hidden_promotion_banners', $hided_banners );
     642        }
     643        update_option( 'wbte_sc_hidden_promotion_banners', $hided_banners );
     644        wp_send_json_success();
     645    }
     646
    571647}
  • wt-gift-cards-woocommerce/trunk/admin/css/wt-woocommerce-gift-cards-free-admin.css

    r3192268 r3377246  
    151151
    152152.wt-gc-tab-right-container .wt_gc_bfcm_offer { background: #FFFBD5; margin: 10px 10px 1px 10px;}
     153
     154/* BFCM CTA in coupon listing page  */
     155.wbte_gc_promotion_banner_div{ position: relative; padding: 20px 10px; background: #E3E3FF; border-left: solid 3px #5454A5; margin: 10px 0px; }
     156.wbte_gc_promotion_banner_title{ color: #5454A5; font-size: 16px; font-weight: 500; }
     157.wbte_gc_promotion_banner_close_btn{ position: absolute; right: 8px; top: 8px; color: #505050; cursor: pointer; }
     158
     159/* Hide CTA banners on coupon edit page if coupons are not created yet */
     160.wrap:has(.woocommerce-BlankState) .wbte_gc_promotion_banner_div, .wrap:has(.woocommerce-BlankState) #wbte_gc_gc_promo_banner, .wrap:has(.woocommerce-BlankState) .wt-gdpr-promotion-banner { display: none !important; }
     161.wbte_gc_promotion_banner_content{ display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
     162.wbte_gc_promotion_banner_later{ height: 30px; background: #E3E3FF !important; color: #5454A5 !important; border: 1px solid #5454A5 !important; }
     163.wbte_gc_promotion_banner_link_btn{ height: 30px; background: #5454A5 !important; color: #fff !important; border: none !important; display: flex !important; align-items: center; justify-content: space-between; }
     164.wbte_gc_promotion_banner_actions{ display: flex; align-items: center; margin-left: 10px; }
     165@media (max-width: 650px) {
     166  .wbte_gc_promotion_banner_content{ flex-direction: column; align-items: flex-start; }
     167  .wbte_gc_promotion_banner_actions{ width: 100%; margin-top: 10px; margin-left: 0px; }
     168}
  • wt-gift-cards-woocommerce/trunk/admin/js/wt-woocommerce-gift-cards-free-admin.js

    r3030434 r3377246  
    1616        }
    1717    );
     18
     19    /**
     20     * @since 1.2.6 To hide BFCM banner in coupon page
     21     */
     22    $( document ).ready(function(){
     23        $( document ).on('click', '.wbte_gc_promotion_banner_close', function( e ){
     24            e.preventDefault();
     25            const banner_div = $(this).closest('.wbte_gc_promotion_banner_div');
     26            const banner_id = banner_div.attr('data-wbte-gc-promotion-banner-id');
     27
     28            $('.wbte_gc_promotion_banner_div').block({
     29                message: null,
     30                overlayCSS: {
     31                    background: '#000',
     32                    opacity: 0.6
     33                }
     34            });
     35            if( banner_id ) {
     36                $.ajax({
     37                    url: wt_gc_params.ajax_url,
     38                    type: 'POST',
     39                    dataType:'json',
     40                    data:'banner_id=' + banner_id + '&action=wbte_gc_hide_promotion_banner&_wpnonce=' + wt_gc_params.nonce,
     41                    success: function(response) {
     42                        if ( response.success ) {
     43                            $('.wbte_gc_promotion_banner_div').unblock();
     44                            banner_div.hide();
     45                        } else {
     46                            wt_gc_notify_msg.error( response.data );
     47                        }
     48                    },
     49                    error: function() {
     50                        $('.wbte_gc_promotion_banner_div').unblock();
     51                        banner_div.hide();
     52                    }
     53                });
     54            } else {
     55                $('.wbte_gc_promotion_banner_div').unblock();
     56                banner_div.hide();
     57            }
     58        });
     59    });
    1860
    1961})( jQuery );
  • wt-gift-cards-woocommerce/trunk/changelog.txt

    r3365744 r3377246  
    11== Changelog ==
     2
     3= 1.2.6 2025-10-13 =
     4*[Compatibility] - Tested OK with WooCommerce 10.2
    25
    36= 1.2.5 2025-09-22 =
  • wt-gift-cards-woocommerce/trunk/includes/class-wbte-woocommerce-gift-cards-free.php

    r3365744 r3377246  
    7979            $this->version = WBTE_GC_FREE_VERSION;
    8080        } else {
    81             $this->version = '1.2.5';
     81            $this->version = '1.2.6';
    8282        }
    8383        $this->plugin_name = WBTE_GC_FREE_PLUGIN_NAME;
     
    286286
    287287        }
     288
     289        /**
     290        * BFCM banner for Smart coupons plugin
     291        *   
     292        * @since 1.2.6
     293        */
     294        $this->loader->add_action('admin_head-edit.php', $this->plugin_admin, 'bfcm_banner_coupon_page_settings_button');
     295
     296        /**
     297         *  Close BFCM promotion banner
     298         *
     299         *  @since 1.2.6
     300         */
     301        $this->loader->add_action( 'wp_ajax_wbte_gc_hide_promotion_banner', $this->plugin_admin, 'hide_bfcm_promotion_banner' );
     302
     303
    288304    }
    289305
  • wt-gift-cards-woocommerce/trunk/wt-gift-cards-woocommerce.php

    r3365744 r3377246  
    99 * Plugin URI:        https://wordpress.org/plugins/wt-gift-cards-woocommerce/
    1010 * Description:       Create and manage beautiful gift cards for your WooCommerce store.
    11  * Version:           1.2.5
     11 * Version:           1.2.6
    1212 * Author:            WebToffee
    1313 * Author URI:        https://www.webtoffee.com/
     
    3535 * Start at version 1.0.0 and use SemVer - https://semver.org
    3636 */
    37 define( 'WBTE_GC_FREE_VERSION', '1.2.5' );
     37define( 'WBTE_GC_FREE_VERSION', '1.2.6' );
    3838
    3939define( 'WBTE_GC_FREE_FILE_NAME', __FILE__ );
Note: See TracChangeset for help on using the changeset viewer.