Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cfdcf04
adCAPTCHA integrated to Gravity form, icon changed, submit working.
vasswann Feb 21, 2025
f3b1b0e
Fixed label, icon size, error message
vasswann Feb 21, 2025
6f88206
Updated error message label to adcaptcha from Untitled. Updated verify
vasswann Feb 24, 2025
f818a23
Remove label settings.
vasswann Feb 24, 2025
a8103a4
Stop duplicated adcaptcha on the form field is done.
vasswann Feb 25, 2025
060f87e
Updated and removed duplicated hidden field to store success token
vasswann Feb 25, 2025
7b22242
Gravity form integration done with fixed bugs
vasswann Feb 26, 2025
7d2e03c
removed error_log
vasswann Feb 26, 2025
2c32028
By default adCAPTCHA is in the form and working.
vasswann Feb 27, 2025
144140d
Forminator automatic integration is done
vasswann Mar 3, 2025
76db999
Fixed comment from PR. For readability, place functions in order.
vasswann Mar 4, 2025
755d785
PR comments updated
vasswann Mar 4, 2025
a6e821e
Forminator testing done
vasswann Mar 5, 2025
5c30db0
added empty line to the end
vasswann Mar 5, 2025
dc9a89e
Gravity form test
vasswann Mar 6, 2025
3de6bed
Test is done. Modify the WPErrorMock.php and the Gravity form
vasswann Mar 7, 2025
5293b1c
Updated GravityForm removing error handle. ALso updated test
vasswann Mar 7, 2025
2004e31
Update Field.php
vasswann Mar 10, 2025
26f4ac7
Merge pull request #80 from adcaptcha-org/ADC-745-Gravity-form-test-c…
vasswann Apr 3, 2025
c45f794
Merge pull request #79 from adcaptcha-org/ADC-749-Forminator-test-cov…
vasswann Apr 3, 2025
90702a4
Merge pull request #81 from adcaptcha-org/main
Lucasarenaterry Apr 3, 2025
f8c6098
Merge pull request #77 from adcaptcha-org/ADC-625-Wordpress-Gravity-F…
vasswann Apr 3, 2025
0ed9711
Merge branch 'develop' into ADC-742-Wordpress-Forminator-Forms
vasswann Apr 3, 2025
0fd34eb
Merge pull request #78 from adcaptcha-org/ADC-742-Wordpress-Forminato…
vasswann Apr 3, 2025
da3b93d
Update plugin Version
vasswann Apr 3, 2025
d52497f
Empty line in readme
vasswann Apr 3, 2025
8523144
Updated supported list
vasswann Apr 3, 2025
0a217a3
Update Readme file
vasswann Apr 3, 2025
33bcd36
Stable tag update
vasswann Apr 3, 2025
b30fdc5
Fixing error from conflict
vasswann Apr 3, 2025
aef9b90
Merge pull request #82 from adcaptcha-org/Update-Plugin-Version
Lucasarenaterry Apr 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@

### Fluent Forms

### Gravity Forms

### Forminator

## Advance Features

* Able to trigger adCAPTCHA on the "Place order" button.
Expand Down
4 changes: 2 additions & 2 deletions adcaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: adCAPTCHA for WordPress
* Description: Secure your site. Elevate your brand. Boost Ad Revenue.
* Version: 1.6.0
* Version: 1.7.0
* Requires at least: 6.4.2
* Requires PHP: 7.4
* Author: adCAPTCHA
Expand All @@ -21,7 +21,7 @@

use AdCaptcha\Instantiate;

const PLUGIN_VERSION_ADCAPTCHA = '1.6.0';
const PLUGIN_VERSION_ADCAPTCHA = '1.7.0';
define('ADCAPTCHA_ERROR_MESSAGE', __( 'Please complete the I am human box.', 'adcaptcha' ));

