Changeset 3197490
- Timestamp:
- 11/26/2024 02:18:12 PM (15 months ago)
- Location:
- adcaptcha
- Files:
-
- 12 edited
- 1 copied
-
tags/1.5.1 (copied) (copied from adcaptcha/trunk)
-
tags/1.5.1/adcaptcha.php (modified) (2 diffs)
-
tags/1.5.1/readme.txt (modified) (2 diffs)
-
tags/1.5.1/src/Plugin/Elementor/Forms.php (modified) (1 diff)
-
tags/1.5.1/src/Plugin/Woocommerce/Checkout.php (modified) (2 diffs)
-
tags/1.5.1/src/Plugin/Woocommerce/Registration.php (modified) (1 diff)
-
tags/1.5.1/src/Settings/Settings.php (modified) (1 diff)
-
trunk/adcaptcha.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Plugin/Elementor/Forms.php (modified) (1 diff)
-
trunk/src/Plugin/Woocommerce/Checkout.php (modified) (2 diffs)
-
trunk/src/Plugin/Woocommerce/Registration.php (modified) (1 diff)
-
trunk/src/Settings/Settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
adcaptcha/tags/1.5.1/adcaptcha.php
r3196276 r3197490 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 05 * Version: 1.5.1 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. 0';45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.1'; 46 46 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 47 -
adcaptcha/tags/1.5.1/readme.txt
r3196276 r3197490 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 07 Stable tag: 1.5.1 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 132 132 = 1.5.0 = 133 133 - 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 130 130 131 131 $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken'])); 132 error_log('Success Token: ' . $successToken);133 132 134 133 if ( empty( $successToken ) ) { -
adcaptcha/tags/1.5.1/src/Plugin/Woocommerce/Checkout.php
r3196276 r3197490 9 9 class Checkout extends AdCaptchaPlugin { 10 10 11 public function setup() { 11 private $hasVerified = null; 12 13 public function setup() { 14 15 $this->hasVerified = get_option('wc_adcaptcha_is_verified'); 16 12 17 add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] ); 13 18 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); 14 19 add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] ); 15 20 add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] ); 21 add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]); 16 22 add_action( 'woocommerce_checkout_process', [ $this, 'verify' ] ); 17 23 } 18 24 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 20 34 $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken'])); 21 35 $response = Verify::verify_token($successToken); 22 36 23 37 if ( !$response ) { 24 wc_add_notice( __( 'Incomplete captcha, Please try again ', 'adcaptcha' ), 'error' );38 wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' ); 25 39 } 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', ''); 26 46 } 27 47 … … 33 53 if (window.adcap) { 34 54 window.adcap.init(); 55 56 ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . ' 35 57 } 36 58 }); -
adcaptcha/tags/1.5.1/src/Plugin/Woocommerce/Registration.php
r3080455 r3197490 23 23 $response = Verify::verify_token($successToken); 24 24 25 if ( !$response ) {25 if ( !$response && !is_checkout() ) { 26 26 $validation_errors = new WP_Error('adcaptcha_error', __( 'Incomplete captcha, Please try again.', 'adcaptcha' ) ); 27 27 } -
adcaptcha/tags/1.5.1/src/Settings/Settings.php
r3196276 r3197490 71 71 72 72 public function change_admin_footer_version() { 73 return 'Version 1.5. 0';73 return 'Version 1.5.1'; 74 74 } 75 75 } -
adcaptcha/trunk/adcaptcha.php
r3196276 r3197490 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 05 * Version: 1.5.1 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. 0';45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.1'; 46 46 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 47 -
adcaptcha/trunk/readme.txt
r3196276 r3197490 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 07 Stable tag: 1.5.1 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 132 132 = 1.5.0 = 133 133 - Feature: Support Woocommerce checkout (Shortcodes) 134 135 = 1.5.1 = 136 - Minor bug fix -
adcaptcha/trunk/src/Plugin/Elementor/Forms.php
r3155182 r3197490 130 130 131 131 $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken'])); 132 error_log('Success Token: ' . $successToken);133 132 134 133 if ( empty( $successToken ) ) { -
adcaptcha/trunk/src/Plugin/Woocommerce/Checkout.php
r3196276 r3197490 9 9 class Checkout extends AdCaptchaPlugin { 10 10 11 public function setup() { 11 private $hasVerified = null; 12 13 public function setup() { 14 15 $this->hasVerified = get_option('wc_adcaptcha_is_verified'); 16 12 17 add_action( 'wp_enqueue_scripts', [ AdCaptcha::class, 'enqueue_scripts' ] ); 13 18 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); 14 19 add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] ); 15 20 add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] ); 21 add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]); 16 22 add_action( 'woocommerce_checkout_process', [ $this, 'verify' ] ); 17 23 } 18 24 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 20 34 $successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken'])); 21 35 $response = Verify::verify_token($successToken); 22 36 23 37 if ( !$response ) { 24 wc_add_notice( __( 'Incomplete captcha, Please try again ', 'adcaptcha' ), 'error' );38 wc_add_notice( __( 'Incomplete captcha, Please try again.', 'adcaptcha' ), 'error' ); 25 39 } 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', ''); 26 46 } 27 47 … … 33 53 if (window.adcap) { 34 54 window.adcap.init(); 55 56 ' . ($this->hasVerified ? ' window.adcap.setVerificationState(true);' : '' ) . ' 35 57 } 36 58 }); -
adcaptcha/trunk/src/Plugin/Woocommerce/Registration.php
r3080455 r3197490 23 23 $response = Verify::verify_token($successToken); 24 24 25 if ( !$response ) {25 if ( !$response && !is_checkout() ) { 26 26 $validation_errors = new WP_Error('adcaptcha_error', __( 'Incomplete captcha, Please try again.', 'adcaptcha' ) ); 27 27 } -
adcaptcha/trunk/src/Settings/Settings.php
r3196276 r3197490 71 71 72 72 public function change_admin_footer_version() { 73 return 'Version 1.5. 0';73 return 'Version 1.5.1'; 74 74 } 75 75 }
Note: See TracChangeset
for help on using the changeset viewer.