MediaWiki REL1_34
|
A class to check request restrictions expressed as a JSON object. More...
Public Member Functions | |
__toString () | |
check (WebRequest $request) | |
Test against the passed WebRequest. | |
checkIP ( $ip) | |
Test if an IP address is allowed by the restrictions. | |
toArray () | |
Return the restrictions as an array. | |
toJson ( $pretty=false) | |
Return the restrictions as a JSON string. | |
Static Public Member Functions | |
static | newDefault () |
static | newFromArray (array $restrictions) |
static | newFromJson ( $json) |
Protected Member Functions | |
__construct (array $restrictions=null) | |
Private Member Functions | |
loadFromArray (array $restrictions) | |
Private Attributes | |
$ipAddresses = [ '0.0.0.0/0', '::/0' ] | |
A class to check request restrictions expressed as a JSON object.
Definition at line 26 of file MWRestrictions.php.
|
protected |
array | null | $restrictions |
InvalidArgumentException |
Definition at line 34 of file MWRestrictions.php.
References loadFromArray().
MWRestrictions::__toString | ( | ) |
Definition at line 117 of file MWRestrictions.php.
References toJson().
MWRestrictions::check | ( | WebRequest | $request | ) |
Test against the passed WebRequest.
WebRequest | $request |
Definition at line 126 of file MWRestrictions.php.
References checkIP(), and WebRequest\getIP().
MWRestrictions::checkIP | ( | $ip | ) |
Test if an IP address is allowed by the restrictions.
string | $ip |
Definition at line 140 of file MWRestrictions.php.
Referenced by check().
|
private |
|
static |
Definition at line 43 of file MWRestrictions.php.
Referenced by HTMLRestrictionsField\getDefault(), and BotPassword\newUnsaved().
|
static |
array | $restrictions |
InvalidArgumentException |
Definition at line 52 of file MWRestrictions.php.
Referenced by HTMLRestrictionsField\loadDataFromRequest().
|
static |
string | $json | JSON representation of the restrictions |
InvalidArgumentException |
Definition at line 61 of file MWRestrictions.php.
Referenced by BotPassword\__construct().
MWRestrictions::toArray | ( | ) |
Return the restrictions as an array.
Definition at line 102 of file MWRestrictions.php.
References $ipAddresses.
Referenced by toJson(), and HTMLRestrictionsField\validate().
MWRestrictions::toJson | ( | $pretty = false | ) |
Return the restrictions as a JSON string.
bool | string | $pretty | Pretty-print the JSON output, see FormatJson::encode |
Definition at line 113 of file MWRestrictions.php.
References toArray().
Referenced by __toString().
|
private |
Definition at line 28 of file MWRestrictions.php.
Referenced by toArray().