Changeset 3198915
- Timestamp:
- 11/28/2024 01:25:17 PM (15 months ago)
- Location:
- adcaptcha
- Files:
-
- 2 added
- 12 edited
- 1 copied
-
tags/1.5.3 (copied) (copied from adcaptcha/trunk)
-
tags/1.5.3/adcaptcha.php (modified) (3 diffs)
-
tags/1.5.3/readme.txt (modified) (2 diffs)
-
tags/1.5.3/src/Plugin/Woocommerce/Checkout.php (modified) (3 diffs)
-
tags/1.5.3/src/Settings/Advanced.php (added)
-
tags/1.5.3/src/Settings/Plugins.php (modified) (1 diff)
-
tags/1.5.3/src/Settings/Settings.php (modified) (4 diffs)
-
tags/1.5.3/src/styles/settings.css (modified) (1 diff)
-
trunk/adcaptcha.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Plugin/Woocommerce/Checkout.php (modified) (3 diffs)
-
trunk/src/Settings/Advanced.php (added)
-
trunk/src/Settings/Plugins.php (modified) (1 diff)
-
trunk/src/Settings/Settings.php (modified) (4 diffs)
-
trunk/src/styles/settings.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
adcaptcha/tags/1.5.3/adcaptcha.php
r3198102 r3198915 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 25 * Version: 1.5.3 6 6 * Requires at least: 6.4.2 7 7 * Requires PHP: 7.4 … … 23 23 require_once plugin_dir_path(__FILE__) . 'src/Settings/General.php'; 24 24 require_once plugin_dir_path(__FILE__) . 'src/Settings/Plugins.php'; 25 require_once plugin_dir_path(__FILE__) . 'src/Settings/Advanced.php'; 25 26 require_once plugin_dir_path(__FILE__) . 'src/Plugin/AdCaptchaPlugin.php'; 26 27 require_once plugin_dir_path(__FILE__) . 'src/Plugin/Login.php'; … … 43 44 use AdCaptcha\Instantiate; 44 45 45 const PLUGIN_VERSION_ADCAPTCHA = '1.5. 2';46 const PLUGIN_VERSION_ADCAPTCHA = '1.5.3'; 46 47 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 48 -
adcaptcha/tags/1.5.3/readme.txt
r3198102 r3198915 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 27 Stable tag: 1.5.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 138 138 = 1.5.2 = 139 139 - Minor bug fix for Woocommerce 140 141 = 1.5.3 = 142 - Added advanced settings which includes a Woocommerce checkout feature, to trigger adCAPTCHA from the place order button. -
adcaptcha/tags/1.5.3/src/Plugin/Woocommerce/Checkout.php
r3198102 r3198915 15 15 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); 16 16 add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] ); 17 if (get_option('adcaptcha_wc_checkout_optional_trigger')) { 18 add_action( 'wp_enqueue_scripts', [ $this, 'block_submission' ] ); 19 } 17 20 add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] ); 18 21 add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]); … … 57 60 $(document.body).on("updated_checkout", function () { 58 61 if (window.adcap) { 59 window.adcap.init(); 62 window.adcap.init({onComplete: () => { 63 const event = new CustomEvent("adcaptcha_onSuccess", { 64 detail: { successToken: window.adcap.successToken }, 65 }); 66 document.dispatchEvent(event); 67 68 if (window.adcap.tmp && window.adcap.tmp.didSubmitTrigger) { 69 const checkoutForm = $("form.checkout"); 70 if (checkoutForm.length) { 71 checkoutForm.submit(); 72 } 73 window.adcap.tmp = { didSubmitTrigger: false }; 74 } 75 }}); 60 76 61 77 ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . ' … … 68 84 wp_enqueue_script('adcaptcha-wc-init-trigger'); 69 85 } 86 87 public function block_submission() { 88 $script = ' 89 jQuery(document).ready(function($) { 90 var checkoutForm = $("form.checkout"); 91 if (checkoutForm.length) { 92 checkoutForm.on("submit", function(event) { 93 if (!window.adcap.successToken) { 94 event.preventDefault(); 95 96 if (window.adcap) { 97 window.adcap.tmp = { didSubmitTrigger: true }; 98 window.adcap.handleTriggerClick("' . esc_js(get_option('adcaptcha_placement_id')) . '"); 99 } 100 } 101 }); 102 } 103 }); 104 '; 105 106 wp_add_inline_script('adcaptcha-script', $script); 107 } 70 108 } -
adcaptcha/tags/1.5.3/src/Settings/Plugins.php
r3196276 r3198915 5 5 class Plugins { 6 6 7 public function render_ Plugins_settings() {7 public function render_plugins_settings() { 8 8 $plugins = array( 9 9 array( -
adcaptcha/tags/1.5.3/src/Settings/Settings.php
r3198102 r3198915 28 28 $tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 29 29 $tab = isset( $tab ) ? $tab : 'general'; 30 if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' )) {30 if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' && $tab !== 'advance')) { 31 31 $tab = 'general'; 32 32 } … … 48 48 ?> 49 49 nav-tab-active<?php endif; ?>">Plugins</a> 50 <a href="?page=adcaptcha&tab=advance" class="nav-tab 51 <?php 52 if ( $tab === 'advance' ) : 53 ?> 54 nav-tab-active<?php endif; ?>">Advanced</a> 55 </nav> 50 56 </div> 51 57 <?php … … 57 63 case 'plugins': 58 64 $pluginsSettings = new \AdCaptcha\Settings\Plugins\Plugins(); 59 $pluginsSettings->render_Plugins_settings(); 65 $pluginsSettings->render_plugins_settings(); 66 case 'advance': 67 $advanceSettings = new \AdCaptcha\Settings\Advance\Advance(); 68 $advanceSettings->render_advance_settings(); 60 69 break; 61 70 } … … 71 80 72 81 public function change_admin_footer_version() { 73 return 'Version 1.5. 2';82 return 'Version 1.5.3'; 74 83 } 75 84 } -
adcaptcha/tags/1.5.3/src/styles/settings.css
r3155182 r3198915 82 82 } 83 83 84 .plugins-container, .integrating-description { 84 .advance-item-container { 85 background-color: white; 86 padding: 20px 20px 0px 20px; 87 width: 100%; 88 height: 225px; 89 margin-bottom: 20px; 90 margin-right: 30px; 91 border-radius: 5px; 92 } 93 94 .plugins-container, .integrating-description, .advance-container { 85 95 margin-top: 20px; 86 96 margin-left: 20px; -
adcaptcha/trunk/adcaptcha.php
r3198102 r3198915 3 3 * Plugin Name: adCAPTCHA for WordPress 4 4 * Description: Secure your site. Elevate your brand. Boost Ad Revenue. 5 * Version: 1.5. 25 * Version: 1.5.3 6 6 * Requires at least: 6.4.2 7 7 * Requires PHP: 7.4 … … 23 23 require_once plugin_dir_path(__FILE__) . 'src/Settings/General.php'; 24 24 require_once plugin_dir_path(__FILE__) . 'src/Settings/Plugins.php'; 25 require_once plugin_dir_path(__FILE__) . 'src/Settings/Advanced.php'; 25 26 require_once plugin_dir_path(__FILE__) . 'src/Plugin/AdCaptchaPlugin.php'; 26 27 require_once plugin_dir_path(__FILE__) . 'src/Plugin/Login.php'; … … 43 44 use AdCaptcha\Instantiate; 44 45 45 const PLUGIN_VERSION_ADCAPTCHA = '1.5. 2';46 const PLUGIN_VERSION_ADCAPTCHA = '1.5.3'; 46 47 define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' )); 47 48 -
adcaptcha/trunk/readme.txt
r3198102 r3198915 5 5 Requires at least: 6.0 6 6 Tested up to: 6.5.2 7 Stable tag: 1.5. 27 Stable tag: 1.5.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 138 138 = 1.5.2 = 139 139 - Minor bug fix for Woocommerce 140 141 = 1.5.3 = 142 - Added advanced settings which includes a Woocommerce checkout feature, to trigger adCAPTCHA from the place order button. -
adcaptcha/trunk/src/Plugin/Woocommerce/Checkout.php
r3198102 r3198915 15 15 add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] ); 16 16 add_action( 'wp_enqueue_scripts', [ $this, 'init_trigger' ] ); 17 if (get_option('adcaptcha_wc_checkout_optional_trigger')) { 18 add_action( 'wp_enqueue_scripts', [ $this, 'block_submission' ] ); 19 } 17 20 add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] ); 18 21 add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]); … … 57 60 $(document.body).on("updated_checkout", function () { 58 61 if (window.adcap) { 59 window.adcap.init(); 62 window.adcap.init({onComplete: () => { 63 const event = new CustomEvent("adcaptcha_onSuccess", { 64 detail: { successToken: window.adcap.successToken }, 65 }); 66 document.dispatchEvent(event); 67 68 if (window.adcap.tmp && window.adcap.tmp.didSubmitTrigger) { 69 const checkoutForm = $("form.checkout"); 70 if (checkoutForm.length) { 71 checkoutForm.submit(); 72 } 73 window.adcap.tmp = { didSubmitTrigger: false }; 74 } 75 }}); 60 76 61 77 ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . ' … … 68 84 wp_enqueue_script('adcaptcha-wc-init-trigger'); 69 85 } 86 87 public function block_submission() { 88 $script = ' 89 jQuery(document).ready(function($) { 90 var checkoutForm = $("form.checkout"); 91 if (checkoutForm.length) { 92 checkoutForm.on("submit", function(event) { 93 if (!window.adcap.successToken) { 94 event.preventDefault(); 95 96 if (window.adcap) { 97 window.adcap.tmp = { didSubmitTrigger: true }; 98 window.adcap.handleTriggerClick("' . esc_js(get_option('adcaptcha_placement_id')) . '"); 99 } 100 } 101 }); 102 } 103 }); 104 '; 105 106 wp_add_inline_script('adcaptcha-script', $script); 107 } 70 108 } -
adcaptcha/trunk/src/Settings/Plugins.php
r3196276 r3198915 5 5 class Plugins { 6 6 7 public function render_ Plugins_settings() {7 public function render_plugins_settings() { 8 8 $plugins = array( 9 9 array( -
adcaptcha/trunk/src/Settings/Settings.php
r3198102 r3198915 28 28 $tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 29 29 $tab = isset( $tab ) ? $tab : 'general'; 30 if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' )) {30 if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' && $tab !== 'advance')) { 31 31 $tab = 'general'; 32 32 } … … 48 48 ?> 49 49 nav-tab-active<?php endif; ?>">Plugins</a> 50 <a href="?page=adcaptcha&tab=advance" class="nav-tab 51 <?php 52 if ( $tab === 'advance' ) : 53 ?> 54 nav-tab-active<?php endif; ?>">Advanced</a> 55 </nav> 50 56 </div> 51 57 <?php … … 57 63 case 'plugins': 58 64 $pluginsSettings = new \AdCaptcha\Settings\Plugins\Plugins(); 59 $pluginsSettings->render_Plugins_settings(); 65 $pluginsSettings->render_plugins_settings(); 66 case 'advance': 67 $advanceSettings = new \AdCaptcha\Settings\Advance\Advance(); 68 $advanceSettings->render_advance_settings(); 60 69 break; 61 70 } … … 71 80 72 81 public function change_admin_footer_version() { 73 return 'Version 1.5. 2';82 return 'Version 1.5.3'; 74 83 } 75 84 } -
adcaptcha/trunk/src/styles/settings.css
r3155182 r3198915 82 82 } 83 83 84 .plugins-container, .integrating-description { 84 .advance-item-container { 85 background-color: white; 86 padding: 20px 20px 0px 20px; 87 width: 100%; 88 height: 225px; 89 margin-bottom: 20px; 90 margin-right: 30px; 91 border-radius: 5px; 92 } 93 94 .plugins-container, .integrating-description, .advance-container { 85 95 margin-top: 20px; 86 96 margin-left: 20px;
Note: See TracChangeset
for help on using the changeset viewer.