CreaCaptcha

List_Command
in package

Manages one list-type setting — IP block/allow list, UA block list or the interceptor path list. The same class backs the blocklist, allowlist, ua-blocklist and paths command namespaces.

Table of Contents

Properties

$key  : string
The list setting key this instance manages.
$validation  : string
Validation type: 'ip' (IP/CIDR), 'action' (action-slug charset), 'cookie' (name=value), or 'text' (plain).

Methods

__construct()  : mixed
add()  : void
Adds one or more entries to the list.
clear()  : void
Empties the list.
list_entries()  : void
Prints the current list entries.
remove()  : void
Removes one or more entries from the list.
current()  : array<int, string>
The current list value.
is_ip_or_cidr()  : bool
Whether the value is a valid IP address or CIDR range.
normalise()  : string|null
Validates and normalises one entry; returns null when invalid.
save()  : void
Writes the list back through the settings sanitiser.

Properties

$validation

Validation type: 'ip' (IP/CIDR), 'action' (action-slug charset), 'cookie' (name=value), or 'text' (plain).

private string $validation

Methods

__construct()

public __construct(string $key[, string $validation = 'text' ]) : mixed
Parameters
$key : string

The list setting key.

$validation : string = 'text'

'ip' (IP/CIDR), 'action' (action slug), 'cookie' (name=value), or 'text' (plain).

add()

Adds one or more entries to the list.

public add(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

... : One or more entries to add.

EXAMPLES

wp creacaptcha blocklist add 203.0.113.4 203.0.113.0/24
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

clear()

Empties the list.

public clear(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

[--yes] : Skip the confirmation prompt.

EXAMPLES

wp creacaptcha blocklist clear --yes
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

list_entries()

Prints the current list entries.

public list_entries(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

[--format=] : Output format (table, json, yaml, csv).

EXAMPLES

wp creacaptcha blocklist list
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

Tags
subcommand

list

remove()

Removes one or more entries from the list.

public remove(array<int, string> $args, array<string, string> $assoc_args) : void

OPTIONS

... : One or more entries to remove.

EXAMPLES

wp creacaptcha blocklist remove 203.0.113.4
Parameters
$args : array<int, string>

Positional arguments.

$assoc_args : array<string, string>

Associative arguments.

current()

The current list value.

private current() : array<int, string>
Return values
array<int, string>

is_ip_or_cidr()

Whether the value is a valid IP address or CIDR range.

private is_ip_or_cidr(string $value) : bool
Parameters
$value : string

Candidate value.

Return values
bool

normalise()

Validates and normalises one entry; returns null when invalid.

private normalise(string $raw) : string|null
Parameters
$raw : string

Raw entry value.

Return values
string|null

save()

Writes the list back through the settings sanitiser.

private save(array<int, string> $list) : void
Parameters
$list : array<int, string>

The new list.


        
On this page

Search results