Plugin Directory

Changeset 3197490


Ignore:
Timestamp:
11/26/2024 02:18:12 PM (15 months ago)
Author:
adcaptcha
Message:

Update to version 1.5.1 from GitHub

Location:
adcaptcha
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • adcaptcha/tags/1.5.1/adcaptcha.php

    r3196276 r3197490  
    33 * Plugin Name: adCAPTCHA for WordPress
    44 * Description: Secure your site. Elevate your brand. Boost Ad Revenue.
    5  * Version: 1.5.0
     5 * Version: 1.5.1
    66 * Requires at least: 6.4.2
    77 * Requires PHP: 7.4
     
    4343use AdCaptcha\Instantiate;
    4444
    45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.0';
     45const PLUGIN_VERSION_ADCAPTCHA = '1.5.1';
    4646define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' ));
    4747
  • adcaptcha/tags/1.5.1/readme.txt

    r3196276 r3197490  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.0
     7Stable tag: 1.5.1
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    132132= 1.5.0 =
    133133- Feature: Support Woocommerce checkout (Shortcodes)
     134
     135= 1.5.1 =
     136- Minor bug fix
  • adcaptcha/tags/1.5.1/src/Plugin/Elementor/Forms.php

    r3155182 r3197490  
    130130
    131131        $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken']));
    132         error_log('Success Token: ' . $successToken);
    133132
    134133        if ( empty( $successToken ) ) {
  • adcaptcha/tags/1.5.1/src/Plugin/Woocommerce/Checkout.php

    r3196276 r3197490  
    99class Checkout extends AdCaptchaPlugin {
    1010
    11     public function setup() {   
     11    private $hasVerified = null;
     12
     13    public function setup() {
     14
     15        $this->hasVerified = get_option('wc_adcaptcha_is_verified');
     16
    1217        add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] );
    1318        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
    1419        add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] );
    1520        add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] );
     21        add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]);
    1622        add_action( 'woocommerce_checkout_process', [ $this, 'verify' ] );
    1723    }
    1824
    19     public function verify( $error ) {
     25    public function verify() {
     26        if ( $this->hasVerified && strtotime($this->hasVerified) < time() ) {
     27            $this->reset_hasVerified();
     28        }
     29
     30        if ( $this->hasVerified && strtotime($this->hasVerified) > time() ) {
     31            return;
     32        }
     33
    2034        $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken']));
    2135        $response = Verify::verify_token($successToken);
    2236
    2337        if ( !$response ) {
    24             wc_add_notice( __( 'Incomplete captcha, Please try again', 'adcaptcha' ), 'error' );
     38            wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );   
    2539        }
     40
     41        update_option('wc_adcaptcha_is_verified', date('Y-m-d H:i:s', strtotime('+10 minutes')));
     42    }
     43
     44    public function reset_hasVerified() {
     45        update_option('wc_adcaptcha_is_verified', '');
    2646    }
    2747
     
    3353                    if (window.adcap) {
    3454                        window.adcap.init();
     55
     56                        ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . '
    3557                    }
    3658                });
  • adcaptcha/tags/1.5.1/src/Plugin/Woocommerce/Registration.php

    r3080455 r3197490  
    2323        $response = Verify::verify_token($successToken);
    2424
    25         if ( !$response ) {
     25        if ( !$response && !is_checkout() ) {
    2626            $validation_errors = new WP_Error('adcaptcha_error', __( 'Incomplete captcha, Please try again.', 'adcaptcha' ) );
    2727        }
  • adcaptcha/tags/1.5.1/src/Settings/Settings.php

    r3196276 r3197490  
    7171
    7272    public function change_admin_footer_version() {
    73         return 'Version 1.5.0';
     73        return 'Version 1.5.1';
    7474    }
    7575}
  • adcaptcha/trunk/adcaptcha.php

    r3196276 r3197490  
    33 * Plugin Name: adCAPTCHA for WordPress
    44 * Description: Secure your site. Elevate your brand. Boost Ad Revenue.
    5  * Version: 1.5.0
     5 * Version: 1.5.1
    66 * Requires at least: 6.4.2
    77 * Requires PHP: 7.4
     
    4343use AdCaptcha\Instantiate;
    4444
    45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.0';
     45const PLUGIN_VERSION_ADCAPTCHA = '1.5.1';
    4646define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' ));
    4747
  • adcaptcha/trunk/readme.txt

    r3196276 r3197490  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.0
     7Stable tag: 1.5.1
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    132132= 1.5.0 =
    133133- Feature: Support Woocommerce checkout (Shortcodes)
     134
     135= 1.5.1 =
     136- Minor bug fix
  • adcaptcha/trunk/src/Plugin/Elementor/Forms.php

    r3155182 r3197490  
    130130
    131131        $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken']));
    132         error_log('Success Token: ' . $successToken);
    133132
    134133        if ( empty( $successToken ) ) {
  • adcaptcha/trunk/src/Plugin/Woocommerce/Checkout.php

    r3196276 r3197490  
    99class Checkout extends AdCaptchaPlugin {
    1010
    11     public function setup() {   
     11    private $hasVerified = null;
     12
     13    public function setup() {
     14
     15        $this->hasVerified = get_option('wc_adcaptcha_is_verified');
     16
    1217        add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] );
    1318        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
    1419        add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] );
    1520        add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] );
     21        add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]);
    1622        add_action( 'woocommerce_checkout_process', [ $this, 'verify' ] );
    1723    }
    1824
    19     public function verify( $error ) {
     25    public function verify() {
     26        if ( $this->hasVerified && strtotime($this->hasVerified) < time() ) {
     27            $this->reset_hasVerified();
     28        }
     29
     30        if ( $this->hasVerified && strtotime($this->hasVerified) > time() ) {
     31            return;
     32        }
     33
    2034        $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken']));
    2135        $response = Verify::verify_token($successToken);
    2236
    2337        if ( !$response ) {
    24             wc_add_notice( __( 'Incomplete captcha, Please try again', 'adcaptcha' ), 'error' );
     38            wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );   
    2539        }
     40
     41        update_option('wc_adcaptcha_is_verified', date('Y-m-d H:i:s', strtotime('+10 minutes')));
     42    }
     43
     44    public function reset_hasVerified() {
     45        update_option('wc_adcaptcha_is_verified', '');
    2646    }
    2747
     
    3353                    if (window.adcap) {
    3454                        window.adcap.init();
     55
     56                        ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . '
    3557                    }
    3658                });
  • adcaptcha/trunk/src/Plugin/Woocommerce/Registration.php

    r3080455 r3197490  
    2323        $response = Verify::verify_token($successToken);
    2424
    25         if ( !$response ) {
     25        if ( !$response && !is_checkout() ) {
    2626            $validation_errors = new WP_Error('adcaptcha_error', __( 'Incomplete captcha, Please try again.', 'adcaptcha' ) );
    2727        }
  • adcaptcha/trunk/src/Settings/Settings.php

    r3196276 r3197490  
    7171
    7272    public function change_admin_footer_version() {
    73         return 'Version 1.5.0';
     73        return 'Version 1.5.1';
    7474    }
    7575}
Note: See TracChangeset for help on using the changeset viewer.