{eac}Doojigger Reference

abstract_core
in package
Uses logging, cookie_consent

{eac}Doojigger for WordPress - Plugin core methods, hooks, and settings.

abstract_frontend and abstract_backend extend abstract_core.

Tags
category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

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

version
24.0906.1
link
https://eacDoojigger.earthasylum.com/
see
https://eacDoojigger.earthasylum.com/phpdoc/
used-by

\EarthAsylumConsulting\abstract_frontend

used-by

\EarthAsylumConsulting\abstract_backend

Table of Contents

ENVIRONMENT_LIVE  = 'Production (live)'
ENVIRONMENT_TEST  = 'Development (test)'
EXTENSION_BASE_CLASS  = __NAMESPACE__ . '\\abstract_extension'
NETWORK_OPTION_NAME  = 'network_options'
PLUGIN_EXTENSION_TRANSIENT  = 'plugin_loaded_extensions'
PLUGIN_HEADER_TRANSIENT  = 'plugin_header_data'
PLUGIN_OPTION_NAME  = 'plugin_options'
RESERVED_OPTIONS  = [ 'uninstall_options', // {classname}_uninstall_options for uninstall trait 'selected_update_channel', ]
$advanced_mode  : array<string|int, mixed>
$advanced_mode_allowed  : bool
$className  : string
$cookie_default_service  : string
$date_format  : string
$date_time_format  : string
$extension_aliases  : array<string|int, mixed>
$extension_objects  : array<string|int, mixed>
$networkOptions  : array<string|int, mixed>
$plugin  : object
$PLUGIN_SLUG  : string
$PLUGIN_TEXTDOMAIN  : string
$pluginName  : string
$pluginOptions  : array<string|int, mixed>
$reservedOptions  : array<string|int, mixed>
$time_format  : string
$wpdb  : object
__get()  : object|null
__get magic method allows direct access to extension methods.
_COOKIE()  : mixed
Safely get $_COOKIE data using PHP filter.
_GET()  : mixed
Safely get $_GET data using PHP filter.
_POST()  : mixed
Safely get $_POST data using PHP filter.
_REQUEST()  : mixed
Safely get $_REQUEST data using PHP filter.
_SERVER()  : mixed
Safely get $_SERVER data using PHP filter.
add_action()  : mixed
add_action with prefixed name
add_admin_action_link()  : string
add an action link (for menu and/or clickable actions)
add_admin_notice()  : void
Add admin notice, noop when not admin/backend
add_filter()  : mixed
add_filter with prefixed name
add_network_option()  : mixed
add_network_option() with prefixed option name (only network enabled)
add_option()  : mixed
add_option() with prefixed option name
add_site_option()  : mixed
add_option() with prefixed option name (single site or network enabled)
addActionsAndFilters()  : void
Add plugin actions and filter.
addShortcodes()  : void
Add plugin shortcodes.
after_switch_blog()  : void
after switching blogs, load internal option array.
allowAdvancedMode()  : bool
allow advanced mode - aids in complexity and/or licensing limits.
apply_filters()  : mixed
apply_filters with prefixed name
before_switch_blog()  : void
before switching blogs, save internal option array.
callAllExtensions()  : array<string|int, mixed>
Execute a method in each/all loaded extension class
callExtension()  : mixed
call a specific extension method
callMethod()  : mixed
call an internal plugin or extension method
config_advanced_mode()  : void
config advanced mode - aids in complexity and/or licensing limits.
cookie_consent_hack()  : void
enqueue javascripts to patch consent interface between browser and server
createUniqueId()  : string
Generates a Universally Unique IDentifier (UUID), version 4.
currentURL()  : string
get the current url
delete_network_option()  : bool
delete_network_option() with prefixed option name (only network enabled)
delete_option()  : bool
delete_option() with prefixed option name
delete_site_option()  : bool
delete_option() with prefixed option name (single site or network enabled)
delete_site_transient()  : bool
A wrapper function to WP delete_site_transient() with prefixed transient name
delete_transient()  : bool
A wrapper function to WP delete_transient() with prefixed transient name
did_action()  : mixed
did_action with prefixed name
did_filter()  : mixed
did_filter with prefixed name (WP 6.1)
do_action()  : mixed
do_action with prefixed name
do_admin_action_links()  : void
process action links from admin page.
doing_ajax()  : bool
detect an ajax request
eacDoojigger_ready()  : void
eacDoojigger is fully loaded and ready.
error()  : object
wp_error with logging
escape()  : mixed
to filter/escape a variable
explode_with_keys()  : array<string|int, mixed>
explode a string into an associative array
fatal()  : void
fatal error with logging
flush_caches()  : void
clear cache and transient data
forEachNetworkSite()  : bool
in multisite environment, perform callback for each site from network admin, not as network admin
get()  : mixed
retrieve a stored variable
get_cookie()  : string
get a cookie (convenience method, since we have set_cookie)
get_cookie_consent()  : array<string|int, mixed>
get a registered cookie consent array for a single cookie or all cookies
get_network_option()  : mixed
get_network_option() with prefixed option name, optional callback default (only network enabled)
get_network_option_decrypt()  : mixed
get_network_option() and decrypt with prefixed option name, optional callback default
get_option()  : mixed
get_option() with prefixed option name, optional callback default
get_option_decrypt()  : mixed
get_option() and decrypt with prefixed option name, optional callback default
get_page_footer()  : string
get a template page footer
get_page_header()  : string
get a template page header
get_page_template()  : string
get a template page part
get_post_by_slug()  : object
get a post (or page) by slug
get_site_option()  : mixed
get_option() with prefixed option name, optional callback default (single site or network enabled)
get_site_option_decrypt()  : mixed
get_site_option() and decrypt with prefixed option name, optional callback default
get_site_transient()  : mixed
A wrapper function to WP get_site_transient() with prefixed transient name and callable function
get_transient()  : mixed
A wrapper function to WP get_transient() with prefixed transient name and callable function
getClassName()  : string|bool
get the class name without namespace
getClassObject()  : object
get class or extension object
getDocumentationLink()  : string
get documentation link (i.e. the home/documentation page for this plugin) requires 'Plugin URI' in plugin header
getDocumentationURL()  : string
get documentation url (i.e. the home/documentation page for this plugin)
getExtension()  : bool|object
alias to isExtension - get enabled extension object
getFilterCallback()  : array<string|int, mixed>
to parse the PHP filter name and options
getMySqlVersion()  : string|false
Query MySQL DB for its version
getOptionNamePrefix()  : string
get the option prefix
getPageName()  : string|null
Get the page "name"
getPluginValue()  : string
get plugin value from pluginData (base file header)
getPluginValues()  : array<string|int, mixed>
get plugin value array from pluginData (base file header).
getRelease()  : string
get release (stable tag/Last Updated) from the readme header
getSemanticVersion()  : object|null
Parse a Semantic or Calendar version number.
getSettingsCallback()  : array<string|int, mixed>
get settings page callback
getSettingsLink()  : string
get settings link (i.e. the page for setting options)
getSettingsSlug()  : string
get settings name (i.e. the page for setting options)
getSettingsURL()  : string
get settings link (i.e. the page for setting options)
getSupportLink()  : string
get WordPress support link for this plugin
getSupportURL()  : string
get WordPress support URL for this plugin
getVariable()  : mixed
retrieve a stored variable
getVersion()  : string
version of this code from the plugin header or from given extension
getVisitorCountry()  : string
Get the visitor's country from the language header
getVisitorId()  : string
Get a unique visitor id
getVisitorIP()  : string
Get the visitor's IP address
has_action()  : mixed
has_action with prefixed name
has_filter()  : mixed
has_filter with prefixed name
implode_with_keys()  : string
implode an associative array into a string
initialize()  : void
class initialization.
insert_with_markers()  : bool
like WordPress insert_with_markers, works with multiple file types
is_admin()  : bool
is admin (is_admin() or admin url) w/ability to set
is_advanced_mode()  : bool
is advanced mode filter - aids in complexity and/or licensing limits.
is_backend()  : bool
is back-end (is_admin() or admin url)
is_frontend()  : bool
is front-end (not is_admin() or admin url)
is_network_admin()  : bool
is network admin (is_network_admin() or network admin url) w/ability to set
is_network_enabled()  : bool
is plugin network-enabled
is_network_option()  : bool|mixed
is network option a value or in a set of values (only network enabled)
is_option()  : bool|mixed
is option a value or in a set of values
is_plugin_active()  : bool
is plugin active (may be called from inactive site)
is_site_option()  : bool|mixed
is_option a value or in a set of values (single site or network enabled)
isAdvancedMode()  : bool
is advanced mode - aids in complexity and/or licensing limits.
isAjaxRequest()  : bool
now an alias to $tthis->doing_ajax()
isCurrentScreen()  : null|bool|string
get or check the current screen name
isExtension()  : bool|object
is extension loaded and enabled
isFalse()  : bool
is value false? - false,off,no,0
isNewVisitor()  : string
Check visitor cookie
isPluginsPage()  : bool
when we're on the plugins page
isReservedOption()  : bool
test or set reserved option key
isSettingsPage()  : bool
when we're on our settings page
isTestSite()  : bool
is this a test or live production site
isTrue()  : bool
is value true? true,on,yes,1
log()  : object|void
PSR-3 Log
logAlways()  : void
console/file logging - always
logData()  : void
console/file logging - data (warning)
logDebug()  : void
console/file logging - debug
logError()  : void
console/file logging - error
logInfo()  : void
console/file logging - info (notice)
logNotice()  : void
console/file logging - notice
logWarning()  : void
console/file logging - warning
logWrite()  : void
console/file logging
minifyString()  : string
Simple minify for JS or CSS content.
modifyColor()  : string
Increases or decreases the brightness of a color by a percentage of the current brightness.
page_redirect()  : void
redirect the current page
page_reload()  : void
reload the current page
plugin_daily_event()  : void
plugin_daily_event
plugin_hourly_event()  : void
plugin_hourly_event
plugin_ready()  : void
Plugin is fully loaded and ready.
plugin_weekly_event()  : void
plugin_weekly_event
pluginHeader()  : string
get plugin value from pluginData (base file header)
pluginHeaders()  : array<string|int, mixed>
get plugin value array from pluginData (base file header).
pluginHelpEnabled()  : bool
pluginHelpEnabled
prefixHookName()  : string
Get the prefixed version of the hook name
prefixOptionName()  : string
Get the prefixed version input $name suitable for storing in WP options
prefixTableName()  : string
Prefix the table name with wpdb prefix and our class prefix (wpdb_classname_tablename)
prefixTransientName()  : string
Get the prefixed version of the transient name
print_admin_notice()  : void
write admin notice immediately, noop when not admin/backend
purge_expired_transients()  : mixed
purge expired transients for current blog
registerNetworkOptions()  : void
add network options (values) for the plugin
registerPluginOptions()  : void
add additional options (values) for the plugin (or extension)
remove_action()  : mixed
remove_action with prefixed name
remove_filter()  : mixed
remove_filter with prefixed name
rename_network_option()  : mixed
rename a network option (only network enabled)
rename_option()  : mixed
rename an option
rename_site_option()  : mixed
rename an option (single site or network enabled)
restore_current_blog()  : bool
restore_current_blog wrapper.
safeEcho()  : bool
safeEcho - only echo output when not wp_doing_ajax(), prevents interference with multiple/auto installs
sanitize()  : mixed
to filter/sanitize a variable
scheduleEvent()  : void
schedule a single event with callback
set()  : string
set a stored variable
set_cookie()  : bool
set a cookie supporting wp_consent if enabled
set_cookie_consent()  : array<string|int, mixed>
set a cookie's consent information
set_cookie_expiration()  : array<string|int, mixed>
set a cookie expiration as integer and string
set_network_option()  : mixed
set a network option value (only network enabled)
set_option()  : mixed
set an option value
set_site_option()  : mixed
temporarily set an option value (single site or network enabled)
set_site_transient()  : bool
A wrapper function to WP set_site_transient() with prefixed transient name
set_transient()  : bool
A wrapper function to WP set_transient() with prefixed transient name
setAdvancedMode()  : void
set advanced mode - aids in complexity and/or licensing limits.
setVariable()  : string
set a stored variable
standardizeOptionGroup()  : string|array<string|int, mixed>
standardize the options group display name
standardizeOptionName()  : string
standardize the option name
switch_to_blog()  : bool
switch_to_blog wrapper.
text_to_array()  : array<string|int, mixed>
parse delimited string to arrray
unprefixOptionName()  : string
Remove the prefix from the input $name
update_network_option()  : mixed
update_network_option() with prefixed option name (only network enabled)
update_network_option_encrypt()  : mixed
encrypt and update_network_option() with prefixed option name
update_option()  : mixed
update_option() with prefixed option name
update_option_encrypt()  : mixed
encrypt and update_option() with prefixed option name
update_site_option()  : mixed
update_site_option() with prefixed option name (single site or network enabled)
update_site_option_encrypt()  : mixed
encrypt and update_site_option() with prefixed option name (single site or network enabled)
varCookie()  : mixed
Safely get $_COOKIE data using PHP filter.
varGet()  : mixed
Safely get $_GET data if set using PHP filter
varPost()  : mixed
Safely get $_POST data if set using PHP filter
varRequest()  : mixed
Safely get $_REQUEST data if set, using PHP filter
varServer()  : mixed
Safely get $_SERVER or $_ENV data if set, using PHP filter
wp_kses()  : string
customized wp_kses

Constants

ENVIRONMENT_LIVE

public string ENVIRONMENT_LIVE = 'Production (live)'

environment - live

ENVIRONMENT_TEST

public string ENVIRONMENT_TEST = 'Development (test)'

environment - test

EXTENSION_BASE_CLASS

public string EXTENSION_BASE_CLASS = __NAMESPACE__ . '\\abstract_extension'

base class name of extensions

NETWORK_OPTION_NAME

public string NETWORK_OPTION_NAME = 'network_options'

network options name

PLUGIN_EXTENSION_TRANSIENT

public string PLUGIN_EXTENSION_TRANSIENT = 'plugin_loaded_extensions'

transient name for plugin extensions to load

PLUGIN_HEADER_TRANSIENT

public string PLUGIN_HEADER_TRANSIENT = 'plugin_header_data'

transient name for plugin header info

Tags
see
setPluginHeaderValues()

PLUGIN_OPTION_NAME

public string PLUGIN_OPTION_NAME = 'plugin_options'

plugin options name

RESERVED_OPTIONS

public array<string|int, mixed> RESERVED_OPTIONS = [ 'uninstall_options', // {classname}_uninstall_options for uninstall trait 'selected_update_channel', ]

reserved options (not part of options array)

Properties

$advanced_mode

public array<string|int, mixed> $advanced_mode = array('global' => array('default' => false), 'settings' => array('default' => false))

Advanced Mode. use setAdvancedMode(bool, what, level) to set, use isAdvancedMode(what, level) to check

$advanced_mode_allowed

public bool $advanced_mode_allowed = false

Advanced Mode allowed.

$className

public string $className

The name of this plugin class (sans namespace) aka $pluginName

Tags
used-by

getClassName()

public string $cookie_default_service = ''

defaul consent service name (set bay using class)

$extension_aliases

public array<string|int, mixed> $extension_aliases = array()

extension aliases (alias_name=>class_object)

$extension_objects

public array<string|int, mixed> $extension_objects = array()

extension objects (class_name=>class_object)

Tags
used-by

loadextensions()

$networkOptions

public array<string|int, mixed> $networkOptions = array()

network options/settings array (optionName=>value)

$PLUGIN_TEXTDOMAIN

public string $PLUGIN_TEXTDOMAIN

Language name of this plugin, must match 'Text Domain' comment

$pluginName

public string $pluginName

The name of this plugin class (sans namespace) aka $className

Tags
used-by

getClassName()

$pluginOptions

public array<string|int, mixed> $pluginOptions = array()

plugin/extension options/settings array (optionName=>value)

$reservedOptions

public array<string|int, mixed> $reservedOptions = array()

reserved option keys (typically used outside of the plugin) option keys stored individually (true/false)

Methods

__get()

__get magic method allows direct access to extension methods.

public __get(string $property) : object|null
Parameters
$property : string

the property name or extension name

Tags
example

$this->extension->method()

Return values
object|null

Safely get $_COOKIE data using PHP filter.

public _COOKIE(string $name[, mixed $filter = FILTER_CALLBACK ][, mixed $options = null ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = null
Tags
deprecated
  • use $this->varCookie(...)
Return values
mixed

_GET()

Safely get $_GET data using PHP filter.

public _GET(string $name[, mixed $filter = FILTER_CALLBACK ][, mixed $options = null ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = null
Tags
deprecated
  • use $this->varGet(...)
Return values
mixed

_POST()

Safely get $_POST data using PHP filter.

public _POST(string $name[, mixed $filter = FILTER_CALLBACK ][, mixed $options = null ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = null
Tags
deprecated
  • use $this->varPost(...)
Return values
mixed

_REQUEST()

Safely get $_REQUEST data using PHP filter.

public _REQUEST(string $name[, mixed $filter = FILTER_CALLBACK ][, mixed $options = null ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = null
Tags
deprecated
  • use $this->varRequest(...)
Return values
mixed

_SERVER()

Safely get $_SERVER data using PHP filter.

public _SERVER(string $name[, mixed $filter = FILTER_CALLBACK ][, mixed $options = null ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = null
Tags
deprecated
  • use $this->varServer(...)
Return values
mixed

add_action()

add_action with prefixed name

public add_action(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

add an action link (for menu and/or clickable actions)

public add_admin_action_link(string $action) : string
Parameters
$action : string

action name advanced_mode_enable, advanced_mode_disable, or custom action name

Return values
string

href

add_admin_notice()

Add admin notice, noop when not admin/backend

public add_admin_notice(string $message[, string $errorType = 'notice' ][, string $moreInfo = '' ]) : void
Parameters
$message : string

message text

$errorType : string = 'notice'

'error', 'warning', 'notice', 'success'

$moreInfo : string = ''

additional message text

Return values
void

add_filter()

add_filter with prefixed name

public add_filter(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

add_network_option()

add_network_option() with prefixed option name (only network enabled)

public add_network_option(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

Return values
mixed

option value

add_option()

add_option() with prefixed option name

public add_option(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

option value

add_site_option()

add_option() with prefixed option name (single site or network enabled)

public add_site_option(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from add_option

after_switch_blog()

after switching blogs, load internal option array.

public after_switch_blog(string $new_blog_id, string $prev_blog_id, string $switch) : void

called from WP 'switch_blog' action.

Parameters
$new_blog_id : string

switching to blog

$prev_blog_id : string

switching from blog

$switch : string

'switch' or 'restore'

Return values
void

allowAdvancedMode()

allow advanced mode - aids in complexity and/or licensing limits.

public allowAdvancedMode([bool $allow = null ]) : bool
Parameters
$allow : bool = null
  • allow or not
Tags
example

$this->allowAdvancedMode(false);

Return values
bool
  • allowed or not

apply_filters()

apply_filters with prefixed name

public apply_filters(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

before_switch_blog()

before switching blogs, save internal option array.

public before_switch_blog(string $new_blog_id, string $prev_blog_id, string $switch) : void

called from $this->switch_to_blog() (not WP).

Parameters
$new_blog_id : string

switching to blog

$prev_blog_id : string

switching from blog

$switch : string

'switch' or 'restore'

Return values
void

callAllExtensions()

Execute a method in each/all loaded extension class

public callAllExtensions(string $method, mixed ...$arguments) : array<string|int, mixed>
Parameters
$method : string

the method name

$arguments : mixed

the arguments to method name

Return values
array<string|int, mixed>

results from each call

callExtension()

call a specific extension method

public callExtension(string $extension, string $method, mixed ...$arguments) : mixed
Parameters
$extension : string

the extension name

$method : string

the method name

$arguments : mixed

the arguments to method name

Return values
mixed

result of extension method called

callMethod()

call an internal plugin or extension method

public callMethod(string|array<string|int, mixed> $method, mixed ...$arguments) : mixed
Parameters
$method : string|array<string|int, mixed>

the method name or [extension,method]

$arguments : mixed

the arguments to method name

Return values
mixed

result of call

config_advanced_mode()

config advanced mode - aids in complexity and/or licensing limits.

public config_advanced_mode() : void

set 'advanced mode' based on defined constant or user meta

Return values
void

enqueue javascripts to patch consent interface between browser and server

public cookie_consent_hack() : void
Return values
void

currentURL()

get the current url

public currentURL() : string
Return values
string

the full url of the current request

delete_network_option()

delete_network_option() with prefixed option name (only network enabled)

public delete_network_option(string $optionName) : bool
Parameters
$optionName : string

option name

Return values
bool

returned from delete_option

delete_option()

delete_option() with prefixed option name

public delete_option(string $optionName) : bool
Parameters
$optionName : string

option name

Return values
bool

returned from delete_option

delete_site_option()

delete_option() with prefixed option name (single site or network enabled)

public delete_site_option(string $optionName) : bool
Parameters
$optionName : string

option name

Return values
bool

returned from delete_option

delete_site_transient()

A wrapper function to WP delete_site_transient() with prefixed transient name

public delete_site_transient(string $transientName) : bool
Parameters
$transientName : string

transient name

Return values
bool

delete_transient()

A wrapper function to WP delete_transient() with prefixed transient name

public delete_transient(string $transientName) : bool
Parameters
$transientName : string

transient name

Return values
bool

did_action()

did_action with prefixed name

public did_action(string $hookName) : mixed
Parameters
$hookName : string

the name of the action

Return values
mixed

did_filter()

did_filter with prefixed name (WP 6.1)

public did_filter(string $hookName) : mixed
Parameters
$hookName : string

the name of the filter

Return values
mixed

do_action()

do_action with prefixed name

public do_action(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

process action links from admin page.

public do_admin_action_links(object $admin_bar) : void

additional/custom actions may be added by adding an action for the function name: $this->add_action('my_action_name',function(){...});

Parameters
$admin_bar : object

wp_admin_bar

Return values
void

doing_ajax()

detect an ajax request

public doing_ajax() : bool
Return values
bool

eacDoojigger_ready()

eacDoojigger is fully loaded and ready.

public eacDoojigger_ready() : void

Called when eacDoojigger_ready is ready (all extensions/filters/shortcodes loaded)

Return values
void

error()

wp_error with logging

public error(string|int|object $code[, string $message = '' ][, mixed $data = '' ][, string $id = '' ][, mixed $isCritical = false ]) : object
Parameters
$code : string|int|object

Error code or wp_error or throwable instance

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : string = ''

optional, source id

$isCritical : mixed = false
Return values
object

WP_Error object

escape()

to filter/escape a variable

public escape(scalar|array<string|int, mixed> $input[, callable $callback = 'esc_attr' ]) : mixed
Parameters
$input : scalar|array<string|int, mixed>

the value to be filtered

$callback : callable = 'esc_attr'

optional callback function

Tags
example

$data = $this->escape($variable);

example

$data = $this->escape($variable, 'esc_attr');

Return values
mixed

the filtered value, false if filter failed

explode_with_keys()

explode a string into an associative array

public explode_with_keys(string $separator, string $string[, string $delimiter = '=' ]) : array<string|int, mixed>
Parameters
$separator : string

the glue value

$string : string

the string value to explode

$delimiter : string = '='

the key=value delimiter

Return values
array<string|int, mixed>

the exploded array

fatal()

fatal error with logging

public fatal(string|int $code[, string $message = '' ][, mixed $data = '' ][, string $id = null ]) : void
Parameters
$code : string|int

Error code

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : string = null

optional, source id

Return values
void

flush_caches()

clear cache and transient data

public flush_caches([bool $fullFlush = false ]) : void
Parameters
$fullFlush : bool = false
Return values
void

forEachNetworkSite()

in multisite environment, perform callback for each site from network admin, not as network admin

public forEachNetworkSite(callable $callback, mixed ...$arguments) : bool
Parameters
$callback : callable
$arguments : mixed
Tags
example

$this->forEachNetworkSite( function() {...} );

Return values
bool

is network admin

get()

retrieve a stored variable

public get(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string

stored key

$default : mixed = null

default value

Tags
deprecated

use getVariable()

Return values
mixed

stored variable (unserialized)

get a cookie (convenience method, since we have set_cookie)

public get_cookie(string $name[, string $default = null ]) : string
Parameters
$name : string

the cookie name

$default : string = null

if cookie not set

Return values
string

cookie value

get a registered cookie consent array for a single cookie or all cookies

public get_cookie_consent([string $name = false ]) : array<string|int, mixed>
Parameters
$name : string = false

the cookie name (optional)

Return values
array<string|int, mixed>

$consent or array of [name => $consent]

get_network_option()

get_network_option() with prefixed option name, optional callback default (only network enabled)

public get_network_option(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function to set value

Tags
example

$this->get_network_option('my_option') - returns my_option value or false

example

$this->get_network_option('my_option',[]) - returns my_option value or []

example

$this->get_network_option('my_option','setMyOption') - returns my_option value or value returned by setMyOption()

Return values
mixed

option value

get_network_option_decrypt()

get_network_option() and decrypt with prefixed option name, optional callback default

public get_network_option_decrypt(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_option()

get_option() with prefixed option name, optional callback default

public get_option(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function to set value

Tags
example

$this->get_option('my_option') - returns my_option value or false

example

$this->get_option('my_option',[]) - returns my_option value or []

example

$this->get_option('my_option','setMyOption') - returns my_option value or value returned by setMyOption()

Return values
mixed

option value

get_option_decrypt()

get_option() and decrypt with prefixed option name, optional callback default

public get_option_decrypt(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get a template page footer

public get_page_footer([string $name = null ]) : string
Parameters
$name : string = null

special footer name

Return values
string

the footer content

get_page_header()

get a template page header

public get_page_header([string $name = null ]) : string
Parameters
$name : string = null

special header name

Return values
string

the header content

get_page_template()

get a template page part

public get_page_template(string $slug[, string $name = null ][, mixed $args = [] ]) : string
Parameters
$slug : string

template file name {$slug}.php

$name : string = null

special name/part {$slug}-{$name}.php

$args : mixed = []
Return values
string

the template content

get_post_by_slug()

get a post (or page) by slug

public get_post_by_slug(string $slug[, array<string|int, mixed> $options = [] ]) : object
Parameters
$slug : string

the name to search for

$options : array<string|int, mixed> = []

augment/override query options

Return values
object

the first matching post

get_site_option()

get_option() with prefixed option name, optional callback default (single site or network enabled)

public get_site_option(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_site_option_decrypt()

get_site_option() and decrypt with prefixed option name, optional callback default

public get_site_option_decrypt(string $optionName[, mixed $default = false ]) : mixed
Parameters
$optionName : string

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_site_transient()

A wrapper function to WP get_site_transient() with prefixed transient name and callable function

public get_site_transient(string $transientName[, mixed $default = false ], int $expiration) : mixed
Parameters
$transientName : string

transient name

$default : mixed = false

default value or callable function

$expiration : int

time until expiration in seconds. Default 0 (no expiration)

Tags
example

$this->get_site_transient(name, function, nnn) to call function if transient is not set or has expired

Return values
mixed

transient value

get_transient()

A wrapper function to WP get_transient() with prefixed transient name and callable function

public get_transient(string $transientName[, mixed $default = false ], int $expiration) : mixed
Parameters
$transientName : string

transient name

$default : mixed = false

default value or callable function

$expiration : int

time until expiration in seconds. Default 0 (no expiration)

Tags
example

$this->get_transient(name, function, nnn) to call function if transient is not set or has expired

Return values
mixed

transient value

getClassName()

get the class name without namespace

public getClassName([object $object = null ]) : string|bool
Parameters
$object : object = null

optional class object

Return values
string|bool

getClassObject()

get class or extension object

public getClassObject([string $className = null ]) : object
Parameters
$className : string = null

class/extension name

Return values
object

class object or null

get documentation link (i.e. the home/documentation page for this plugin) requires 'Plugin URI' in plugin header

public getDocumentationLink([mixed $plugin = true ][, string $permalink = null ][, string $name = 'Docs' ][, string $title = 'Documentation' ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$permalink : string = null

uri (/sample-post, ?p=nnn, /2022/08/26/sample-post/, etc.)

$name : string = 'Docs'

link name ('Docs')

$title : string = 'Documentation'

title ('Documentation')

Return values
string

the Documentation link

getDocumentationURL()

get documentation url (i.e. the home/documentation page for this plugin)

public getDocumentationURL([mixed $plugin = true ][, string $permalink = null ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$permalink : string = null

uri (/sample-post, ?p=nnn, /2022/08/26/sample-post/, etc.)

Return values
string

the Documentation link

getExtension()

alias to isExtension - get enabled extension object

public getExtension(object|string $extension[, bool $checkEnabled = true ]) : bool|object
Parameters
$extension : object|string

extension class or name

$checkEnabled : bool = true

check isEnabled()

Return values
bool|object

false or extension object

getFilterCallback()

to parse the PHP filter name and options

public getFilterCallback([int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ][, array<string|int, mixed> $args = null ]) : array<string|int, mixed>
Parameters
$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

$args : array<string|int, mixed> = null

additional arguments passed to callable

Return values
array<string|int, mixed>

[filter, options]

getMySqlVersion()

Query MySQL DB for its version

public getMySqlVersion() : string|false
Tags
deprecated

use $this->wpdb->db_server_info()

Return values
string|false

getOptionNamePrefix()

get the option prefix

public getOptionNamePrefix([string $prefix = null ]) : string
Parameters
$prefix : string = null

override default prefix

Return values
string

short_classname_

getPageName()

Get the page "name"

public getPageName([mixed $post = null ][, bool $permalink = false ]) : string|null
Parameters
$post : mixed = null
$permalink : bool = false

get post permalink name

Return values
string|null

the requested page name (sans extension)

getPluginValue()

get plugin value from pluginData (base file header)

public getPluginValue([string $name = null ]) : string
Parameters
$name : string = null

name of plugin data value

Tags
deprecated
  • use pluginHeader()
Return values
string

data value from plugin header

getPluginValues()

get plugin value array from pluginData (base file header).

public getPluginValues() : array<string|int, mixed>
Tags
deprecated
  • use pluginHeaders()
Return values
array<string|int, mixed>

values from plugin header

getRelease()

get release (stable tag/Last Updated) from the readme header

public getRelease([mixed $default = '' ]) : string
Parameters
$default : mixed = ''
Return values
string

'Release __ (__)'

getSemanticVersion()

Parse a Semantic or Calendar version number.

public getSemanticVersion([string $version = null ]) : object|null

Semantic Version (SemVer) = major . minor . patch [- release + build] Calendar Version (CalVer) = yy . mmdd . patch [- release + build].

Any version-release is almost always less than version (no release) 1.2.3 > 1.2.3-Release+Build, 1.2.3-release > 1.2.3-Release+Build, 1.2.3-release < 1.2.3

Parameters
$version : string = null
Tags
see
https://semver.org
Return values
object|null

'original' => '1.2.3-Release+Build', 'major' => '1', 'minor' => '2', 'patch' => '3', 'release' => 'Release', 'build' => 'Build', 'version' => '1.2.3-release', (use with version compare) 'primary' => '1.2.3', __toString() = '1.2.3-release+build'

getSettingsCallback()

get settings page callback

public getSettingsCallback() : array<string|int, mixed>
Return values
array<string|int, mixed>

the settings page callback

get settings link (i.e. the page for setting options)

public getSettingsLink([mixed $plugin = true ][, string $tab = null ][, string $name = 'Settings' ][, string $title = 'Settings' ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$tab : string = null

add tab name to url

$name : string = 'Settings'

link name ('Settings')

$title : string = 'Settings'

title ('Settings')

Return values
string

the settings link

getSettingsSlug()

get settings name (i.e. the page for setting options)

public getSettingsSlug() : string
Return values
string

the settings slug name

getSettingsURL()

get settings link (i.e. the page for setting options)

public getSettingsURL([mixed $plugin = true ][, string $tab = null ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$tab : string = null

add tab name to url

Return values
string

the settings link

get WordPress support link for this plugin

public getSupportLink([mixed $plugin = true ][, string $slug = null ][, string $name = 'Support' ][, string $title = 'Support' ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$slug : string = null

uri plugin slug

$name : string = 'Support'

link name ('Support')

$title : string = 'Support'

title ('Support')

Return values
string

the Support link

getSupportURL()

get WordPress support URL for this plugin

public getSupportURL([mixed $plugin = true ][, string $slug = null ]) : string
Parameters
$plugin : mixed = true

true=use this plugin title, array=get_plugin_data array, string = title

$slug : string = null

uri plugin slug

Return values
string

the Support URL

getVariable()

retrieve a stored variable

public getVariable(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string

stored key

$default : mixed = null

default value

Return values
mixed

stored variable (unserialized)

getVersion()

version of this code from the plugin header or from given extension

public getVersion([mixed $extension = null ][, mixed $default = '' ]) : string
Parameters
$extension : mixed = null
$default : mixed = ''
Return values
string

'n.n.n'

getVisitorCountry()

Get the visitor's country from the language header

public getVisitorCountry() : string
Return values
string

2 character country code (default=US)

getVisitorId()

Get a unique visitor id

public getVisitorId([bool $forRequest = false ]) : string
Parameters
$forRequest : bool = false

unique to this request

Return values
string

ID

getVisitorIP()

Get the visitor's IP address

public getVisitorIP() : string
Return values
string

IP address

has_action()

has_action with prefixed name

public has_action(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

has_filter()

has_filter with prefixed name

public has_filter(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

implode_with_keys()

implode an associative array into a string

public implode_with_keys(string $separator, array<string|int, mixed> $array[, string $delimiter = '=' ]) : string
Parameters
$separator : string

the glue value

$array : array<string|int, mixed>

the associative array to implode

$delimiter : string = '='

the key=value delimiter

Return values
string

the imploded string

initialize()

class initialization.

public initialize() : void

Called after instantiating and loading extensions

Return values
void

insert_with_markers()

like WordPress insert_with_markers, works with multiple file types

public insert_with_markers(string $filename, string $marker, array<string|int, mixed> $insertion[, string $commentBegin = '#' ][, string $commentEnd = '' ][, bool $insertAtTop = false ]) : bool
Parameters
$filename : string
  • path name to file
$marker : string
  • marker text
$insertion : array<string|int, mixed>
  • line(s) to be inserted
$commentBegin : string = '#'
  • beginning of a comment (i.e. '#', ';', '//', '/*')
$commentEnd : string = ''
  • ending of a comment (i.e. '* /')
$insertAtTop : bool = false
  • true to insert new block at beginning of file
Return values
bool

is_admin()

is admin (is_admin() or admin url) w/ability to set

public is_admin([bool $set = null ]) : bool
Parameters
$set : bool = null

set/override is_admin

Return values
bool

is_advanced_mode()

is advanced mode filter - aids in complexity and/or licensing limits.

public is_advanced_mode([bool $bool = false ][, string $what = null ][, string $level = null ]) : bool
Parameters
$bool : bool = false
  • ignored
$what : string = null
  • what is in advanced mode
$level : string = null
  • what level is in advanced mode (default, basic, standard, pro)
Tags
example

$this->apply_filters('is_advanced_mode',false,'settings');

Return values
bool
  • is or is not

is_backend()

is back-end (is_admin() or admin url)

public is_backend() : bool
Return values
bool

is_frontend()

is front-end (not is_admin() or admin url)

public is_frontend() : bool
Return values
bool

is_network_admin()

is network admin (is_network_admin() or network admin url) w/ability to set

public is_network_admin([bool $set = null ]) : bool
Parameters
$set : bool = null

set/override is_network_admin

Return values
bool

is_network_enabled()

is plugin network-enabled

public is_network_enabled([string $plugin = null ]) : bool
Parameters
$plugin : string = null
Return values
bool

is_network_option()

is network option a value or in a set of values (only network enabled)

public is_network_option(string $optionName[, mixed $value = null ]) : bool|mixed
Parameters
$optionName : string

option name

$value : mixed = null

check this value

Tags
example

$this->is_network_option('my_option') - returns my_option value

example

$this->is_network_option('my_option','this_value') - returns 'this_value' or false

example

$this->is_network_option('my_option',['this_value','that_value']) - returns 'this_value' or 'that_value' or false

Return values
bool|mixed

option is set and has value

is_option()

is option a value or in a set of values

public is_option(string $optionName[, mixed $value = null ][, bool $network = false ]) : bool|mixed
Parameters
$optionName : string

option name

$value : mixed = null

check for this value (optional)

$network : bool = false

using network options (internal)

Tags
example

$this->is_option('my_option') - returns my_option value

example

$this->is_option('my_option','this_value') - returns 'this_value' or false

example

$this->is_option('my_option',['this_value','that_value']) - returns 'this_value' or 'that_value' or false

Return values
bool|mixed

null or option value

is_plugin_active()

is plugin active (may be called from inactive site)

public is_plugin_active([string $plugin = null ]) : bool
Parameters
$plugin : string = null

plugin slug

Return values
bool

is_site_option()

is_option a value or in a set of values (single site or network enabled)

public is_site_option(string $optionName[, mixed $value = null ]) : bool|mixed
Parameters
$optionName : string

option name

$value : mixed = null

check this value

Tags
example

$this->is_site_option('my_option')

example

$this->is_site_option('my_option','this_value')

example

$this->is_site_option('my_option',['this_value','that_value'])

Return values
bool|mixed

option is set and has value

isAdvancedMode()

is advanced mode - aids in complexity and/or licensing limits.

public isAdvancedMode([string $what = null ][, string $level = null ]) : bool
Parameters
$what : string = null
  • what is in advanced mode
$level : string = null
  • what level is in advanced mode (default, basic, standard, pro)
Tags
example

$this->isAdvancedMode('settings');

Return values
bool
  • is or is not

isAjaxRequest()

now an alias to $tthis->doing_ajax()

public isAjaxRequest() : bool
Tags
deprecated

use $this->doing_ajax()

Return values
bool

isCurrentScreen()

get or check the current screen name

public isCurrentScreen([mixed $screen = null ]) : null|bool|string
Parameters
$screen : mixed = null
Return values
null|bool|string

isExtension()

is extension loaded and enabled

public isExtension(object|string $extension[, bool $checkEnabled = true ]) : bool|object
Parameters
$extension : object|string

extension class or name

$checkEnabled : bool = true

check isEnabled()

Return values
bool|object

false or extension object

isFalse()

is value false? - false,off,no,0

public isFalse(string $value) : bool
Parameters
$value : string

value to check

Return values
bool

isNewVisitor()

Check visitor cookie

public isNewVisitor() : string
Return values
string

ID

isPluginsPage()

when we're on the plugins page

public isPluginsPage() : bool
Return values
bool

isReservedOption()

test or set reserved option key

public isReservedOption(string $optionName[, bool $set = null ]) : bool
Parameters
$optionName : string

option name

$set : bool = null

set as reserved or not

Tags
example

$this->isReservedOption('my_option',true);

example

if ($this->isReservedOption('my_option')) {...}

Return values
bool

isSettingsPage()

when we're on our settings page

public isSettingsPage([string $isTab = null ]) : bool
Parameters
$isTab : string = null

check specific tab name

Return values
bool

isTestSite()

is this a test or live production site

public isTestSite() : bool
Return values
bool

sets $site_is_test

isTrue()

is value true? true,on,yes,1

public isTrue(string $value) : bool
Parameters
$value : string

value to check

Return values
bool

log()

PSR-3 Log

public log([int|string $level = '' ][, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : object|void
Parameters
$level : int|string = ''

PHP or PSR error level

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
object|void

logger object or void on log()

logAlways()

console/file logging - always

public logAlways(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logData()

console/file logging - data (warning)

public logData(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Tags
deprecated
  • use logDebug()
Return values
void

logDebug()

console/file logging - debug

public logDebug(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logError()

console/file logging - error

public logError(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logInfo()

console/file logging - info (notice)

public logInfo(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logNotice()

console/file logging - notice

public logNotice(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logWarning()

console/file logging - warning

public logWarning(mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

logWrite()

console/file logging

public logWrite(int $level, mixed $variable[, mixed $message = '' ][, array<string|int, mixed> $context = [] ]) : void
Parameters
$level : int

the debugging log level

$variable : mixed

variable to log, WP_Error object, throwable object

$message : mixed = ''
$context : array<string|int, mixed> = []

[key=>value] array for interpolation of $message

Return values
void

minifyString()

Simple minify for JS or CSS content.

public minifyString(string $content[, mixed $stripNL = true ]) : string

Strips comments, leading/ttrailing white-space, new-lines. Warning: not all js/css strings may succesfully pass through this regex!

Parameters
$content : string
$stripNL : mixed = true
Return values
string

minified content

modifyColor()

Increases or decreases the brightness of a color by a percentage of the current brightness.

public modifyColor(string $hexCode, float $adjustPercent) : string
Parameters
$hexCode : string

Supported formats: #FFF, #FFFFFF, FFF, FFFFFF

$adjustPercent : float

A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.

Tags
author

maliayas (https://stackoverflow.com/questions/3512311/how-to-generate-lighter-darker-color-with-php)

Return values
string

page_redirect()

redirect the current page

public page_redirect(string $url[, int $status = 302 ][, bool $die = false ]) : void
Parameters
$url : string

destination url

$status : int = 302

http status (302)

$die : bool = false

true to die()

Return values
void

page_reload()

reload the current page

public page_reload([bool $die = false ]) : void
Parameters
$die : bool = false

true to die()

Return values
void

plugin_daily_event()

plugin_daily_event

public plugin_daily_event() : void
Return values
void

plugin_hourly_event()

plugin_hourly_event

public plugin_hourly_event() : void
Return values
void

plugin_ready()

Plugin is fully loaded and ready.

public plugin_ready() : void

Called when plugin is ready (all extensions/filters/shortcodes loaded)

Return values
void

plugin_weekly_event()

plugin_weekly_event

public plugin_weekly_event() : void
Return values
void

pluginHeader()

get plugin value from pluginData (base file header)

public pluginHeader([string $name = null ]) : string
Parameters
$name : string = null

name of plugin data value 'Title' => 'Plugin Name', The name of your plugin, which will be displayed in the Plugins list in the WordPress Admin. 'Description' => 'Description', A short description of the plugin, as displayed in the Plugins section in the WordPress Admin 'Version' => 'Version', The current version number of the plugin. 'RequiresWP' => 'Requires at least', The lowest WordPress version that the plugin will work on. 'RequiresPHP' => 'Requires PHP', The minimum required PHP version. 'RequiresEAC' => 'Requires EAC', The minimum required eacDoojigger version. 'RequiresWC' => 'WC requires at least', The lowest WooCommerce version that the plugin will work on. 'Author' => 'Author', The name of the plugin author. 'AuthorURI' => 'Author URI', The author’s website or profile on another website, such as WordPress.org. 'License' => 'License', The short name (slug) of the plugin’s license (e.g. GPLv2). 'LicenseURI' => 'License URI', A link to the full text of the license (e.g. https://www.gnu.org/licenses/gpl-2.0.html). 'TextDomain' => 'Text Domain', The gettext text domain of the plugin. 'DomainPath' => 'Domain Path', The domain path lets WordPress know where to find the translations. 'Network' => 'Network', Whether the plugin can be activated network-wide. 'PluginURI' => 'Plugin URI', The home page or update link of the plugin. 'UpdateURI' => 'Update URI', Allows third-party plugins to avoid accidentally being overwritten with an update of a plugin of a similar name from the WordPress.org Plugin Directory. 'StableTag' => 'Stable Tag', From readme.txt. 'LastUpdated' => 'Last Updated', From readme.txt. 'Name' The directory name within plugins. 'PluginSlug' The plugin_basename() slug. 'PluginDir' The directory name plugin_dir_path(). 'PluginDirUrl' The plugin url plugin_dir_url() 'VendorDir' The namespace directory within plugin directory.

Return values
string

data value from plugin header

pluginHeaders()

get plugin value array from pluginData (base file header).

public pluginHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

values from plugin header

pluginHelpEnabled()

pluginHelpEnabled

public pluginHelpEnabled([bool $tabs = null ][, bool $fields = null ]) : bool
Parameters
$tabs : bool = null

enable/disable tabs

$fields : bool = null

enable/disable fields

Return values
bool

prefixHookName()

Get the prefixed version of the hook name

public prefixHookName(string $hookName) : string
Parameters
$hookName : string

filter/action name

Return values
string

hookname with prefix

prefixOptionName()

Get the prefixed version input $name suitable for storing in WP options

public prefixOptionName(string $name[, string $prefix = null ]) : string
Parameters
$name : string
$prefix : string = null

override default prefix

Return values
string

option name with prefix

prefixTableName()

Prefix the table name with wpdb prefix and our class prefix (wpdb_classname_tablename)

public prefixTableName(string $name[, string $prefix = null ]) : string
Parameters
$name : string
$prefix : string = null

override default prefix

Return values
string

full table name

prefixTransientName()

Get the prefixed version of the transient name

public prefixTransientName(string $transientName[, string $prefix = null ]) : string
Parameters
$transientName : string

transient name

$prefix : string = null

override default prefix

Return values
string

transient name with prefix

print_admin_notice()

write admin notice immediately, noop when not admin/backend

public print_admin_notice(string $message[, string $errorType = 'notice' ][, string $moreInfo = '' ]) : void
Parameters
$message : string

message text

$errorType : string = 'notice'

'error', 'warning', 'notice', 'success'

$moreInfo : string = ''

additional message text

Return values
void

purge_expired_transients()

purge expired transients for current blog

public purge_expired_transients() : mixed
Return values
mixed

registerNetworkOptions()

add network options (values) for the plugin

public registerNetworkOptions(string|array<string|int, mixed> $optionGroup[, array<string|int, mixed> $optionMeta = [] ]) : void
Parameters
$optionGroup : string|array<string|int, mixed>

group name or [groupname, tabname]]

$optionMeta : array<string|int, mixed> = []

group option meta

Return values
void

registerPluginOptions()

add additional options (values) for the plugin (or extension)

public registerPluginOptions(string|array<string|int, mixed> $optionGroup[, array<string|int, mixed> $optionMeta = [] ]) : void
Parameters
$optionGroup : string|array<string|int, mixed>

group name or [groupname, tabname]]

$optionMeta : array<string|int, mixed> = []

group option meta

Return values
void

remove_action()

remove_action with prefixed name

public remove_action(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

remove_filter()

remove_filter with prefixed name

public remove_filter(string $hookName, mixed ...$args) : mixed
Parameters
$hookName : string

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

rename_network_option()

rename a network option (only network enabled)

public rename_network_option(string $oldOptionName, string $newOptionName) : mixed
Parameters
$oldOptionName : string

old (current) option name

$newOptionName : string

new option name

Return values
mixed

returned from update_option

rename_option()

rename an option

public rename_option(string $oldOptionName, string $newOptionName[, bool $autoload = true ]) : mixed
Parameters
$oldOptionName : string

old (current) option name

$newOptionName : string

new option name

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

rename_site_option()

rename an option (single site or network enabled)

public rename_site_option(string $oldOptionName, string $newOptionName[, bool $autoload = true ]) : mixed
Parameters
$oldOptionName : string

old (current) option name

$newOptionName : string

new option name

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

restore_current_blog()

restore_current_blog wrapper.

public restore_current_blog() : bool

enables calls to $this->before_switch_blog() and $this->after_switch_blog()

Return values
bool

safeEcho()

safeEcho - only echo output when not wp_doing_ajax(), prevents interference with multiple/auto installs

public safeEcho(string $string) : bool
Parameters
$string : string

to echo

Return values
bool

sanitize()

to filter/sanitize a variable

public sanitize(scalar|array<string|int, mixed> $input[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$input : scalar|array<string|int, mixed>

the value to be filtered

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->sanitize($variable);

example

$data = $this->sanitize($variable, 'my_sanitizer');

example

$data = $this->sanitize($variable, FILTER_CALLBACK, 'my_sanitizer');

Return values
mixed

the filtered value, false if filter failed

scheduleEvent()

schedule a single event with callback

public scheduleEvent(string $eventName, int $secondsFromNow, array<string|int, mixed> $arguments, mixed $callback) : void
Parameters
$eventName : string
$secondsFromNow : int

time in seconds in the future

$arguments : array<string|int, mixed>

passed to callback

$callback : mixed
Return values
void

set()

set a stored variable

public set(string $key[, mixed $default = null ]) : string
Parameters
$key : string

stored key

$default : mixed = null
Tags
deprecated

use setVariable()

Return values
string

stored variable (serialized)

set a cookie supporting wp_consent if enabled

public set_cookie(string $name, string $value, string|int $expires[, array<string|int, mixed> $options = [] ][, mixed $consent = [] ]) : bool
Parameters
$name : string

the cookie name

$value : string

the cookie value

$expires : string|int

cookie expiration in seconds or timestamp or string 'delete', 'expired', 'session', 'n days', 'n months', etc.

$options : array<string|int, mixed> = []

cookie parameters 'path', 'domain', 'secure', 'httponly', 'samesite'.

$consent : mixed = []

(array) consent parameters or (string) category or true, already registered 'plugin_or_service', 'category', 'function', ...

Return values
bool

success or failure (as best we can tell)

set a cookie's consent information

public set_cookie_consent(string $name, array<string|int, mixed>|string $consent[, bool $register = true ][, array<string|int, mixed> $defaults = [] ]) : array<string|int, mixed>
Parameters
$name : string

the cookie name

$consent : array<string|int, mixed>|string

consent parameters or category 'plugin_or_service', 'category', 'function', ...

$register : bool = true

with wp_add_cookie_info()

$defaults : array<string|int, mixed> = []

default consent parameters

Return values
array<string|int, mixed>

$consent

set a cookie expiration as integer and string

public set_cookie_expiration(string|int $expires[, bool $getString = true ]) : array<string|int, mixed>
Parameters
$expires : string|int

cookie expiration in seconds or timestamp or string 'delete', 'expired', 'session', 'n days', 'n months', etc.

$getString : bool = true

(false) return array when true

Return values
array<string|int, mixed>

[ $expInt, $expStr ]

set_network_option()

set a network option value (only network enabled)

public set_network_option(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

value to set

Tags
deprecated

use update_network_option()

Return values
mixed

option value

set_option()

set an option value

public set_option(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

value to set

Tags
deprecated

use update_option()

Return values
mixed

option value

set_site_option()

temporarily set an option value (single site or network enabled)

public set_site_option(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

value to set

Tags
deprecated

use update_site_option()

Return values
mixed

option value

set_site_transient()

A wrapper function to WP set_site_transient() with prefixed transient name

public set_site_transient(string $transientName, mixed $value, int $expiration) : bool
Parameters
$transientName : string

transient name

$value : mixed

value to save

$expiration : int

time until expiration in seconds. Default 0 (no expiration)

Return values
bool

set_transient()

A wrapper function to WP set_transient() with prefixed transient name

public set_transient(string $transientName, mixed $value, int $expiration) : bool
Parameters
$transientName : string

transient name

$value : mixed

value to save

$expiration : int

time until expiration in seconds. Default 0 (no expiration)

Return values
bool

setAdvancedMode()

set advanced mode - aids in complexity and/or licensing limits.

public setAdvancedMode([bool $is = true ][, string $what = null ][, string $level = null ]) : void
Parameters
$is : bool = true
  • is or is not
$what : string = null
  • what is in advanced mode (global, settings, ...)
$level : string = null
  • what level is in advanced mode (default, basic, standard, pro)
Tags
example:

$this->setAdvancedMode(true,'settings');

Return values
void

setVariable()

set a stored variable

public setVariable(string $key, mixed $value) : string
Parameters
$key : string

stored key

$value : mixed

stored variable

Return values
string

stored variable (serialized)

standardizeOptionGroup()

standardize the options group display name

public standardizeOptionGroup(string|array<string|int, mixed> $optionGroup) : string|array<string|int, mixed>
Parameters
$optionGroup : string|array<string|int, mixed>

group name or [groupname, tabname]]

Return values
string|array<string|int, mixed>

standardized option group name

standardizeOptionName()

standardize the option name

public standardizeOptionName(string $optionName[, bool $toLC = true ]) : string
Parameters
$optionName : string

option name

$toLC : bool = true

convert to lower case

Return values
string

standardized option name

switch_to_blog()

switch_to_blog wrapper.

public switch_to_blog(string $new_blog_id) : bool

enables calls to $this->before_switch_blog() and $this->after_switch_blog()

Parameters
$new_blog_id : string

switching to blog

Return values
bool

always true

text_to_array()

parse delimited string to arrray

public text_to_array(string $string[, array<string|int, mixed> $delimiters = [';'] ]) : array<string|int, mixed>
Parameters
$string : string

delimited by \n or $delimiters

$delimiters : array<string|int, mixed> = [';']

split string on these delimiters

Return values
array<string|int, mixed>

unprefixOptionName()

Remove the prefix from the input $name

public unprefixOptionName(string $name[, string $prefix = null ]) : string
Parameters
$name : string
$prefix : string = null

override default prefix

Return values
string

option name without prefix

update_network_option()

update_network_option() with prefixed option name (only network enabled)

public update_network_option(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

Return values
mixed

option value

update_network_option_encrypt()

encrypt and update_network_option() with prefixed option name

public update_network_option_encrypt(string $optionName, mixed $value) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

Return values
mixed

returned from update_option

update_option()

update_option() with prefixed option name

public update_option(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

option value

update_option_encrypt()

encrypt and update_option() with prefixed option name

public update_option_encrypt(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

update_site_option()

update_site_option() with prefixed option name (single site or network enabled)

public update_site_option(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

update_site_option_encrypt()

encrypt and update_site_option() with prefixed option name (single site or network enabled)

public update_site_option_encrypt(string $optionName, mixed $value[, bool $autoload = true ]) : mixed
Parameters
$optionName : string

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

varCookie()

Safely get $_COOKIE data using PHP filter.

public varCookie(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$name : string

the name of the cookie

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->varCookie('cookie_name');

example

$data = $this->get_cookie('cookie_name','default value');

Return values
mixed

the filtered value, false if filter failed, null if not found

varGet()

Safely get $_GET data if set using PHP filter

public varGet(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$name : string

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->varGet('get_name');

Return values
mixed

the filtered value, false if filter failed, null if not found

varPost()

Safely get $_POST data if set using PHP filter

public varPost(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$name : string

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->varPost('post_name');

Return values
mixed

the filtered value, false if filter failed, null if not found

varRequest()

Safely get $_REQUEST data if set, using PHP filter

public varRequest(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$name : string

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->varRequest('param_name');

Return values
mixed

the filtered value, false if filter failed, null if not found

varServer()

Safely get $_SERVER or $_ENV data if set, using PHP filter

public varServer(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = null ]) : mixed
Parameters
$name : string

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

$options : int|array<string|int, mixed>|callable = null

passed to the filter

Tags
example

$data = $this->varServer('server_name');

Return values
mixed

the filtered value, false if filter failed, null if not found

wp_kses()

customized wp_kses

public wp_kses(string $content[, array<string|int, array<string|int, mixed>> $allowed_html = [] ][, array<string|int, string> $allowed_protocols = [] ]) : string
Parameters
$content : string

Text content to filter.

$allowed_html : array<string|int, array<string|int, mixed>> = []

An array of allowed HTML elements and attributes,

$allowed_protocols : array<string|int, string> = []

An array of allowed URL protocols.

Return values
string

Filtered content containing only the allowed HTML.

Search results