Documentation

Verifier
in package
implements ArrayAccess uses ArrayAccessHelper

Sets up the anti-spam control that tries to verify the user's humanity.

Supports old-fashioned CAPTCHA, reCAPTCHA, and verification questions.

Table of Contents

Interfaces

ArrayAccess

Constants

MAX_ATTEMPTS  = 3

Properties

$can_recaptcha  : bool
$empty_field  : bool
$errors  : array<string|int, mixed>
$id  : string
$image_href  : string
$loaded  : array<string|int, mixed>
$max_errors  : int
$number_questions  : int
$override_range  : string
$questions  : array<string|int, mixed>
$recaptcha_site_key  : string
$recaptcha_theme  : string
$result  : bool
$show_visual  : bool
$text_value  : string
$tracking  : int
$vid  : string
$question_ids  : array<string|int, mixed>

Methods

__construct()  : bool|array<string|int, mixed>
Constructor.
create()  : bool|array<string|int, mixed>
Static wrapper for constructor that returns result (or error indicators).
offsetExists()  : bool
Checks whether a property has been set when object is accessed as an array.
offsetGet()  : mixed
Gets properties when object is accessed as an array.
offsetSet()  : void
Sets properties when object is accessed as an array.
offsetUnset()  : void
Unsets properties when object is accessed as an array.
addCaptchaJavaScript()  : void
Adds JavaScript for the visual captcha.
init()  : void
Initializes some required template stuff.
loadQuestionCache()  : void
Loads the cache of verification questions and answers.
refresh()  : void
Refresh this verification.
sanitizeReCaptcha()  : void
Sanitizes ReCaptcha fields.
setQuestions()  : void
Sets the verification questions and answers for this instance.
shouldRefresh()  : bool
Do we need to refresh this verification?
test()  : void

Constants

MAX_ATTEMPTS

public mixed MAX_ATTEMPTS = 3

Properties

$can_recaptcha

public bool $can_recaptcha

$errors

public array<string|int, mixed> $errors = []

Error messages about any problems encountered during setup.

$id

public string $id

This editor's ID string.

$loaded

public static array<string|int, mixed> $loaded = []

All loaded instances of this class.

$number_questions

public int $number_questions

$override_range

public string $override_range

$questions

public array<string|int, mixed> $questions

$recaptcha_site_key

public string $recaptcha_site_key = ''

$recaptcha_theme

public string $recaptcha_theme = 'light'

$result

public bool $result = true

Whether there is anything to show. Assume true until proven otherwise.

$vid

public static string $vid = ''

ID of the most recently loaded instance of this class.

Normally this is the one that we want to show.

$question_ids

protected array<string|int, mixed> $question_ids

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $options[, bool $do_test = false ]) : bool|array<string|int, mixed>
Parameters
$options : array<string|int, mixed>

Options for the verification control.

$do_test : bool = false

Whether to check to see if the user entered the code correctly.

Tags
todo

BEFORE COMMITTING: Can't return errors from constructor.

Return values
bool|array<string|int, mixed>

False if there's nothing to show, true if everything went well or an array containing error indicators if the test failed.

create()

Static wrapper for constructor that returns result (or error indicators).

public static create(array<string|int, mixed> &$options[, bool $do_test = false ]) : bool|array<string|int, mixed>
Parameters
$options : array<string|int, mixed>

Options for the verification control.

$do_test : bool = false

Whether to check to see if the user entered the code correctly.

Return values
bool|array<string|int, mixed>

False if there's nothing to show, true if everything went well, or an array containing error indicators if the test failed.

offsetExists()

Checks whether a property has been set when object is accessed as an array.

public offsetExists(mixed $prop) : bool
Parameters
$prop : mixed

The property name.

Return values
bool

offsetGet()

Gets properties when object is accessed as an array.

public & offsetGet(mixed $prop) : mixed
Parameters
$prop : mixed

The property name.

Return values
mixed

A reference to the property.

offsetSet()

Sets properties when object is accessed as an array.

public offsetSet(mixed $prop, mixed $value) : void
Parameters
$prop : mixed

The property name.

$value : mixed

The value to set.

offsetUnset()

Unsets properties when object is accessed as an array.

public offsetUnset(mixed $prop) : void
Parameters
$prop : mixed

The property name.

addCaptchaJavaScript()

Adds JavaScript for the visual captcha.

protected addCaptchaJavaScript() : void

init()

Initializes some required template stuff.

protected init() : void

loadQuestionCache()

Loads the cache of verification questions and answers.

protected loadQuestionCache() : void

refresh()

Refresh this verification.

protected refresh() : void

sanitizeReCaptcha()

Sanitizes ReCaptcha fields.

protected sanitizeReCaptcha() : void

setQuestions()

Sets the verification questions and answers for this instance.

protected setQuestions() : void

shouldRefresh()

Do we need to refresh this verification?

protected shouldRefresh(bool $only_if_necessary, bool $do_test) : bool
Parameters
$only_if_necessary : bool

If true, only refresh if we absolutely must.

$do_test : bool

Whether we are checking their answers.

Return values
bool

Whether we should refresh this verification.


        
On this page

Search results