class turnstile extends base

Constants

private SCRIPT_URL

private VERIFY_ENDPOINT

Properties

protected config $config from  base
protected driver_interface $db from  base
protected language $language
protected request_interface $request from  base
protected user $user from  base
protected int $attempts from  base
protected string $code from  base
protected bool $solved from  base
protected string $confirm_code from  base
protected string $confirm_id from  base
protected confirm_type $type from  base
protected string $last_error from  base
protected Client $client
protected log_interface $log
protected template $template
protected string $service_name
static protected array|string[] $supported_themes

Methods

__construct(config $config, driver_interface $db, language $language, log_interface $log, request_interface $request, template $template, user $user)

Constructor for turnstile captcha plugin

void
init(confirm_type $type)

Display the captcha for the specified type

bool
validate()

Validate the captcha with the given request data

void
reset()

Reset captcha state, e.g. after checking if it's valid

from  base
int
get_attempt_count()

Get attempt count for this captcha and user

from  base
bool
load_confirm_data()

Look up attempts from confirm table

from  base
void
generate_confirm_data()

Generate confirm data for tracking attempts

from  base
void
increment_attempts()

Increment number of attempts for confirm ID and session

from  base
array
get_hidden_fields()

Get hidden form fields for this captcha plugin

from  base
bool
is_solved()

Return whether captcha was solved

from  base
string
get_error()

Get error string from captcha

from  base
void
garbage_collect(confirm_type $confirm_type = confirm_type::UNDEFINED)

No description

from  base
void
acp_page(mixed $id, mixed $module)

Display acp page

bool
is_available()

Check if the plugin is available

bool
has_config()

Check if the plugin has a configuration

string
get_name()

Get the name of the plugin, should be language variable

void
set_name(string $name)

Set the service name of the plugin

Client
get_client()

Get Guzzle client

string
get_template()

Get template filename for captcha

string
get_demo_template()

Get template filename for demo

Details

at line 67
__construct(config $config, driver_interface $db, language $language, log_interface $log, request_interface $request, template $template, user $user)

Constructor for turnstile captcha plugin

Parameters

config $config
driver_interface $db
language $language
log_interface $log
request_interface $request
template $template
user $user

at line 114
void init(confirm_type $type)

Display the captcha for the specified type

Parameters

confirm_type $type

Type of captcha, should be one of the CONFIRMATION_* constants

Return Value

void

at line 124
bool validate()

Validate the captcha with the given request data

Return Value

bool

True if request data was valid captcha reply, false if not

in base at line 113
void reset()

Reset captcha state, e.g. after checking if it's valid

Return Value

void

in base at line 126
int get_attempt_count()

Get attempt count for this captcha and user

Return Value

int

Number of attempts

in base at line 134
protected bool load_confirm_data()

Look up attempts from confirm table

Return Value

bool

in base at line 161
protected void generate_confirm_data()

Generate confirm data for tracking attempts

Return Value

void

in base at line 181
protected void increment_attempts()

Increment number of attempts for confirm ID and session

Return Value

void

in base at line 195
array get_hidden_fields()

Get hidden form fields for this captcha plugin

Return Value

array

Hidden form fields

in base at line 206
bool is_solved()

Return whether captcha was solved

Return Value

bool

True if captcha was solved, false if not

in base at line 214
string get_error()

Get error string from captcha

Return Value

string

Error string, empty string if there is no error

in base at line 222
void garbage_collect(confirm_type $confirm_type = confirm_type::UNDEFINED)

No description

Parameters

confirm_type $confirm_type

Confirm type to garbage collect, defaults to all (0)

Return Value

void

at line 231
void acp_page(mixed $id, mixed $module)

Display acp page

Parameters

mixed $id

ACP module id

mixed $module

ACP module name

Return Value

void

at line 79
bool is_available()

Check if the plugin is available

Return Value

bool

True if the plugin is available, false if not

at line 90
bool has_config()

Check if the plugin has a configuration

Return Value

bool

True if the plugin has a configuration, false if not

at line 98
string get_name()

Get the name of the plugin, should be language variable

Return Value

string

at line 106
void set_name(string $name)

Set the service name of the plugin

Parameters

string $name

Return Value

void

at line 184
protected Client get_client()

Get Guzzle client

Return Value

Client

at line 197
string get_template()

Get template filename for captcha

Return Value

string

Template file name

at line 218
string get_demo_template()

Get template filename for demo

Return Value

string

Demo template file name