Changeset 3198102
- Timestamp:
- 11/27/2024 11:32:36 AM (15 months ago)
- Location:
- adcaptcha
- Files:
-
- 8 edited
- 1 copied
-
tags/1.5.2 (copied) (copied from adcaptcha/trunk)
-
tags/1.5.2/adcaptcha.php (modified) (2 diffs)
-
tags/1.5.2/readme.txt (modified) (2 diffs)
-
tags/1.5.2/src/Plugin/Woocommerce/Checkout.php (modified) (4 diffs)
-
tags/1.5.2/src/Settings/Settings.php (modified) (1 diff)
-
trunk/adcaptcha.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Plugin/Woocommerce/Checkout.php (modified) (4 diffs)
-
trunk/src/Settings/Settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
adcaptcha/tags/1.5.2/adcaptcha.php
r3197490 r3198102 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 15 * Version: 1.5.2 6 6 * Requires at least: 6.4.2 7 7 * Requires PHP: 7.4 … … 43 43 use AdCaptcha\Instantiate; 44 44 45 const PLUGIN_VERSION_ADCAPTCHA = '1.5. 1';45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.2'; 46 46 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 47 -
adcaptcha/tags/1.5.2/readme.txt
r3197490 r3198102 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 17 Stable tag: 1.5.2 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 135 135 = 1.5.1 = 136 136 - 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 7 7 use AdCaptcha\AdCaptchaPlugin\AdCaptchaPlugin; 8 8 9 use DateTime; 10 9 11 class Checkout extends AdCaptchaPlugin { 10 12 11 private $hasVerified = null;12 13 13 public function setup() { 14 15 $this->hasVerified = get_option('wc_adcaptcha_is_verified');16 17 14 add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] ); 18 15 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); … … 24 21 25 22 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() ) { 27 27 $this->reset_hasVerified(); 28 28 } 29 29 30 if ( $ this->hasVerified && strtotime($this->hasVerified) > time() ) {30 if ( $hasVerified && strtotime($hasVerified) > time() ) { 31 31 return; 32 32 } … … 36 36 37 37 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; 39 40 } 40 41 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); 42 47 } 43 48 44 49 public function reset_hasVerified() { 45 update_option('wc_adcaptcha_is_verified', '');50 WC()->session->set('hasVerified', null); 46 51 } 47 52 … … 54 59 window.adcap.init(); 55 60 56 ' . ( $this->hasVerified? ' window.adcap.setVerificationState(true);' : '' ) . '61 ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . ' 57 62 } 58 63 }); -
adcaptcha/tags/1.5.2/src/Settings/Settings.php
r3197490 r3198102 71 71 72 72 public function change_admin_footer_version() { 73 return 'Version 1.5. 1';73 return 'Version 1.5.2'; 74 74 } 75 75 } -
adcaptcha/trunk/adcaptcha.php
r3197490 r3198102 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 15 * Version: 1.5.2 6 6 * Requires at least: 6.4.2 7 7 * Requires PHP: 7.4 … … 43 43 use AdCaptcha\Instantiate; 44 44 45 const PLUGIN_VERSION_ADCAPTCHA = '1.5. 1';45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.2'; 46 46 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 47 -
adcaptcha/trunk/readme.txt
r3197490 r3198102 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 17 Stable tag: 1.5.2 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 135 135 = 1.5.1 = 136 136 - Minor bug fix 137 138 = 1.5.2 = 139 - Minor bug fix for Woocommerce -
adcaptcha/trunk/src/Plugin/Woocommerce/Checkout.php
r3197490 r3198102 7 7 use AdCaptcha\AdCaptchaPlugin\AdCaptchaPlugin; 8 8 9 use DateTime; 10 9 11 class Checkout extends AdCaptchaPlugin { 10 12 11 private $hasVerified = null;12 13 13 public function setup() { 14 15 $this->hasVerified = get_option('wc_adcaptcha_is_verified');16 17 14 add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] ); 18 15 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); … … 24 21 25 22 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() ) { 27 27 $this->reset_hasVerified(); 28 28 } 29 29 30 if ( $ this->hasVerified && strtotime($this->hasVerified) > time() ) {30 if ( $hasVerified && strtotime($hasVerified) > time() ) { 31 31 return; 32 32 } … … 36 36 37 37 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; 39 40 } 40 41 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); 42 47 } 43 48 44 49 public function reset_hasVerified() { 45 update_option('wc_adcaptcha_is_verified', '');50 WC()->session->set('hasVerified', null); 46 51 } 47 52 … … 54 59 window.adcap.init(); 55 60 56 ' . ( $this->hasVerified? ' window.adcap.setVerificationState(true);' : '' ) . '61 ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . ' 57 62 } 58 63 }); -
adcaptcha/trunk/src/Settings/Settings.php
r3197490 r3198102 71 71 72 72 public function change_admin_footer_version() { 73 return 'Version 1.5. 1';73 return 'Version 1.5.2'; 74 74 } 75 75 }
Note: See TracChangeset
for help on using the changeset viewer.