6 Commits

Author SHA1 Message Date
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
9 changed files with 78 additions and 13 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.7",
"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'],
]; ];
+32 -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.7
* @since 1.1.0 * @since 1.1.0
*/ */
@@ -135,10 +135,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;
} }
@@ -158,4 +172,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.7
* Requires at least: 6.0 * Requires at least: 6.0
* Requires PHP: 8.2 * Requires PHP: 8.2
* Author: CleverOgre * Author: CleverOgre
+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.7",
"title": "Ogre CAPTCHA", "title": "Ogre CAPTCHA",
"description": "Protect your site with CAPTCHA", "description": "Protect your site with CAPTCHA",
"author": "CleverOgre", "author": "CleverOgre",
+5 -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.7
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,10 @@ If you don't know what plugin you have downloaded, please contact [CleverOgre](t
== Changelog == == Changelog ==
= 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