if ( ! function_exists( 'adcaptcha_uninstall' ) ) {
Expand Down
Binary file added assets/adcaptcha_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/forminator.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/gravity-forms_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: adCAPTCHA
Tags: spam, anti-spam, block bots, security, adCAPTCHA
Requires at least: 6.0
Tested up to: 6.5.2
Stable tag: 1.6.0
Stable tag: 1.7.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -46,6 +46,10 @@ adCAPTCHA offers a unique proposition in the digital space by combining Security

**Fluent Forms**

**Gravity Forms**

**Forminator**

== Advance Features ==

**Woocommerce**
Expand Down Expand Up @@ -157,3 +161,6 @@ During verification, the adCAPTCHA service may briefly receive the user's IP add

= 1.6.0 =
- Added feature to disable the WooCommerce checkout endpoint.

= 1.7.0 =
- Feature: Added support for Gravity Forms and Forminator.
11 changes: 11 additions & 0 deletions src/Instantiate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use AdCaptcha\Plugin\WPForms\Forms as WPForms;
use AdCaptcha\Plugin\Elementor\Forms as Elementor;
use AdCaptcha\Plugin\FluentForms\Forms as FluentForms;
use AdCaptcha\Plugin\Forminator\Forms as Forminator;
use AdCaptcha\Plugin\GravityForms\Forms as GravityForms;

class Instantiate {

Expand Down Expand Up @@ -83,6 +85,15 @@ public function setup() {
'instance' => FluentForms::class,
'plugin' => [ 'fluentform/fluentform.php' ],
],

'Forminator_Forms' => [
'instance' => Forminator::class,
'plugin' => [ 'forminator/forminator.php' ],
],
'GravityForms_Forms' => [
'instance' => GravityForms::class,
'plugin' => [ 'gravityforms/gravityforms.php' ]
]
];

$selected_plugins = get_option('adcaptcha_selected_plugins') ? get_option('adcaptcha_selected_plugins') : array();
Expand Down
85 changes: 85 additions & 0 deletions src/Plugin/Forminator/Forms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace AdCaptcha\Plugin\Forminator;

use AdCaptcha\Widget\AdCaptcha;
use AdCaptcha\Widget\Verify;
use AdCaptcha\Plugin\AdCaptchaPlugin;

class Forms extends AdCaptchaPlugin {
private $verify;
private $has_captcha = false;

public function __construct() {
parent::__construct();
$this->verify = new Verify();
}

public function setup() {
add_action('forminator_before_form_render', [$this, 'before_form_render'], 10, 5);
add_action('forminator_before_form_render', [AdCaptcha::class, 'enqueue_scripts'], 9);
add_action('forminator_before_form_render', [Verify::class, 'get_success_token'], 9);
add_filter('forminator_render_button_markup', [$this, 'captcha_trigger_filter'], 10, 2);
add_action( 'wp_enqueue_scripts', [ $this, 'reset_captcha_script' ], 9 );
add_filter('forminator_cform_form_is_submittable', [$this, 'verify'], 10, 3);
}

public function before_form_render($id, $form_type, $post_id, $form_fields, $form_settings) {
$this->has_captcha = $this->has_adcaptcha_field($form_fields);
}

private function has_adcaptcha_field($form_fields) {
foreach ($form_fields as $field) {
if (!empty($field['type']) && $field['type'] === 'captcha' && !empty($field['captcha_provider']) && $field['captcha_provider'] === 'adcaptcha') {
return true;
}
}
return false;
}

public function captcha_trigger_filter($html, string $button) {
if ($this->has_captcha) {
return $html;
}
return AdCaptcha::ob_captcha_trigger() . $html;
}


public function reset_captcha_script() {
add_action('wp_footer', function() {
echo "<script>
(function checkJQuery() {
if (typeof jQuery === 'undefined') {
setTimeout(checkJQuery, 100);
return;
}
jQuery(document).on('after:forminator:form:submit', function() {
if (window.adcap && typeof window.adcap.reset === 'function') {
window.adcap.reset();
window.adcap.successToken = '';
jQuery('[name=\"adcaptcha_successToken\"]').val('');
}
});
})();
</script>";
});
}

public function verify($can_show, $form_id, $field_data_array) {
$successToken = sanitize_text_field(wp_unslash($_POST['adcaptcha_successToken'] ?? ''));
if (empty($successToken)) {
return [
'can_submit' => false,
'error' => __('Please complete the AdCaptcha verification.', 'adcaptcha'),
];
}
$response = $this->verify->verify_token($successToken);
if (!$response) {
return [
'can_submit' => false,
'error' => __('AdCaptcha verification failed. Please try again.', 'adcaptcha'),
];
}
return $can_show;
}
}
Loading