Plugin Directory

Changeset 3728143


Ignore:
Timestamp:
10/05/2026 05:52:42 AM (2 weeks ago)
Author:
habibnoori
Message:

MarketTier Pricing for WooCommerce 1.0.2: country selection consistency, copy shortcode fallback, style admin tab, and selector label cleanup.

Location:
markettier-pricing-for-woocommerce
Files:
2 added
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • markettier-pricing-for-woocommerce/tags/1.0.2/CHANGELOG.md

    r3724584 r3728143  
    44
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     6
     7## [1.0.2] - 2026-10-05
     8
     9### Fixed
     10- **Site-Wide Country Selection Consistency**:
     11  - Ensured consistent browsing country resolution across Home, Shop, category, and single product pages.
     12  - Verified priority order so explicit visitor choice persists deterministically across pages.
     13  - Retained strict checkout authority without regressions to WooCommerce native tax and shipping.
     14- **Copy Shortcode Button**:
     15  - Added robust fallback to `document.execCommand('copy')` with hidden textarea when modern asynchronous Clipboard API is unavailable (e.g. non-HTTPS/local environments or older browsers).
     16- **Frontend Country Selector Label**:
     17  - Removed visible "Country" text from `[markprfo_country_selector]` output for clean, minimal layout presentation while preserving accessible attributes (`aria-label`).
     18
     19### Added
     20- **Style Admin Settings Tab**:
     21  - Added dedicated "Style" tab under WooCommerce > MarketTier Pricing.
     22  - Provided Custom CSS editor field with secure CSS sanitization (`wp_strip_all_tags`).
     23  - Added CSS selectors reference guide for theme styling and selector overrides (`.markprfo-country-selector`, `.markprfo-country-select`, `.markprfo-country-selector-spinner`, `.markprfo-country-selector-label`).
    624
    725## [1.0.1] - 2026-10-02
  • markettier-pricing-for-woocommerce/tags/1.0.2/admin/class-settings.php

    r3724584 r3728143  
    2929                        'general'     => __( 'General', 'markettier-pricing-for-woocommerce' ),
    3030                        'currency'    => __( 'Currency & Rates', 'markettier-pricing-for-woocommerce' ),
     31                        'style'       => __( 'Style', 'markettier-pricing-for-woocommerce' ),
    3132                        'diagnostics' => __( 'Diagnostics', 'markettier-pricing-for-woocommerce' ),
    3233                        'howto'       => __( 'How to Use', 'markettier-pricing-for-woocommerce' ),
    … …  
    6061                } elseif ( 'save_currency' === $action ) {
    6162                        self::save_currency();
     63                } elseif ( 'save_style' === $action ) {
     64                        self::save_style();
    6265                }
    6366        }
    … …  
    280283                exit;
    281284        }
     285
     286        /**
     287         * Save custom CSS style settings.
     288         */
     289        protected static function save_style() {
     290                $custom_css = isset( $_POST['markprfo_custom_css'] ) ? wp_unslash( $_POST['markprfo_custom_css'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     291
     292                // Sanitize CSS: strip HTML tags and scripts, preserving valid CSS characters and selectors.
     293                $sanitized_css = wp_strip_all_tags( $custom_css );
     294
     295                update_option( 'markprfo_custom_css', $sanitized_css );
     296
     297                wp_safe_redirect( add_query_arg( array( 'page' => 'markprfo_settings', 'tab' => 'style', 'message' => 'style_saved' ), admin_url( 'admin.php' ) ) );
     298                exit;
     299        }
    282300}
  • markettier-pricing-for-woocommerce/tags/1.0.2/admin/views/settings-page.php

    r3724584 r3728143  
    99        <h1><?php esc_html_e( 'MarketTier Pricing for WooCommerce', 'markettier-pricing-for-woocommerce' ); ?></h1>
    1010
    11         <?php if ( 'saved' === $message || 'market_saved' === $message || 'currency_saved' === $message ) : ?>
     11        <?php if ( 'saved' === $message || 'market_saved' === $message || 'currency_saved' === $message || 'style_saved' === $message ) : ?>
    1212                <div class="notice notice-success is-dismissible">
    1313                        <p><?php esc_html_e( 'Settings updated successfully.', 'markettier-pricing-for-woocommerce' ); ?></p>
    … …  
    3636                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-currency.php';
    3737                                break;
     38                        case 'style':
     39                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-style.php';
     40                                break;
    3841                        case 'diagnostics':
    3942                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-diagnostics.php';
  • markettier-pricing-for-woocommerce/tags/1.0.2/assets/js/admin.js

    r3724584 r3728143  
    238238                $( document ).on( 'click', '.markprfo-howto-copy-btn', function ( e ) {
    239239                        e.preventDefault();
    240                         var $btn      = $( this );
    241                         var targetId  = $btn.data( 'copy-target' );
    242                         var text      = $( '#' + targetId ).text();
     240                        var $btn     = $( this );
     241                        var targetId = $btn.data( 'copy-target' );
     242                        var text     = $( '#' + targetId ).text().trim();
     243
     244                        if ( ! text ) {
     245                                return;
     246                        }
     247
     248                        function showSuccess() {
     249                                var origText = $btn.text();
     250                                $btn.text( 'Copied!' ).prop( 'disabled', true );
     251                                setTimeout( function () {
     252                                        $btn.text( origText ).prop( 'disabled', false );
     253                                }, 2000 );
     254                        }
    243255
    244256                        if ( navigator.clipboard && navigator.clipboard.writeText ) {
    245257                                navigator.clipboard.writeText( text ).then( function () {
    246                                         var origText = $btn.text();
    247                                         $btn.text( 'Copied!' ).prop( 'disabled', true );
    248                                         setTimeout( function () {
    249                                                 $btn.text( origText ).prop( 'disabled', false );
    250                                         }, 2000 );
     258                                        showSuccess();
     259                                } ).catch( function () {
     260                                        fallbackCopy( text, showSuccess );
    251261                                } );
    252                         }
    253                 } );
     262                        } else {
     263                                fallbackCopy( text, showSuccess );
     264                        }
     265                } );
     266        }
     267
     268        function fallbackCopy( text, callback ) {
     269                var $temp = $( '<textarea>' );
     270                $( 'body' ).append( $temp );
     271                $temp.val( text ).select();
     272                try {
     273                        var successful = document.execCommand( 'copy' );
     274                        if ( successful && typeof callback === 'function' ) {
     275                                callback();
     276                        }
     277                } catch ( err ) {
     278                        // Fail silently or handle error if needed.
     279                }
     280                $temp.remove();
    254281        }
    255282
  • markettier-pricing-for-woocommerce/tags/1.0.2/market-tier-pricing.php

    r3724584 r3728143  
    33 * Plugin Name: MarketTier Pricing for WooCommerce
    44 * Description: Set country and regional prices for WooCommerce products with market-based pricing, currencies, checkout rules, and variations.
    5  * Version: 1.0.1
     5 * Version: 1.0.2
    66 * Author: habibnoori
    77 * Author URI: https://habib.wpminner.com/
    … …  
    2525// Plugin version constant.
    2626if ( ! defined( 'MARKPRFO_VERSION' ) ) {
    27         define( 'MARKPRFO_VERSION', '1.0.1' );
     27        define( 'MARKPRFO_VERSION', '1.0.2' );
    2828}
    2929
  • markettier-pricing-for-woocommerce/tags/1.0.2/public/class-country-selector.php

    r3724584 r3728143  
    4747                $atts = shortcode_atts(
    4848                        array(
    49                                 'label' => __( 'Country', 'markettier-pricing-for-woocommerce' ),
     49                                'label' => '',
    5050                                'class' => '',
    5151                        ),
    … …  
    142142                );
    143143
     144                $custom_css = get_option( 'markprfo_custom_css', '' );
     145                if ( ! empty( $custom_css ) && is_string( $custom_css ) ) {
     146                        wp_add_inline_style( 'markprfo-country-selector-css', $custom_css );
     147                }
     148
    144149                wp_enqueue_script(
    145150                        'markprfo-country-selector-js',
  • markettier-pricing-for-woocommerce/tags/1.0.2/readme.txt

    r3724584 r3728143  
    44Requires at least: 6.4
    55Tested up to: 7.1
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
    … …  
    164164== Changelog ==
    165165
     166= 1.0.2 =
     167* Fixed site-wide country selection consistency and switching across Home, Shop, and category pages.
     168* Fixed the Copy Shortcode button in the admin How to Use guide with clipboard and legacy execCommand fallback.
     169* Added Style admin tab with Custom CSS textarea and full selector reference guide.
     170* Removed visible "Country" label text from the frontend country selector dropdown while preserving accessible markup.
     171
    166172= 1.0.1 =
    167173* Added a persistent country selector shortcode for market-based storefront pricing.
  • markettier-pricing-for-woocommerce/trunk/CHANGELOG.md

    r3724584 r3728143  
    44
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     6
     7## [1.0.2] - 2026-10-05
     8
     9### Fixed
     10- **Site-Wide Country Selection Consistency**:
     11  - Ensured consistent browsing country resolution across Home, Shop, category, and single product pages.
     12  - Verified priority order so explicit visitor choice persists deterministically across pages.
     13  - Retained strict checkout authority without regressions to WooCommerce native tax and shipping.
     14- **Copy Shortcode Button**:
     15  - Added robust fallback to `document.execCommand('copy')` with hidden textarea when modern asynchronous Clipboard API is unavailable (e.g. non-HTTPS/local environments or older browsers).
     16- **Frontend Country Selector Label**:
     17  - Removed visible "Country" text from `[markprfo_country_selector]` output for clean, minimal layout presentation while preserving accessible attributes (`aria-label`).
     18
     19### Added
     20- **Style Admin Settings Tab**:
     21  - Added dedicated "Style" tab under WooCommerce > MarketTier Pricing.
     22  - Provided Custom CSS editor field with secure CSS sanitization (`wp_strip_all_tags`).
     23  - Added CSS selectors reference guide for theme styling and selector overrides (`.markprfo-country-selector`, `.markprfo-country-select`, `.markprfo-country-selector-spinner`, `.markprfo-country-selector-label`).
    624
    725## [1.0.1] - 2026-10-02
  • markettier-pricing-for-woocommerce/trunk/admin/class-settings.php

    r3724584 r3728143  
    2929                        'general'     => __( 'General', 'markettier-pricing-for-woocommerce' ),
    3030                        'currency'    => __( 'Currency & Rates', 'markettier-pricing-for-woocommerce' ),
     31                        'style'       => __( 'Style', 'markettier-pricing-for-woocommerce' ),
    3132                        'diagnostics' => __( 'Diagnostics', 'markettier-pricing-for-woocommerce' ),
    3233                        'howto'       => __( 'How to Use', 'markettier-pricing-for-woocommerce' ),
    … …  
    6061                } elseif ( 'save_currency' === $action ) {
    6162                        self::save_currency();
     63                } elseif ( 'save_style' === $action ) {
     64                        self::save_style();
    6265                }
    6366        }
    … …  
    280283                exit;
    281284        }
     285
     286        /**
     287         * Save custom CSS style settings.
     288         */
     289        protected static function save_style() {
     290                $custom_css = isset( $_POST['markprfo_custom_css'] ) ? wp_unslash( $_POST['markprfo_custom_css'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     291
     292                // Sanitize CSS: strip HTML tags and scripts, preserving valid CSS characters and selectors.
     293                $sanitized_css = wp_strip_all_tags( $custom_css );
     294
     295                update_option( 'markprfo_custom_css', $sanitized_css );
     296
     297                wp_safe_redirect( add_query_arg( array( 'page' => 'markprfo_settings', 'tab' => 'style', 'message' => 'style_saved' ), admin_url( 'admin.php' ) ) );
     298                exit;
     299        }
    282300}
  • markettier-pricing-for-woocommerce/trunk/admin/views/settings-page.php

    r3724584 r3728143  
    99        <h1><?php esc_html_e( 'MarketTier Pricing for WooCommerce', 'markettier-pricing-for-woocommerce' ); ?></h1>
    1010
    11         <?php if ( 'saved' === $message || 'market_saved' === $message || 'currency_saved' === $message ) : ?>
     11        <?php if ( 'saved' === $message || 'market_saved' === $message || 'currency_saved' === $message || 'style_saved' === $message ) : ?>
    1212                <div class="notice notice-success is-dismissible">
    1313                        <p><?php esc_html_e( 'Settings updated successfully.', 'markettier-pricing-for-woocommerce' ); ?></p>
    … …  
    3636                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-currency.php';
    3737                                break;
     38                        case 'style':
     39                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-style.php';
     40                                break;
    3841                        case 'diagnostics':
    3942                                include MARKPRFO_PLUGIN_DIR . 'admin/views/tab-diagnostics.php';
  • markettier-pricing-for-woocommerce/trunk/assets/js/admin.js

    r3724584 r3728143  
    238238                $( document ).on( 'click', '.markprfo-howto-copy-btn', function ( e ) {
    239239                        e.preventDefault();
    240                         var $btn      = $( this );
    241                         var targetId  = $btn.data( 'copy-target' );
    242                         var text      = $( '#' + targetId ).text();
     240                        var $btn     = $( this );
     241                        var targetId = $btn.data( 'copy-target' );
     242                        var text     = $( '#' + targetId ).text().trim();
     243
     244                        if ( ! text ) {
     245                                return;
     246                        }
     247
     248                        function showSuccess() {
     249                                var origText = $btn.text();
     250                                $btn.text( 'Copied!' ).prop( 'disabled', true );
     251                                setTimeout( function () {
     252                                        $btn.text( origText ).prop( 'disabled', false );
     253                                }, 2000 );
     254                        }
    243255
    244256                        if ( navigator.clipboard && navigator.clipboard.writeText ) {
    245257                                navigator.clipboard.writeText( text ).then( function () {
    246                                         var origText = $btn.text();
    247                                         $btn.text( 'Copied!' ).prop( 'disabled', true );
    248                                         setTimeout( function () {
    249                                                 $btn.text( origText ).prop( 'disabled', false );
    250                                         }, 2000 );
     258                                        showSuccess();
     259                                } ).catch( function () {
     260                                        fallbackCopy( text, showSuccess );
    251261                                } );
    252                         }
    253                 } );
     262                        } else {
     263                                fallbackCopy( text, showSuccess );
     264                        }
     265                } );
     266        }
     267
     268        function fallbackCopy( text, callback ) {
     269                var $temp = $( '<textarea>' );
     270                $( 'body' ).append( $temp );
     271                $temp.val( text ).select();
     272                try {
     273                        var successful = document.execCommand( 'copy' );
     274                        if ( successful && typeof callback === 'function' ) {
     275                                callback();
     276                        }
     277                } catch ( err ) {
     278                        // Fail silently or handle error if needed.
     279                }
     280                $temp.remove();
    254281        }
    255282
  • markettier-pricing-for-woocommerce/trunk/market-tier-pricing.php

    r3724584 r3728143  
    33 * Plugin Name: MarketTier Pricing for WooCommerce
    44 * Description: Set country and regional prices for WooCommerce products with market-based pricing, currencies, checkout rules, and variations.
    5  * Version: 1.0.1
     5 * Version: 1.0.2
    66 * Author: habibnoori
    77 * Author URI: https://habib.wpminner.com/
    … …  
    2525// Plugin version constant.
    2626if ( ! defined( 'MARKPRFO_VERSION' ) ) {
    27         define( 'MARKPRFO_VERSION', '1.0.1' );
     27        define( 'MARKPRFO_VERSION', '1.0.2' );
    2828}
    2929
  • markettier-pricing-for-woocommerce/trunk/public/class-country-selector.php

    r3724584 r3728143  
    4747                $atts = shortcode_atts(
    4848                        array(
    49                                 'label' => __( 'Country', 'markettier-pricing-for-woocommerce' ),
     49                                'label' => '',
    5050                                'class' => '',
    5151                        ),
    … …  
    142142                );
    143143
     144                $custom_css = get_option( 'markprfo_custom_css', '' );
     145                if ( ! empty( $custom_css ) && is_string( $custom_css ) ) {
     146                        wp_add_inline_style( 'markprfo-country-selector-css', $custom_css );
     147                }
     148
    144149                wp_enqueue_script(
    145150                        'markprfo-country-selector-js',
  • markettier-pricing-for-woocommerce/trunk/readme.txt

    r3724584 r3728143  
    44Requires at least: 6.4
    55Tested up to: 7.1
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
    … …  
    164164== Changelog ==
    165165
     166= 1.0.2 =
     167* Fixed site-wide country selection consistency and switching across Home, Shop, and category pages.
     168* Fixed the Copy Shortcode button in the admin How to Use guide with clipboard and legacy execCommand fallback.
     169* Added Style admin tab with Custom CSS textarea and full selector reference guide.
     170* Removed visible "Country" label text from the frontend country selector dropdown while preserving accessible markup.
     171
    166172= 1.0.1 =
    167173* Added a persistent country selector shortcode for market-based storefront pricing.
Note: See TracChangeset for help on using the changeset viewer.