3 Commits

Author SHA1 Message Date
Cooper Dalrymple 1cae0e1310 Update to version 1.2.2 2026-06-11 13:36:35 -05:00
Cooper Dalrymple e0ef6dd34d Prevent double loading 2026-06-09 17:34:39 -05:00
Cooper Dalrymple 47ca0903b1 Fix cli args 2026-06-09 17:34:31 -05:00
5 changed files with 86 additions and 77 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.1", "version": "1.2.2",
"title": "Ogre CAPTCHA", "title": "Ogre CAPTCHA",
"description": "Protect your site with CAPTCHA", "description": "Protect your site with CAPTCHA",
"author": "CleverOgre", "author": "CleverOgre",
+2 -1
View File
@@ -110,7 +110,8 @@ final class CLI {
*/ */
public function form(array $args, array $assoc_args):void { public function form(array $args, array $assoc_args):void {
list($locations) = $args; list($locations) = $args;
extract($assoc_args); $all = $assoc_args['all'] ?? false;
$disable = $assoc_args['disable'] ?? false;
if (empty($locations) && !$all) { if (empty($locations) && !$all) {
WP_CLI::error('Please specify one or more form locations, or use --all.'); WP_CLI::error('Please specify one or more form locations, or use --all.');
+77 -73
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.1 * @version 1.2.2
* @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.1 * Version: 1.2.2
* Requires at least: 6.0 * Requires at least: 6.0
* Requires PHP: 8.2 * Requires PHP: 8.2
* Author: CleverOgre * Author: CleverOgre
@@ -41,83 +41,87 @@ defined('ABSPATH') || exit;
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
final class Captcha extends Plugin { if (!class_exists('Ogre\Captcha')) {
public static function is_woocommerce_active():bool { final class Captcha extends Plugin {
return is_plugin_active('woocommerce/woocommerce.php');
}
public static function is_gravityforms_active():bool { public static function is_woocommerce_active():bool {
return is_plugin_active('gravityforms/gravityforms.php'); return is_plugin_active('woocommerce/woocommerce.php');
}
protected function __construct() {
parent::__construct();
$this->add_files([
'inc/class-settings.php',
'inc/class-api.php',
'inc/class-widget.php',
'inc/abstract-location.php',
'inc/location/class-comment-form.php',
'inc/location/class-login-form.php',
'inc/location/class-login-page.php',
'inc/location/class-lost-password-form.php',
'inc/location/class-post-password-form.php',
'inc/location/class-registration-page.php',
]);
if (class_exists('WP_CLI')) {
$this->add_file('inc/class-cli.php');
} }
}
#[Override] public static function is_gravityforms_active():bool {
protected function enable():void { return is_plugin_active('gravityforms/gravityforms.php');
parent::enable();
add_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
add_action('plugins_loaded', [$this, 'load_woocommerce'], 2, 0);
add_action('gform_loaded', [$this, 'load_gravityforms'], 5, 0);
}
#[Override]
protected function disable():void {
parent::disable();
remove_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
remove_action('plugins_loaded', [$this, 'load_woocommerce'], 2);
remove_action('gform_loaded', [$this, 'load_gravityforms'], 5);
}
public function action_links(array $links):array {
if (current_user_can('manage_options')) {
array_unshift($links, sprintf(
'<a href="%s">%s</a>',
esc_url(Settings::get_url()),
esc_html(self::__('Settings'))
));
} }
return $links;
protected function __construct() {
parent::__construct();
$this->add_files([
'inc/class-settings.php',
'inc/class-api.php',
'inc/class-widget.php',
'inc/abstract-location.php',
'inc/location/class-comment-form.php',
'inc/location/class-login-form.php',
'inc/location/class-login-page.php',
'inc/location/class-lost-password-form.php',
'inc/location/class-post-password-form.php',
'inc/location/class-registration-page.php',
]);
if (class_exists('WP_CLI')) {
$this->add_file('inc/class-cli.php');
}
}
#[Override]
protected function enable():void {
parent::enable();
add_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
add_action('plugins_loaded', [$this, 'load_woocommerce'], 2, 0);
add_action('gform_loaded', [$this, 'load_gravityforms'], 5, 0);
}
#[Override]
protected function disable():void {
parent::disable();
remove_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
remove_action('plugins_loaded', [$this, 'load_woocommerce'], 2);
remove_action('gform_loaded', [$this, 'load_gravityforms'], 5);
}
public function action_links(array $links):array {
if (current_user_can('manage_options')) {
array_unshift($links, sprintf(
'<a href="%s">%s</a>',
esc_url(Settings::get_url()),
esc_html(self::__('Settings'))
));
}
return $links;
}
public function load_woocommerce():void {
if (!self::is_woocommerce_active()) return;
$this->add_files([
'inc/location/woocommerce/class-checkout.php',
'inc/location/woocommerce/class-login.php',
'inc/location/woocommerce/class-lost-password.php',
'inc/location/woocommerce/class-register.php',
]);
}
public function load_gravityforms():void {
if (!self::is_gravityforms_active() || !method_exists('GFForms', 'include_addon_framework')) return;
require_once('inc/gravityforms/class-addon.php');
GFAddOn::register(Addon::class);
}
} }
public function load_woocommerce():void { Captcha::instance();
if (!self::is_woocommerce_active()) return;
$this->add_files([
'inc/location/woocommerce/class-checkout.php',
'inc/location/woocommerce/class-login.php',
'inc/location/woocommerce/class-lost-password.php',
'inc/location/woocommerce/class-register.php',
]);
}
public function load_gravityforms():void {
if (!self::is_gravityforms_active() || !method_exists('GFForms', 'include_addon_framework')) return;
require_once('inc/gravityforms/class-addon.php');
GFAddOn::register(Addon::class);
}
} }
Captcha::instance();
+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.1", "version": "1.2.2",
"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.1 Version: 1.2.2
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.2 - 2026-06-11 =
* Prevent main class loading bug
* Fix WP CLI associative arguments
= 1.2.1 - 2026-06-09 = = 1.2.1 - 2026-06-09 =
* Added WP CLI commands to modify settings * Added WP CLI commands to modify settings