# age-gate/3.7.3/src/Legacy/Check.php

Age Gate, version 3.7.3. 32 lines.

- Page: https://pluginprobe.com/plugins/age-gate/3.7.3/code/src/Legacy/Check.php
- Raw: https://pluginprobe.com/plugins/age-gate/3.7.3/raw/src/Legacy/Check.php
- Modified: 2025-03-27T08:14:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/age-gate/3.7.3/code/src/Legacy/Check.php#L10-L20`.

```php
<?php

namespace AgeGate\Legacy;

use AgeGate\Common\Settings;
use AgeGate\Common\Form\Submit;


class Check
{
    private $settings;

    public function __construct()
    {
        add_action('init', function() {
            $this->settings = Settings::getInstance();

            if (!$this->settings->disableAjaxFallback) {
                add_action('wp_ajax_ag_check', [$this, 'check']);
                add_action('wp_ajax_nopriv_ag_check', [$this, 'check']);
            }
        });
    }

    public function check()
    {
        // Nonce verification is not viable with caching plugins
        wp_send_json((new Submit($_POST, $this->settings))->validate()); // phpcs:ignore WordPress.Security.NonceVerification.Missing
        wp_die();
    }
}

```
