Add floating mode support
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user