Captcha
in package
Provides functionality to use Google reCAPTCHA V3.
Tags
Table of Contents
Constants
- GOOGLE_PRIVACY_URL = 'https://policies.google.com/privacy'
- Google privacy policy URL.
- GOOGLE_TERMS_URL = 'https://policies.google.com/terms'
- Google terms of service URL.
- RECAPTCHA_NOTICE = 'recaptcha-notice.php'
- Required Google reCaptcha notice partial.
- VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'
- Google reCAPTCHA verification script URL.
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $recaptcha_notice : string
- The fully qualified path to the Google reCAPTCHA required notice.
- $secret_key : string
- Google reCAPTCHA secret key.
- $threshold : float
- Google reCAPTCHA score threshold.
Methods
- get_instance() : object
- Creates and/or returns the instance of this class.
- get_notice() : string
- Get the required reCAPTCHA notice.
- verify() : WP_Error
- Verify the reCAPTCHA response.
- __construct() : void
- Initialise the class and set its properties.
Constants
GOOGLE_PRIVACY_URL
Google privacy policy URL.
protected
string
GOOGLE_PRIVACY_URL
= 'https://policies.google.com/privacy'
Tags
GOOGLE_TERMS_URL
Google terms of service URL.
protected
string
GOOGLE_TERMS_URL
= 'https://policies.google.com/terms'
Tags
RECAPTCHA_NOTICE
Required Google reCaptcha notice partial.
protected
string
RECAPTCHA_NOTICE
= 'recaptcha-notice.php'
Tags
VERIFY_URL
Google reCAPTCHA verification script URL.
protected
string
VERIFY_URL
= 'https://www.google.com/recaptcha/api/siteverify'
Tags
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$recaptcha_notice
The fully qualified path to the Google reCAPTCHA required notice.
protected
string
$recaptcha_notice
= ''
Tags
$secret_key
Google reCAPTCHA secret key.
protected
string
$secret_key
= ''
Tags
$threshold
Google reCAPTCHA score threshold.
protected
float
$threshold
= 0.5
Tags
Methods
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
get_notice()
Get the required reCAPTCHA notice.
public
get_notice() : string
Tags
Return values
string —The required reCATCHA notice markup.
verify()
Verify the reCAPTCHA response.
public
verify(WP_Error $errors, array<string|int, string> $post_vars, array<string|int, string> $server_vars, string $data_action) : WP_Error
Parameters
- $errors : WP_Error
-
The WP_Error object to filter.
- $post_vars : array<string|int, string>
-
The sanitised $_POST arguments.
- $server_vars : array<string|int, string>
-
The sanitised $_SERVER arguments.
- $data_action : string
-
The data-action attribute sent to reCAPTCHA.
Tags
Return values
WP_Error —The maybe modified WP_Error object.
__construct()
Initialise the class and set its properties.
protected
__construct() : void