Plugin Directory

Changeset 3327071


Ignore:
Timestamp:
07/13/2025 04:10:09 PM (9 months ago)
Author:
rafacarvalhido
Message:

2.1.6 - 2025-07-13

  • Update - Changed readme.txt as per Wordpress.org rules
  • Update - Changed the name of 2 functions adding the prefix rccwoo_
  • Update - Removed load_text_domain function
  • Update - Activated compatibility with Woo's High-Performance Order Storage (HPOS)
  • Fix - Escaped some echoed terms on Admin Options
  • Fix - Added a nonce to the button action
  • Fix - Removed closing tags in 2 files
Location:
racar-clear-cart-for-woocommerce
Files:
31 added
7 edited

Legend:

Unmodified
Added
Removed
  • racar-clear-cart-for-woocommerce/trunk/includes/admin/class-rccwoo_Action_List.php

    r2887889 r3327071  
    5252    }
    5353}
    54 function start_action_links() {
     54function rccwoo_start_action_links() {
    5555    $action_links = new rccwoo_Action_List();
    5656}
    57 start_action_links();
     57rccwoo_start_action_links();
  • racar-clear-cart-for-woocommerce/trunk/includes/admin/class-rccwoo_Admin_Options.php

    r3325229 r3327071  
    289289                // if( isset( $input['rccwoo_background'] ) ) {
    290290                //  $background = trim( $input['rccwoo_background'] );
    291                 //  $background = strip_tags( stripslashes( $background ) );
     291                //  $background = wp_strip_all_tags( stripslashes( $background ) );
    292292                //  if( FALSE === $this->check_color( $background ) ) {
    293293                //      // Set the error message
     
    301301                if( isset( $input['rccwoo_background'] ) AND ! empty( $input['rccwoo_background'] ) ) {
    302302                    $background = trim( $input['rccwoo_background'] );
    303                     $background = strip_tags( stripslashes( $background ) );
     303                    $background = wp_strip_all_tags( stripslashes( $background ) );
    304304                    $bg_color = '';
    305305                    if( '#' != $background[0]) {
     
    311311                if( isset( $input['rccwoo_background_hover_color'] ) AND ! empty( $input['rccwoo_background_hover_color'] ) ) {
    312312                    $background = trim( $input['rccwoo_background_hover_color'] );
    313                     $background = strip_tags( stripslashes( $background ) );
     313                    $background = wp_strip_all_tags( stripslashes( $background ) );
    314314                    $bg_color = '';
    315315                    if( '#' != $background[0]) {
     
    321321                if( isset( $input['rccwoo_text_color'] ) AND ! empty( $input['rccwoo_text_color'] ) ) {
    322322                    $textcolor = trim( $input['rccwoo_text_color'] );
    323                     $textcolor = strip_tags( stripslashes( $textcolor ) );
     323                    $textcolor = wp_strip_all_tags( stripslashes( $textcolor ) );
    324324                    $txt_color = '';
    325325                    if( '#' != $textcolor[0]) {
     
    331331                if( isset( $input['rccwoo_hover_text_color'] ) AND ! empty( $input['rccwoo_hover_text_color'] ) ) {
    332332                    $textcolor = trim( $input['rccwoo_hover_text_color'] );
    333                     $textcolor = strip_tags( stripslashes( $textcolor ) );
     333                    $textcolor = wp_strip_all_tags( stripslashes( $textcolor ) );
    334334                    $txt_color = '';
    335335                    if( '#' != $textcolor[0]) {
     
    358358         */
    359359        public function plugin_settings_section_callback() {
    360             echo __( 'Enter your preferences below:', 'racar-clear-cart-for-woocommerce' );
     360            echo esc_html__( 'Enter your preferences below:', 'racar-clear-cart-for-woocommerce' );
    361361        }
    362362
     
    371371                '<input type="text" id="button-text" name="rccwoo_settings[rccwoo_button_text]" value="%s" placeholder="%s" />',
    372372                isset( $this->options['rccwoo_button_text'] ) ? esc_attr( $this->options['rccwoo_button_text']) : '' ,
    373                 __('Clear Cart','racar-clear-cart-for-woocommerce')
     373                esc_html__( 'Clear Cart','racar-clear-cart-for-woocommerce' )
    374374            );
    375375        }
     
    379379                '<input type="text" id="confirm-text" name="rccwoo_settings[rccwoo_confirm_text]" value="%s" placeholder="%s" />',
    380380                isset( $this->options['rccwoo_confirm_text'] ) ? esc_attr( $this->options['rccwoo_confirm_text']) : '' ,
    381                 __('Are you sure you wish to clear your shopping cart?','racar-clear-cart-for-woocommerce')
     381                esc_html__( 'Are you sure you wish to clear your shopping cart?','racar-clear-cart-for-woocommerce' )
    382382            );
    383383        }
     
    466466                '<input type="text" id="button-css-classes" name="rccwoo_settings[rccwoo_redirection_url]" value="%s" placeholder="%s"/>',
    467467                isset( $this->options['rccwoo_redirection_url'] ) ? esc_attr( $this->options['rccwoo_redirection_url']) : '',
    468                 __( 'https://mysite.com/shop' , 'racar-clear-cart-for-woocommerce' )
    469             );
    470             echo '<div>'. __('Leave blank to keep customer in cart page after cart deletion' , 'racar-clear-cart-for-woocommerce' ) . '</div>';
     468                esc_html__( 'https://mysite.com/shop' , 'racar-clear-cart-for-woocommerce' )
     469            );
     470            echo '<div>'. esc_html__('Leave blank to keep customer in cart page after cart deletion' , 'racar-clear-cart-for-woocommerce' ) . '</div>';
    471471        }
    472472
  • racar-clear-cart-for-woocommerce/trunk/includes/class-rccwoo-plugin.php

    r2891545 r3327071  
    142142         */
    143143        public static function woocommerce_clear_cart_url() {
     144            if( ! isset( $_REQUEST['clear-cart'] ) ) {
     145                return;
     146            }
     147
     148            $nonce_field_name = '_wpnonce_racar_clear_cart'; // Nome do campo oculto do nonce
     149            $nonce_action_name = 'racar_clear_cart_nonce';    // Nome da ação do nonce
     150
     151            if( ! isset( $_REQUEST[ $nonce_field_name ] ) OR ! wp_verify_nonce( sanitize_key( $_REQUEST[ $nonce_field_name ] ), $nonce_action_name ) ) {
     152                wp_die( 'Invalid Request', 'Security Fail', array( 'response' => 403 ) );
     153            }
     154
    144155            global $woocommerce;
    145156            $options = get_option( 'rccwoo_settings' );
    146             if( isset( $_REQUEST['clear-cart'] ) ) {
    147                 $woocommerce->cart->empty_cart();
    148                 if( isset( $options['rccwoo_redirection_url'] ) ) {
    149                     wp_redirect( $options['rccwoo_redirection_url'] , 302 , 'Shop Clear Cart' );
    150                 }
     157            $woocommerce->cart->empty_cart();
     158            if( isset( $options['rccwoo_redirection_url'] ) AND ! empty( $options['rccwoo_redirection_url'] ) ) {
     159                wp_safe_redirect( $options['rccwoo_redirection_url'] , 302 , 'Shop Clear Cart' );
     160                exit;
    151161            }
    152162        }
  • racar-clear-cart-for-woocommerce/trunk/includes/rccwoo-functions.php

    r2887889 r3327071  
    1515    if( ! function_exists('rccwoo_script_file') ) {
    1616        function rccwoo_script_file() {
     17            global $rccwoo_VERSION;
    1718            global $rccwoo_NOME_JAVASCRIPT;
    1819            global $rccwoo_DIR_JAVASCRIPT;
    1920            global $rccwoo_EXT_JAVASCRIPT;
    20             wp_register_script( $rccwoo_NOME_JAVASCRIPT, plugins_url( $rccwoo_DIR_JAVASCRIPT.$rccwoo_NOME_JAVASCRIPT.$rccwoo_EXT_JAVASCRIPT, __FILE__ ) );
     21            wp_register_script( $rccwoo_NOME_JAVASCRIPT, plugins_url( $rccwoo_DIR_JAVASCRIPT.$rccwoo_NOME_JAVASCRIPT.$rccwoo_EXT_JAVASCRIPT, __FILE__ ), array(), $rccwoo_VERSION, true );
    2122            wp_enqueue_script( $rccwoo_NOME_JAVASCRIPT );
    2223        }
     
    2526    if( ! function_exists('rccwoo_style_file') ) {
    2627        function rccwoo_style_file() {
     28            global $rccwoo_VERSION;
    2729            global $rccwoo_NOME_STYLESHEET;
    2830            global $rccwoo_DIR_STYLESHEET;
    2931            global $rccwoo_EXT_STYLESHEET;
    3032            // Respects SSL, Style.css is relative to the current file
    31             wp_register_style( $rccwoo_NOME_STYLESHEET, plugins_url( $rccwoo_DIR_STYLESHEET.$rccwoo_NOME_STYLESHEET.$rccwoo_EXT_STYLESHEET, __FILE__ ) );
     33            wp_register_style( $rccwoo_NOME_STYLESHEET, plugins_url( $rccwoo_DIR_STYLESHEET.$rccwoo_NOME_STYLESHEET.$rccwoo_EXT_STYLESHEET, __FILE__ ), array(), $rccwoo_VERSION, 'all' );
    3234            wp_enqueue_style( $rccwoo_NOME_STYLESHEET );
    3335        }
     
    6971     *
    7072     * @since 1.0.0
     73     * @removed 2.1.6
    7174     */
    72     function rccwoo_load_textdomain() {
    73         global $rccwoo_basename;
    74         $textdomain_loaded = load_plugin_textdomain( 'racar-clear-cart-for-woocommerce', false, basename( dirname( __DIR__ ) ) . '/languages' );
    75     }
    76    
    77    
    78    
    79    
    80 ?>
     75    // function rccwoo_load_textdomain() {
     76    //  global $rccwoo_basename;
     77    //  $textdomain_loaded = load_plugin_textdomain( 'racar-clear-cart-for-woocommerce', false, basename( dirname( __DIR__ ) ) . '/languages' );
     78    // }
  • racar-clear-cart-for-woocommerce/trunk/includes/views/class-racar-clear-cart-button.php

    r2887889 r3327071  
    11<?php
     2if ( ! defined( 'ABSPATH' ) ) exit;
     3
    24if( ! class_exists( 'RACAR_Clear_Cart_Button' ) ) {
    35    class RACAR_Clear_Cart_Button {
     
    2123//trace( '$css_classes 0' );
    2224//trace( $css_classes );           
    23             if( isset( $this->options["rccwoo_radiobox_1"] ) ){
     25            if( isset( $this->options["rccwoo_radiobox_1"] ) ) {
    2426                $float_option = 'float:' . $this->options["rccwoo_radiobox_1"] . ';';
    2527            }
     
    5961                    button[name="clear-cart"]:hover{<?php echo esc_html( $button_bg_hover_color ); echo esc_html( $button_hover_text_color );?>}
    6062                </style>
     63
     64                <?php echo wp_kses( wp_nonce_field( 'racar_clear_cart_nonce', '_wpnonce_racar_clear_cart' ), $allowed_html ); ?>
    6165           
    6266                <button type="submit" style="<?php echo esc_html( $float_option ); echo esc_html( $button_bg_color ); echo esc_html( $button_text_color ); echo esc_html( $fall_out_style_option );?>" onclick='return confirm("<?php echo esc_html( $confirm_text );?>");' <?php if( ! empty( $css_classes ) ) echo 'class="' . esc_html( $css_classes ) . '"';?> id="clear-cart" name="clear-cart" value="<?php echo esc_html( $button_text );?>"><?php echo esc_html( $button_text );?></button>
     
    6771}
    6872
    69 function add_button_to_cart_page() {
     73function rccwoo_add_button_to_cart_page() {
    7074    $button = new RACAR_Clear_Cart_Button();
    7175}
    72 add_button_to_cart_page();
     76rccwoo_add_button_to_cart_page();
  • racar-clear-cart-for-woocommerce/trunk/racar-clear-cart-for-woocommerce.php

    r3325229 r3327071  
    44 * Plugin URI:  https://github.com/rafacarvalhido/racar-clear-cart-woo
    55 * Description: This plugin adds a convenient button to empty the shopping cart. Clear the entire cart with one click.
    6  * Version:     2.1.5
     6 * Version:     2.1.6
    77 * Author:      Rafa Carvalhido
    88 * Author URI:  https://profissionalwp.dev.br/blog/contato/rafa-carvalhido/
    99 * Text Domain: racar-clear-cart-for-woocommerce
    1010 * Domain Path: /languages
    11  * Requires at least: 4.9.8
    12  * Tested up to: 6.8.1
     11 * Requires at least: 4.9
     12 * Tested up to: 6.8
    1313 * WC requires at least: 3.0.0
    1414 * WC tested up to: 9.9.5
     
    5252        add_action( 'plugins_loaded', array( 'rccwoo_Plugin', 'init' ) );
    5353    }
     54
     55    add_action( 'before_woocommerce_init', function() {
     56        if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     57            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     58        }
     59    } );
    5460   
    5561    /*=========================================================================*/
     
    5864    $rccwoo_basename = plugin_basename(__FILE__);//racar-clear-cart-for-woocommerce/racar-clear-cart-for-woocommerce.php
    5965
    60     $rccwoo_VERSION = '2.1.4';
     66    $rccwoo_VERSION = '2.1.6';
    6167   
    6268    $rccwoo_NOME_STYLESHEET = 'rccwoo-stylesheet';
     
    109115     *
    110116     * @since 1.0.0
     117     * @removed 2.1.6
    111118     */
    112     function rccwoo_load_textdomain() {
    113         $textdomain_loaded = load_plugin_textdomain( 'racar-clear-cart-for-woocommerce', false, basename( dirname( __FILE__ ) ) . '/languages' );
    114     }
    115     add_action( 'init', 'rccwoo_load_textdomain' );
    116 ?>
     119    // function rccwoo_load_textdomain() {
     120    //  $textdomain_loaded = load_plugin_textdomain( 'racar-clear-cart-for-woocommerce', false, basename( dirname( __FILE__ ) ) . '/languages' );
     121    // }
     122    // add_action( 'init', 'rccwoo_load_textdomain' );
  • racar-clear-cart-for-woocommerce/trunk/readme.txt

    r3325229 r3327071  
    33Donate link: https://www.paypal.me/RafaCarvalhido
    44Tags: empty cart, clear cart, cart, woo commerce, woocommerce
    5 Requires at least: 4.9.8
    6 Tested up to: 6.8.1
    7 Stable tag: 2.1.5
     5Requires at least: 4.9
     6Tested up to: 6.8
     7Stable tag: 2.1.6
    88WC tested up to: 9.9.5
    99Requires Plugins: woocommerce
     
    117117
    118118== Changelog ==
     119= 2.1.6 - 2025-07-13 =
     120* Update - Changed readme.txt as per Wordpress.org rules
     121* Update - Changed the name of 2 functions adding the prefix rccwoo_
     122* Update - Removed load_text_domain function
     123* Update - Activated compatibility with Woo's High-Performance Order Storage (HPOS)
     124* Fix - Escaped some echoed terms on Admin Options
     125* Fix - Added a nonce to the button action
     126* Fix - Removed closing tags in 2 files
     127
     128
    119129= 2.1.5 - 2025-07-09 =
    120130* Update - Tested on latest and greatest -> WP 6.8.1 and WC 9.9.5
Note: See TracChangeset for help on using the changeset viewer.