Plugin Directory

Changeset 2891545


Ignore:
Timestamp:
03/31/2023 07:36:35 PM (3 years ago)
Author:
rafacarvalhido
Message:

2.1.0 - 2023-03-31

  • Enhancement - Added redirection option as per @trondandre1962's request.
Location:
racar-clear-cart-for-woocommerce/trunk
Files:
4 edited

Legend:

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

    r2891518 r2891545  
    202202                'rccwoo_section_1'
    203203            );
     204
     205            add_settings_field(
     206                'rccwoo_redirection_url',
     207                '<span class="option-name">' . __( 'Redirection after clearing cart', 'racar-clear-cart-for-woocommerce' ) . '<span class="quick-exp">(' . __( 'Type in the whole URL address you\'d like<br>to send customers if not to the cart itself', 'racar-clear-cart-for-woocommerce' ) . ')</span></span>',
     208                array( $this, 'rccwoo_redirection_url_render' ),
     209                'rccwoo-options-page',
     210                'rccwoo_section_1'
     211            );
    204212           
    205213            add_settings_field(
     
    246254            if ( ! empty( $_POST ) && check_admin_referer( 'rccwoo_update_options', 'nonce_rccwoo_settings' ) ) {
    247255                if( isset( $input['rccwoo_button_text'] ) )
    248                 $new_input['rccwoo_button_text'] = sanitize_text_field( $input['rccwoo_button_text'] );
     256                    $new_input['rccwoo_button_text'] = sanitize_text_field( $input['rccwoo_button_text'] );
    249257               
    250258                if( isset( $input['rccwoo_confirm_text'] ) )
    251                 $new_input['rccwoo_confirm_text'] = sanitize_text_field( $input['rccwoo_confirm_text'] );
     259                    $new_input['rccwoo_confirm_text'] = sanitize_text_field( $input['rccwoo_confirm_text'] );
    252260               
    253261                /*if( isset( $input['rccwoo_enabled'] ) )
     
    255263           
    256264                if( isset( $input['rccwoo_use_default_css_class'] ) )
    257                 $new_input['rccwoo_use_default_css_class'] = absint( $input['rccwoo_use_default_css_class'] );
     265                    $new_input['rccwoo_use_default_css_class'] = absint( $input['rccwoo_use_default_css_class'] );
    258266           
    259267                if( isset( $input['rccwoo_button_css_classes'] ) ) {
     
    325333                    $new_input['rccwoo_hover_text_color'] = sanitize_hex_color( $textcolor );
    326334                }
     335
     336                if( isset( $input['rccwoo_redirection_url'] ) )
     337                    $new_input['rccwoo_redirection_url'] = sanitize_url( $input['rccwoo_redirection_url'] , array('http', 'https') );
    327338               
    328339            }
     
    446457        }
    447458
     459        public function rccwoo_redirection_url_render() {
     460            printf(
     461                '<input type="text" id="button-css-classes" name="rccwoo_settings[rccwoo_redirection_url]" value="%s" placeholder="%s"/>',
     462                isset( $this->options['rccwoo_redirection_url'] ) ? esc_attr( $this->options['rccwoo_redirection_url']) : '',
     463                __( 'https://mysite.com/shop' , 'racar-clear-cart-for-woocommerce' )
     464            );
     465            echo '<div>'. __('Leave blank to keep customer in cart page after cart deletion' , 'racar-clear-cart-for-woocommerce' ) . '</div>';
     466        }
     467
    448468        public function rccwoo_rate_render() {
    449469            global $allowed_html;
  • racar-clear-cart-for-woocommerce/trunk/includes/class-rccwoo-plugin.php

    r2490150 r2891545  
    143143        public static function woocommerce_clear_cart_url() {
    144144            global $woocommerce;
     145            $options = get_option( 'rccwoo_settings' );
    145146            if( isset( $_REQUEST['clear-cart'] ) ) {
    146147                $woocommerce->cart->empty_cart();
     148                if( isset( $options['rccwoo_redirection_url'] ) ) {
     149                    wp_redirect( $options['rccwoo_redirection_url'] , 302 , 'Shop Clear Cart' );
     150                }
    147151            }
    148152        }
  • racar-clear-cart-for-woocommerce/trunk/racar-clear-cart-for-woocommerce.php

    r2891518 r2891545  
    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.0.4
     6 * Version:     2.1.0
    77 * Author:      Rafa Carvalhido
    88 * Author URI:  https://programawordpress.pro.br/blog/contato/rafa-carvalhido/
     
    5656    $rccwoo_basename = plugin_basename(__FILE__);//racar-clear-cart-for-woocommerce/racar-clear-cart-for-woocommerce.php
    5757
    58     $rccwoo_VERSION = '2.0.4';
     58    $rccwoo_VERSION = '2.1.0';
    5959   
    6060    $rccwoo_NOME_STYLESHEET = 'rccwoo-stylesheet';
  • racar-clear-cart-for-woocommerce/trunk/readme.txt

    r2891518 r2891545  
    55Requires at least: 4.9.8
    66Tested up to: 6.1.1
    7 Stable tag: 2.0.4
     7Stable tag: 2.1.0
    88WC tested up to: 7.5.1
    99Requires PHP: 7.0
     
    116116
    117117== Changelog ==
    118 = 2.0.4 - 2023-03-31 =
    119 * Fix - Support and donation links were exchanged.
     118= 2.1.0 - 2023-03-31 =
     119* Enhancement - Added redirection option as per @trondandre1962's request.
    120120
    121121= 2.0.3 - 2023-03-31 =
Note: See TracChangeset for help on using the changeset viewer.