| 1 |
<?php |
| 2 |
|
| 3 |
namespace AgeGate\Legacy; |
| 4 |
|
| 5 |
use AgeGate\Common\Settings; |
| 6 |
use AgeGate\Common\Form\Submit; |
| 7 |
|
| 8 |
|
| 9 |
class Check |
| 10 |
{ |
| 11 |
private $settings; |
| 12 |
|
| 13 |
public function __construct() |
| 14 |
{ |
| 15 |
add_action('init', function() { |
| 16 |
$this->settings = Settings::getInstance(); |
| 17 |
|
| 18 |
if (!$this->settings->disableAjaxFallback) { |
| 19 |
add_action('wp_ajax_ag_check', [$this, 'check']); |
| 20 |
add_action('wp_ajax_nopriv_ag_check', [$this, 'check']); |
| 21 |
} |
| 22 |
}); |
| 23 |
} |
| 24 |
|
| 25 |
public function check() |
| 26 |
{ |
| 27 |
// Nonce verification is not viable with caching plugins |
| 28 |
wp_send_json((new Submit($_POST, $this->settings))->validate()); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 29 |
wp_die(); |
| 30 |
} |
| 31 |
} |
| 32 |
|