{eac}Doojigger Reference

security_ra_abuseipdb extends security_ra_abstract

Extension: Risk Assessment - AbuseIPDB API - {eac}Doojigger for WordPress

Tags
category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

Copyright (c) 2024 EarthAsylum Consulting <www.EarthAsylum.com>

Table of Contents

ACCOUNT_LIMITS  = []
ALIAS  = null
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' => "RA (<abbr title='A project dedicated to helping combat abusive activity on the internet. " . "This API utilizes the AbuseIPDB database to block access based on the <em>abuse confidence level</em>.'>AbuseIPDB</abbr>)", 'help' => "<small>Visit the <a href='https://www.abuseipdb.com' target='_blank'>AbuseIPDB</a> web site.</small>"]
ONLY_ADMIN  = 0b10
PROVIDER  = 'AbuseIPDB'
TAB_NAME  = null
VERSION  = '24.1122.1'
__call()  : mixed
magic method to call plugin or extension methods
__construct()  : bool
Extension constructor method
__destruct()  : void
Extension destructor
__get()  : mixed
magic method to call parent plugin __get()
addActionsAndFilters()  : bool
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_risk()  : array<string|int, mixed>
Use the provider APIs to validate/block IP address
get_assessment_result()  : array<string|int, mixed>
Use the AbuseIPDB API to validate/block IP address
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
report_to_provider()  : mixed
Report the abuse request

Constants

ACCOUNT_LIMITS

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

account types and rate limits since the AbuseIPDB api gives us x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset we don't need to track usage for rate limiting.

ALLOW_ALL

public mixed ALLOW_ALL = self::ALLOW_ADMIN | self::ALLOW_NETWORK | self::ALLOW_CRON | self::ALLOW_CLI

ENABLE_OPTION

public string|array<string|int, mixed>|bool ENABLE_OPTION = ['label' => "RA (<abbr title='A project dedicated to helping combat abusive activity on the internet. " . "This API utilizes the AbuseIPDB database to block access based on the <em>abuse confidence level</em>.'>AbuseIPDB</abbr>)", 'help' => "<small>Visit the <a href='https://www.abuseipdb.com' target='_blank'>AbuseIPDB</a> web site.</small>"]

to set (or disable) default group display/switch

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()

Extension constructor method

public __construct(object $plugin[, int $flags = null ]) : bool

Child class constructors MUST call parent::__construct($plugin,$flags);

Parameters
$plugin : object

parent/loader class object

$flags : int = null

see const values

Return values
bool

is enabled

__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()

addShortcodes()

Add extension shortcodes

public addShortcodes() : void

Called after loading, instantiating, and initializing all extensions

Return values
void

check_for_risk()

Use the provider APIs to validate/block IP address

public check_for_risk(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

from security_ra 'risk_assessment'

Return values
array<string|int, mixed>

$data

get_assessment_result()

Use the AbuseIPDB API to validate/block IP address

public get_assessment_result(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

initialized data array

Return values
array<string|int, mixed>

result data array

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

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

report_to_provider()

Report the abuse request

public report_to_provider(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

Search results