9 Commits

Author SHA1 Message Date
ogrecooper 514b5ca03b Merge pull request 'Disable captcha on nested forms' (#11) from nested-forms into main
Reviewed-on: #11
2026-08-19 17:29:30 +00:00
Cooper Dalrymple 714af0515a Push version to 1.2.8 2026-08-19 12:28:58 -05:00
Cooper Dalrymple b3bc2f2772 Disable captcha on nested forms 2026-08-19 12:28:56 -05:00
ogrecooper e3b14cd625 Merge pull request 'Remove duplicate settings action link' (#10) from duplicate-settings-link into main
Reviewed-on: #10
2026-08-14 15:06:37 +00:00
Cooper Dalrymple 4b07e946f3 Update changelog 2026-08-14 10:06:22 -05:00
Cooper Dalrymple fd06317b1d Push to version 1.2.7 2026-08-14 10:03:33 -05:00
Cooper Dalrymple 406eb625a9 Add GF section to settings page 2026-08-14 10:03:27 -05:00
Cooper Dalrymple 05f6bc1b4b Remove GFAddOn plugin action link 2026-08-14 09:45:32 -05:00
Cooper Dalrymple e5da11e5f2 Generate ids for form locations 2026-08-03 17:14:17 -05:00
10 changed files with 97 additions and 15 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://getcomposer.org/schema.json", "$schema": "https://getcomposer.org/schema.json",
"name": "cleverogre/ogre-captcha", "name": "cleverogre/ogre-captcha",
"version": "1.2.6", "version": "1.2.8",
"title": "Ogre CAPTCHA", "title": "Ogre CAPTCHA",
"description": "Protect your site with CAPTCHA", "description": "Protect your site with CAPTCHA",
"author": "CleverOgre", "author": "CleverOgre",
+16 -2
View File
@@ -47,8 +47,17 @@ abstract class Location {
abstract public function activate():void; abstract public function activate():void;
protected function get_widget_id(): string {
return sprintf(
'cap-%s',
$this->name
);
}
public function render():void { public function render():void {
Widget::render(); Widget::render([
'id' => $this->get_widget_id(),
]);
} }
public function process(WP_Error|null $errors = null):void { public function process(WP_Error|null $errors = null):void {
@@ -78,7 +87,12 @@ abstract class Location {
public function footer():void { public function footer():void {
if (!Settings::is_widget_floating()) return; if (!Settings::is_widget_floating()) return;
$html = ob_get_clean(); $html = ob_get_clean();
$html = Widget::set_button_floating($html); $html = Widget::set_button_floating(
$html,
[
'id' => $this->get_widget_id(),
]
);
echo $html; echo $html;
} }
+17 -1
View File
@@ -4,7 +4,7 @@
* @author cleverogre * @author cleverogre
* @copyright 2026 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.2.5 * @version 1.2.7
* @since 1.0.0 * @since 1.0.0
*/ */
@@ -12,6 +12,7 @@ namespace Ogre\Captcha;
use Ogre\Singleton; use Ogre\Singleton;
use Ogre\Captcha as Plugin; use Ogre\Captcha as Plugin;
use Ogre\Captcha\GravityForms\Addon;
defined('ABSPATH') || exit; defined('ABSPATH') || exit;
@@ -378,6 +379,21 @@ final class Settings {
] ]
); );
if (Plugin::is_gravityforms_active() && class_exists('Ogre\Captcha\GravityForms\Addon')) {
add_settings_section(
'gravityforms',
Plugin::__('Gravity Forms'),
[$this, 'section'],
Plugin::get_id(),
[
'description' => sprintf(
Plugin::__('The configuration of Ogre CAPTCHA\'s Gravityforms integration can be found on <a href="%s">this page</a> and within the settings of each form.'),
esc_url(Addon::get_instance()->get_url())
),
]
);
}
} }
+1 -1
View File
@@ -97,7 +97,7 @@ final class Widget {
); );
$attributes = [ $attributes = [
'data-cap-floating' => "#{$args['id']}", 'data-cap-floating' => '#' . $args['id'],
'data-cap-floating-position' => $args['position'], 'data-cap-floating-position' => $args['position'],
]; ];
+46 -3
View File
@@ -4,7 +4,7 @@
* @author cleverogre * @author cleverogre
* @copyright 2026 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.2.1 * @version 1.2.8
* @since 1.1.0 * @since 1.1.0
*/ */
@@ -116,9 +116,19 @@ final class Addon extends GFAddOn {
} }
public function is_enabled(array|null $form = null): bool { public function is_enabled(array|null $form = null): bool {
// Check to make sure that we're enabled on the plugin level first
$plugin_enabled = $this->get_plugin_setting('enabled') === '1'; $plugin_enabled = $this->get_plugin_setting('enabled') === '1';
if (is_null($form) || !$plugin_enabled) return $plugin_enabled; if (is_null($form) || !$plugin_enabled) return $plugin_enabled;
$form_id = !is_null($form) ? absint(rgar($form, 'id')) : 0;
// If Gravity Perks Nested Forms is active and the current form is nested, disable entirely (it's not compatible at the moment)
if (class_exists('GP_Nested_Forms')) {
$gp_nested_forms = GP_Nested_Forms::get_instance();
if ($gp_nested_forms->is_nested_form_submission() && $gp_nested_forms->get_parent_form_id() !== $form_id) return false;
}
// Now check to see if the opt-out is enabled within the form settings
$form_settings = $this->get_form_settings($form); $form_settings = $this->get_form_settings($form);
$form_disabled = (bool) rgar($form_settings, 'disabled'); $form_disabled = (bool) rgar($form_settings, 'disabled');
return !$form_disabled; return !$form_disabled;
@@ -135,10 +145,24 @@ final class Addon extends GFAddOn {
if (!Settings::is_connected() || !$this->is_enabled($form)) return $button_input; if (!Settings::is_connected() || !$this->is_enabled($form)) return $button_input;
if ((is_admin() && !defined('DOING_AJAX')) || GFCommon::is_form_editor()) return $button_input; if ((is_admin() && !defined('DOING_AJAX')) || GFCommon::is_form_editor()) return $button_input;
$id = sprintf(
'gform_cap_%d',
absint(rgar($form, 'id'))
);
ob_start(); ob_start();
Widget::render(); Widget::render([
'id' => $id,
]);
$button_input = ob_get_clean() . $button_input; $button_input = ob_get_clean() . $button_input;
if (Settings::is_widget_floating()) $button_input = Widget::set_button_floating($button_input); if (Settings::is_widget_floating()) {
$button_input = Widget::set_button_floating(
$button_input,
[
'id' => $id,
]
);
}
return $button_input; return $button_input;
} }
@@ -146,7 +170,11 @@ final class Addon extends GFAddOn {
if ($context != 'form-submit') return $validation_result; if ($context != 'form-submit') return $validation_result;
$form = $validation_result['form']; $form = $validation_result['form'];
// Make sure that we are actually processing the end of the form
if (!GFFormDisplay::is_last_page($form) || rgpost('action') == 'heartbeat') return $validation_result; if (!GFFormDisplay::is_last_page($form) || rgpost('action') == 'heartbeat') return $validation_result;
// Make sure that we are connected and enabled
if (!Settings::is_connected() || !$this->is_enabled($form)) return $validation_result; if (!Settings::is_connected() || !$this->is_enabled($form)) return $validation_result;
$errors = API::process(Widget::get_token()); $errors = API::process(Widget::get_token());
@@ -158,4 +186,19 @@ final class Addon extends GFAddOn {
return $validation_result; return $validation_result;
} }
public function plugin_settings_link( $links, $file ) {
// Remove plugin action link
return $links;
}
public function get_url(): string {
return add_query_arg(
[
'page' => 'gf_settings',
'subview' => $this->get_slug()
],
admin_url('admin.php')
);
}
} }
+3 -1
View File
@@ -42,7 +42,9 @@ final class LoginForm extends Location {
$content .= ob_get_clean(); $content .= ob_get_clean();
if (Settings::is_widget_floating()) { if (Settings::is_widget_floating()) {
Widget::add_dynamic_floating_attributes(); Widget::add_dynamic_floating_attributes([
'id' => $this->get_widget_id(),
]);
} }
return $content; return $content;
+2 -2
View File
@@ -6,14 +6,14 @@
* @author cleverogre * @author cleverogre
* @copyright 2026 CleverOgre * @copyright 2026 CleverOgre
* @license GLP-3.0-or-later * @license GLP-3.0-or-later
* @version 1.2.6 * @version 1.2.7
* @since 1.0.0 * @since 1.0.0
* *
* @wordpress-plugin * @wordpress-plugin
* Plugin Name: Ogre CAPTCHA * Plugin Name: Ogre CAPTCHA
* Plugin URI: https://git.cleverogre.com/cleverogre/ogre-captcha/ * Plugin URI: https://git.cleverogre.com/cleverogre/ogre-captcha/
* Description: Protect your site with CAPTCHA * Description: Protect your site with CAPTCHA
* Version: 1.2.6 * Version: 1.2.8
* Requires at least: 6.0 * Requires at least: 6.0
* Requires PHP: 8.2 * Requires PHP: 8.2
* Author: CleverOgre * Author: CleverOgre
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "cleverogre/ogre-captcha", "name": "cleverogre/ogre-captcha",
"version": "1.2.6", "version": "1.2.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cleverogre/ogre-captcha", "name": "cleverogre/ogre-captcha",
"version": "1.2.6", "version": "1.2.7",
"license": "GPL-3.0+", "license": "GPL-3.0+",
"devDependencies": { "devDependencies": {
"gulp": "^5.0.0", "gulp": "^5.0.0",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://www.schemastore.org/package.json", "$schema": "https://www.schemastore.org/package.json",
"name": "cleverogre/ogre-captcha", "name": "cleverogre/ogre-captcha",
"version": "1.2.6", "version": "1.2.8",
"title": "Ogre CAPTCHA", "title": "Ogre CAPTCHA",
"description": "Protect your site with CAPTCHA", "description": "Protect your site with CAPTCHA",
"author": "CleverOgre", "author": "CleverOgre",
+8 -1
View File
@@ -3,7 +3,7 @@ Contributors: ogrecooper, cleverogre
Tested up to: 7.0 Tested up to: 7.0
Requires at least: 6.0 Requires at least: 6.0
Requires PHP: 8.2 Requires PHP: 8.2
Version: 1.2.6 Version: 1.2.8
License: GPLv3 or later License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html License URI: https://www.gnu.org/licenses/gpl-3.0.html
Copyright: CleverOgre Copyright: CleverOgre
@@ -28,6 +28,13 @@ If you don't know what plugin you have downloaded, please contact [CleverOgre](t
== Changelog == == Changelog ==
= 1.2.8 - 2026-08-19 =
* Fix compatibility issue with Gravity Perks Nested Forms
= 1.2.7 - 2026-08-14 =
* Remove duplicate settings link
* Add Gravity Forms section to settings page
= 1.2.6 - 2026-07-15 = = 1.2.6 - 2026-07-15 =
* Fix bug with lost password reset when using AIOWPS * Fix bug with lost password reset when using AIOWPS