Automattic\WP\Cron_Control\REST_API::check_secret PHP Метод

check_secret() публичный Метод

Check if request is authorized
public check_secret ( $request )
    public function check_secret($request)
    {
        $body = $request->get_json_params();
        // For now, mimic original plugin's "authentication" method. This needs to be better.
        if (!isset($body['secret']) || !hash_equals(\WP_CRON_CONTROL_SECRET, $body['secret'])) {
            return new \WP_Error('no-secret', __('Secret must be specified with all requests', 'automattic-cron-control'), array('status' => 400));
        }
        return true;
    }