Plugin Directory

Changeset 3198915


Ignore:
Timestamp:
11/28/2024 01:25:17 PM (15 months ago)
Author:
adcaptcha
Message:

Update to version 1.5.3 from GitHub

Location:
adcaptcha
Files:
2 added
12 edited
1 copied

Legend:

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

    r3198102 r3198915  
    33 * Plugin Name: adCAPTCHA for WordPress
    44 * Description: Secure your site. Elevate your brand. Boost Ad Revenue.
    5  * Version: 1.5.2
     5 * Version: 1.5.3
    66 * Requires at least: 6.4.2
    77 * Requires PHP: 7.4
     
    2323require_once plugin_dir_path(__FILE__) . 'src/Settings/General.php';
    2424require_once plugin_dir_path(__FILE__) . 'src/Settings/Plugins.php';
     25require_once plugin_dir_path(__FILE__) . 'src/Settings/Advanced.php';
    2526require_once plugin_dir_path(__FILE__) . 'src/Plugin/AdCaptchaPlugin.php';
    2627require_once plugin_dir_path(__FILE__) . 'src/Plugin/Login.php';
     
    4344use AdCaptcha\Instantiate;
    4445
    45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.2';
     46const PLUGIN_VERSION_ADCAPTCHA = '1.5.3';
    4647define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' ));
    4748
  • adcaptcha/tags/1.5.3/readme.txt

    r3198102 r3198915  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.2
     7Stable tag: 1.5.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    138138= 1.5.2 =
    139139- 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  
    1515        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
    1616        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        }
    1720        add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] );
    1821        add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]);
     
    5760                $(document.body).on("updated_checkout", function () {
    5861                    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                        }});
    6076
    6177                        ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . '
     
    6884        wp_enqueue_script('adcaptcha-wc-init-trigger');
    6985    }
     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    }
    70108}
  • adcaptcha/tags/1.5.3/src/Settings/Plugins.php

    r3196276 r3198915  
    55class Plugins {
    66     
    7     public function render_Plugins_settings() {
     7    public function render_plugins_settings() {
    88        $plugins = array(
    99            array(
  • adcaptcha/tags/1.5.3/src/Settings/Settings.php

    r3198102 r3198915  
    2828        $tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
    2929        $tab = isset( $tab ) ? $tab : 'general';
    30         if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins')) {
     30        if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' && $tab !== 'advance')) {
    3131            $tab = 'general';
    3232        }
     
    4848                        ?>
    4949                    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>
    5056            </div>
    5157            <?php
     
    5763                    case 'plugins':
    5864                        $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();
    6069                        break;
    6170                }
     
    7180
    7281    public function change_admin_footer_version() {
    73         return 'Version 1.5.2';
     82        return 'Version 1.5.3';
    7483    }
    7584}
  • adcaptcha/tags/1.5.3/src/styles/settings.css

    r3155182 r3198915  
    8282}
    8383
    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 {
    8595    margin-top: 20px;
    8696    margin-left: 20px;
  • adcaptcha/trunk/adcaptcha.php

    r3198102 r3198915  
    33 * Plugin Name: adCAPTCHA for WordPress
    44 * Description: Secure your site. Elevate your brand. Boost Ad Revenue.
    5  * Version: 1.5.2
     5 * Version: 1.5.3
    66 * Requires at least: 6.4.2
    77 * Requires PHP: 7.4
     
    2323require_once plugin_dir_path(__FILE__) . 'src/Settings/General.php';
    2424require_once plugin_dir_path(__FILE__) . 'src/Settings/Plugins.php';
     25require_once plugin_dir_path(__FILE__) . 'src/Settings/Advanced.php';
    2526require_once plugin_dir_path(__FILE__) . 'src/Plugin/AdCaptchaPlugin.php';
    2627require_once plugin_dir_path(__FILE__) . 'src/Plugin/Login.php';
     
    4344use AdCaptcha\Instantiate;
    4445
    45 const PLUGIN_VERSION_ADCAPTCHA = '1.5.2';
     46const PLUGIN_VERSION_ADCAPTCHA = '1.5.3';
    4647define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' ));
    4748
  • adcaptcha/trunk/readme.txt

    r3198102 r3198915  
    55Requires at least: 6.0
    66Tested up to: 6.5.2
    7 Stable tag: 1.5.2
     7Stable tag: 1.5.3
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    138138= 1.5.2 =
    139139- 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  
    1515        add_action( 'wp_enqueue_scripts', [ Verify::class, 'get_success_token' ] );
    1616        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        }
    1720        add_action( 'woocommerce_review_order_before_submit', [ AdCaptcha::class, 'captcha_trigger' ] );
    1821        add_action('woocommerce_payment_complete', [ $this, 'reset_hasVerified' ]);
     
    5760                $(document.body).on("updated_checkout", function () {
    5861                    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                        }});
    6076
    6177                        ' . (WC()->session->get('hasVerified') ? ' window.adcap.setVerificationState(true);' : '' ) . '
     
    6884        wp_enqueue_script('adcaptcha-wc-init-trigger');
    6985    }
     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    }
    70108}
  • adcaptcha/trunk/src/Settings/Plugins.php

    r3196276 r3198915  
    55class Plugins {
    66     
    7     public function render_Plugins_settings() {
     7    public function render_plugins_settings() {
    88        $plugins = array(
    99            array(
  • adcaptcha/trunk/src/Settings/Settings.php

    r3198102 r3198915  
    2828        $tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
    2929        $tab = isset( $tab ) ? $tab : 'general';
    30         if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins')) {
     30        if (!isset($tab) || ($tab !== 'general' && $tab !== 'plugins' && $tab !== 'advance')) {
    3131            $tab = 'general';
    3232        }
     
    4848                        ?>
    4949                    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>
    5056            </div>
    5157            <?php
     
    5763                    case 'plugins':
    5864                        $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();
    6069                        break;
    6170                }
     
    7180
    7281    public function change_admin_footer_version() {
    73         return 'Version 1.5.2';
     82        return 'Version 1.5.3';
    7483    }
    7584}
  • adcaptcha/trunk/src/styles/settings.css

    r3155182 r3198915  
    8282}
    8383
    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 {
    8595    margin-top: 20px;
    8696    margin-left: 20px;
Note: See TracChangeset for help on using the changeset viewer.