security_ra_extension
extends abstract_extension
in package
Extension: Risk Assessment - {eac}Doojigger for WordPress
Tags
Table of Contents
- ALIAS = 'risk_assessment'
- ALLOW_ADMIN = 0b1
- ALLOW_ALL = self::ALLOW_ADMIN | self::ALLOW_NETWORK | self::ALLOW_CRON | self::ALLOW_CLI
- ALLOW_CLI = 0b10000
- ALLOW_CRON = 0b1000
- ALLOW_NETWORK = 0b100
- ALLOW_NON_PHP = 0b100000
- DEFAULT_DISABLED = 0b1000000
- ENABLE_OPTION = ['label' => "<abbr title='Risk Assessment uses internal risk filters and optional RA provider extensions to obtain a risk level (0-100) based on IP address.'>Risk Assessment</abbr>", 'help' => "If more than one <abbr title='Risk Assessment'>RA</abbr> extension is enabled, each will be used, according to the 'Multiple RA Providers' setting, until a risk level is obtained."]
- IP_BLOCK_LIST = ABSPATH . "ip_block_list.conf"
- ONLY_ADMIN = 0b10
- RISK_TYPES = ['fraud' => 1.5, 'threat' => 1.25, 'abuse' => 1.0, 'risk' => 0.75, 'none' => 0]
- TAB_NAME = 'Security'
- VERSION = '24.1122.1'
- __call() : mixed
- magic method to call plugin or extension methods
- __construct() : void
- constructor method
- __destruct() : void
- Extension destructor
- __get() : mixed
- magic method to call parent plugin __get()
- addActionsAndFilters() : void
- Add filters and actions - called from main plugin
- addShortcodes() : void
- Add extension shortcodes
- admin_options_help() : void
- Add help tab on admin page
- admin_options_settings() : void
- register options on options_settings_page
- check_for_blocks() : void
- Check http header and blocked IP addresses
- clear_risk_action() : mixed
- clear/delete the risk report transient
- getAlias() : const
- get the extension alias
- getClassName() : bool
- getClassName - get the class/extension name without namespace
- getVersion() : const
- get the extension version
- initialize() : void
- initialize method - called from main plugin
- is_network_enabled() : bool
- is_network_enabled - set or test extension enabled for use at the network level
- is_network_option() : bool|mixed
- is this class network enabled and does option match a value
- isEnabled() : bool
- isEnabled - set or test extension enabled for use
- isIpIgnored() : bool
- Check an IP address is in ignored list
- output_ip_file() : mixed
- Output to ip block file
- register_risk_action() : mixed
- Log the risk request via action (used in security extension) action {pluginName}_register_[fraud|threat|abuse|risk]
- register_risk_api() : void
- Register a WP REST api
- register_risk_permission() : void
- Authenticate a WP REST api
- register_risk_request() : mixed
- Log the risk request via api
- risk_assessment_result() : mixed
- get the risk assessment result
Constants
ALIAS
public
string
ALIAS
= 'risk_assessment'
alias
ALLOW_ADMIN
public
constructor
ALLOW_ADMIN
= 0b1
flags (actual values subject to change)
ALLOW_ALL
public
mixed
ALLOW_ALL
= self::ALLOW_ADMIN | self::ALLOW_NETWORK | self::ALLOW_CRON | self::ALLOW_CLI
ALLOW_CLI
public
mixed
ALLOW_CLI
= 0b10000
ALLOW_CRON
public
mixed
ALLOW_CRON
= 0b1000
ALLOW_NETWORK
public
mixed
ALLOW_NETWORK
= 0b100
ALLOW_NON_PHP
public
mixed
ALLOW_NON_PHP
= 0b100000
DEFAULT_DISABLED
public
mixed
DEFAULT_DISABLED
= 0b1000000
ENABLE_OPTION
public
string|array<string|int, mixed>|bool
ENABLE_OPTION
= ['label' => "<abbr title='Risk Assessment uses internal risk filters and optional RA provider extensions to obtain a risk level (0-100) based on IP address.'>Risk Assessment</abbr>", 'help' => "If more than one <abbr title='Risk Assessment'>RA</abbr> extension is enabled, each will be used, according to the 'Multiple RA Providers' setting, until a risk level is obtained."]
to set (or disable) default group display/switch
IP_BLOCK_LIST
public
string
IP_BLOCK_LIST
= ABSPATH . "ip_block_list.conf"
IP block list file name
ONLY_ADMIN
public
mixed
ONLY_ADMIN
= 0b10
RISK_TYPES
public
array<string|int, mixed>
RISK_TYPES
= ['fraud' => 1.5, 'threat' => 1.25, 'abuse' => 1.0, 'risk' => 0.75, 'none' => 0]
risk type priority/weight when reported within the app without giving a score, the score is calculated and multiplied by weight.
TAB_NAME
public
string
TAB_NAME
= 'Security'
extension tab name
VERSION
public
string
VERSION
= '24.1122.1'
extension version
Methods
__call()
magic method to call plugin or extension methods
public
__call(mixed $method, mixed $arguments) : mixed
Parameters
- $method : mixed
-
the method name or [extension,method]
- $arguments : mixed
-
the arguments to method name
Return values
mixed —result of method called
__construct()
constructor method
public
__construct(object $plugin) : void
Parameters
- $plugin : object
-
main plugin object
Return values
void —__destruct()
Extension destructor
public
__destruct() : void
Return values
void —__get()
magic method to call parent plugin __get()
public
__get(string $property) : mixed
Parameters
- $property : string
-
the property name or extension name
Return values
mixed —result of plugin __get()
addActionsAndFilters()
Add filters and actions - called from main plugin
public
addActionsAndFilters() : void
Return values
void —addShortcodes()
Add extension shortcodes
public
addShortcodes() : void
Called after loading, instantiating, and initializing all extensions
Return values
void —admin_options_help()
Add help tab on admin page
public
admin_options_help() : void
Tags
Return values
void —admin_options_settings()
register options on options_settings_page
public
admin_options_settings() : void
Tags
Return values
void —check_for_blocks()
Check http header and blocked IP addresses
public
check_for_blocks() : void
Return values
void —clear_risk_action()
clear/delete the risk report transient
public
clear_risk_action([string $ipAddress = null ]) : mixed
Parameters
- $ipAddress : string = null
-
IP address (optional)
Return values
mixed —getAlias()
get the extension alias
public
getAlias() : const
Return values
const —ALIAS string
getClassName()
getClassName - get the class/extension name without namespace
public
getClassName([object $class = null ]) : bool
Parameters
- $class : object = null
-
optional class object
Return values
bool —getVersion()
get the extension version
public
getVersion() : const
Return values
const —VERSION string
initialize()
initialize method - called from main plugin
public
initialize() : void
Return values
void —is_network_enabled()
is_network_enabled - set or test extension enabled for use at the network level
public
is_network_enabled() : bool
Return values
bool —is_network_option()
is this class network enabled and does option match a value
public
is_network_option(string $optionName[, mixed $value = null ]) : bool|mixed
Parameters
- $optionName : string
-
option name
- $value : mixed = null
-
check this value
Return values
bool|mixed —option is set and has value
isEnabled()
isEnabled - set or test extension enabled for use
public
isEnabled([bool|string $enabled = null ][, bool $perm = null ]) : bool
Parameters
- $enabled : bool|string = null
-
true|false or other extension name
- $perm : bool = null
-
optional, to permanently set enabled option
Return values
bool —isIpIgnored()
Check an IP address is in ignored list
public
isIpIgnored(string $ipAddress) : bool
Parameters
- $ipAddress : string
-
IPv4 or IPv6 address
Return values
bool —output_ip_file()
Output to ip block file
public
output_ip_file(string $ipAddress, array<string|int, mixed> $report, int $threshold, int $limit) : mixed
Parameters
- $ipAddress : string
- $report : array<string|int, mixed>
-
count type score message[] expires status
- $threshold : int
-
risk reporting threshold (1-50)
- $limit : int
-
risk reporting limit (1-100)
Return values
mixed —register_risk_action()
Log the risk request via action (used in security extension) action {pluginName}_register_[fraud|threat|abuse|risk]
public
register_risk_action([string $message = null ], int $score, int $http_status) : mixed
Parameters
- $message : string = null
-
additional comment text
- $score : int
-
risk score (0-100)
- $http_status : int
-
optional, set http status on die
Return values
mixed —register_risk_api()
Register a WP REST api
public
register_risk_api() : void
Return values
void —register_risk_permission()
Authenticate a WP REST api
public
register_risk_permission(mixed $request) : void
Parameters
- $request : mixed
Return values
void —register_risk_request()
Log the risk request via api
public
register_risk_request(object $request) : mixed
Parameters
- $request : object
-
REST request
Return values
mixed —risk_assessment_result()
get the risk assessment result
public
risk_assessment_result([mixed $arg = null ]) : mixed
Parameters
- $arg : mixed = null