Plugin Directory

Changeset 3198102


Ignore:
Timestamp:
11/27/2024 11:32:36 AM (15 months ago)
Author:
adcaptcha
Message:

Update to version 1.5.2 from GitHub

Location:
adcaptcha
Files:
8 edited
1 copied

Legend:

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

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

    r3197490 r3198102  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.1
     7Stable tag: 1.5.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    135135= 1.5.1 =
    136136- Minor bug fix
     137
     138= 1.5.2 =
     139- Minor bug fix for Woocommerce
  • adcaptcha/tags/1.5.2/src/Plugin/Woocommerce/Checkout.php

    r3197490 r3198102  
    77use AdCaptcha\AdCaptchaPlugin\AdCaptchaPlugin;
    88
     9use DateTime;
     10
    911class Checkout extends AdCaptchaPlugin {
    1012
    11     private $hasVerified = null;
    12 
    1313    public function setup() {
    14 
    15         $this->hasVerified = get_option('wc_adcaptcha_is_verified');
    16 
    1714        add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] );
    1815        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
     
    2421
    2522    public function verify() {
    26         if ( $this->hasVerified && strtotime($this->hasVerified) < time() ) {
     23        $session = WC()->session;
     24        $hasVerified = $session->get('hasVerified');
     25
     26        if ( $hasVerified && strtotime($hasVerified) < time() ) {
    2727            $this->reset_hasVerified();
    2828        }
    2929
    30         if ( $this->hasVerified && strtotime($this->hasVerified) > time() ) {
     30        if ( $hasVerified && strtotime($hasVerified) > time() ) {
    3131            return;
    3232        }
     
    3636
    3737        if ( !$response ) {
    38             wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );   
     38            wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );
     39            return;
    3940        }
    4041
    41         update_option('wc_adcaptcha_is_verified', date('Y-m-d H:i:s', strtotime('+10 minutes')));
     42        // Add 10 minutes to the current date and time
     43        $date = new DateTime();
     44        $date->modify('+10 minutes');
     45        $formatted_date = $date->format('Y-m-d H:i:s');
     46        $session->set('hasVerified', $formatted_date);
    4247    }
    4348
    4449    public function reset_hasVerified() {
    45         update_option('wc_adcaptcha_is_verified', '');
     50        WC()->session->set('hasVerified', null);
    4651    }
    4752
     
    5459                        window.adcap.init();
    5560
    56                         ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . '
     61                        ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . '
    5762                    }
    5863                });
  • adcaptcha/tags/1.5.2/src/Settings/Settings.php

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

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

    r3197490 r3198102  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.1
     7Stable tag: 1.5.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    135135= 1.5.1 =
    136136- Minor bug fix
     137
     138= 1.5.2 =
     139- Minor bug fix for Woocommerce
  • adcaptcha/trunk/src/Plugin/Woocommerce/Checkout.php

    r3197490 r3198102  
    77use AdCaptcha\AdCaptchaPlugin\AdCaptchaPlugin;
    88
     9use DateTime;
     10
    911class Checkout extends AdCaptchaPlugin {
    1012
    11     private $hasVerified = null;
    12 
    1313    public function setup() {
    14 
    15         $this->hasVerified = get_option('wc_adcaptcha_is_verified');
    16 
    1714        add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] );
    1815        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
     
    2421
    2522    public function verify() {
    26         if ( $this->hasVerified && strtotime($this->hasVerified) < time() ) {
     23        $session = WC()->session;
     24        $hasVerified = $session->get('hasVerified');
     25
     26        if ( $hasVerified && strtotime($hasVerified) < time() ) {
    2727            $this->reset_hasVerified();
    2828        }
    2929
    30         if ( $this->hasVerified && strtotime($this->hasVerified) > time() ) {
     30        if ( $hasVerified && strtotime($hasVerified) > time() ) {
    3131            return;
    3232        }
     
    3636
    3737        if ( !$response ) {
    38             wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );   
     38            wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' );
     39            return;
    3940        }
    4041
    41         update_option('wc_adcaptcha_is_verified', date('Y-m-d H:i:s', strtotime('+10 minutes')));
     42        // Add 10 minutes to the current date and time
     43        $date = new DateTime();
     44        $date->modify('+10 minutes');
     45        $formatted_date = $date->format('Y-m-d H:i:s');
     46        $session->set('hasVerified', $formatted_date);
    4247    }
    4348
    4449    public function reset_hasVerified() {
    45         update_option('wc_adcaptcha_is_verified', '');
     50        WC()->session->set('hasVerified', null);
    4651    }
    4752
     
    5459                        window.adcap.init();
    5560
    56                         ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . '
     61                        ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . '
    5762                    }
    5863                });
  • adcaptcha/trunk/src/Settings/Settings.php

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