Plugin Directory

Changeset 2428038


Ignore:
Timestamp:
11/29/2020 09:04:03 AM (5 years ago)
Author:
betacore
Message:

1.1

  • Added functionality that you can also use the translations from the WP repo or a custom message. This will make the plugin more versatile for multilang-websites. Thanks @fasterboy for letting me know!
Location:
age-checkbox-for-woocommerce
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • age-checkbox-for-woocommerce/trunk/readme.txt

    r2427874 r2428038  
    66Tested up to: 5.6
    77Requires PHP: 7.1
    8 Stable tag: 1.0.2
     8Stable tag: 1.1
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    3232
    3333== Changelog ==
     34= 1.1 =
     35* Added functionality that you can also use the translations from the WP repo or a custom message. This will make the plugin more versatile for multilang-websites. Thanks @fasterboy for letting me know!
     36
    3437= 1.0 =
    3538* New artwork <3
  • age-checkbox-for-woocommerce/trunk/woo-age-checkbox.php

    r2427875 r2428038  
    55 * Plugin URI:        https://rikjanssen.info/plugins/age-checkbox-for-woocommerce/
    66 * Description:       Do your users have to comply to age regulations before ordering? This plugin adds a checkbox that has to be ticked before placing an order.
    7  * Version:           1.0.2
    8  * Author:            Rik Janssen (Beta)
     7 * Version:           1.1
     8 * Author:            Rik Janssen
    99 * Author URI:        https://rikjanssen.info
    1010 * Text Domain:       betawooage
     
    1818function bcWOAG_age_policy_form() {
    1919    if(get_option( 'woocommerce_betawooage_checkbox' )=='yes'){
     20
     21      if(get_option( 'woocommerce_betawooage_multilanguage' )=='yes'){
     22        $checkText = __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' );
     23      }else{
     24        $checkText = get_option( 'woocommerce_betawooage_checkboxemessage' );
     25      }
    2026        woocommerce_form_field( 'age_policy', array(
    2127           'type'          => 'checkbox',
     
    2430           'input_class'   => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
    2531           'required'      => true,
    26            'label'         => get_option( 'woocommerce_betawooage_checkboxemessage' )
     32           'label'         => $checkText
    2733        ));
    2834    }
     
    3642    if(get_option( 'woocommerce_betawooage_checkbox' )=='yes'){
    3743        if ( ! (int) isset( $_POST['age_policy'] ) ) {
    38             wc_add_notice( get_option( 'woocommerce_betawooage_failuremessage' ), 'error' );
     44
     45          if(get_option( 'woocommerce_betawooage_multilanguage' )=='yes'){
     46            $failText = __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box!", 'betawooage' );
     47          }else{
     48            $failText = get_option( 'woocommerce_betawooage_failuremessage' );
     49          }
     50
     51          wc_add_notice( $failText, 'error' );
     52
    3953        }
    4054    }
     
    6478      );
    6579
     80      $newsettings[] = array(
     81        'name'     => __( 'Multilanguage age checkbox', 'betawooage' ),
     82        'id'       => 'woocommerce_betawooage_multilanguage',
     83        'type'     => 'checkbox',
     84        'css'      => '',
     85        'std'      => 1,  // WC < 2.0
     86        'default'  => 1,  // WC >= 2.0
     87        'desc'     => __( "Refer to the known translations of this plugin or create your own by using another plugin.", 'betawooage' ),
     88      );
     89      if(get_option( 'woocommerce_betawooage_multilanguage' )=='no' OR get_option( 'woocommerce_betawooage_multilanguage' )==''){
    6690         $newsettings[] = array(
    6791            'name'     => __( 'Checkbox message', 'betawooage' ),
     
    6993            'type'     => 'textarea',
    7094            'css'      => 'min-width:300px; min-height:100px;',
    71             'std'      => __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' ),  // WC < 2.0
    72             'default'  => __( "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.", 'betawooage' ),  // WC >= 2.0
     95            'std'      => "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.",  // WC < 2.0
     96            'default'  => "You have to be 18 years or older to order products at this webshop. By checking this box you confirm that you are 18 years or older.",  // WC >= 2.0
    7397            'desc'     => __( "Display the text people see before ticking the box.", 'betawooage' ),
    7498          );
     
    78102            'type'     => 'textarea',
    79103            'css'      => 'min-width:300px; min-height:100px;',
    80             'std'      => __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", 'betawooage' ),  // WC < 2.0
    81             'default'  => __( "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.", 'betawooage' ),  // WC >= 2.0
     104            'std'      => "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.",  // WC < 2.0
     105            'default'  => "<strong>Please confirm that you are 18 years or older</strong> by ticking the box.",  // WC >= 2.0
    82106            'desc'     => __( "Display message to people that don't tick the box.", 'betawooage' ),
    83107          );
    84        
     108      }
    85109    }
    86110
    87111    $newsettings[] = $section;
     112
    88113  }
    89114
Note: See TracChangeset for help on using the changeset viewer.