Add floating mode support

This commit is contained in:
Cooper Dalrymple
2026-06-09 12:53:19 -05:00
parent 401676e7f3
commit 6a6e8f3960
15 changed files with 341 additions and 22 deletions
+9
View File
@@ -13,6 +13,7 @@ namespace Ogre\Captcha\Location;
use Override;
use Ogre\Captcha\Location;
use Ogre\Captcha\Settings;
use Ogre\Captcha\Widget;
use WP_Error;
defined('ABSPATH') || exit;
@@ -27,8 +28,16 @@ final class CommentForm extends Location {
public function activate(): void
{
add_action('comment_form_after_fields', [$this, 'render'], 1);
add_filter('comment_form_submit_button', [$this, 'submit_button'], 10, 2);
add_filter('preprocess_comment', [$this, 'process_form']);
}
public function submit_button(string $submit_button, array $args):string {
if (Settings::is_widget_floating()) {
$submit_button = Widget::set_button_floating($submit_button);
}
return $submit_button;
}
public function process_form(array $commentdata):array {
// Don't process CAPTCHA for comment replies inside admin menu