{eac}Doojigger Reference

abstract_backend extends abstract_core
in package
Uses version_compare

{eac}Doojigger for WordPress - Plugin back-end (administration) methods and hooks.

Tags
category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

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

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

\EarthAsylumConsulting\abstract_context

uses
abstract_core

Table of Contents

ENVIRONMENT_LIVE  = 'Production (live)'
ENVIRONMENT_TEST  = 'Development (test)'
EXTENSION_BASE_CLASS  = __NAMESPACE__ . '\\abstract_extension'
NETWORK_OPTION_NAME  = 'network_options'
OPTION_META_KEYS  = ['type' => '', 'label' => '', 'title' => '', 'before' => '', 'default' => '', 'after' => '', 'info' => '', 'attributes' => []]
PLUGIN_EXTENSION_TRANSIENT  = 'plugin_loaded_extensions'
PLUGIN_HEADER_TRANSIENT  = 'plugin_header_data'
PLUGIN_INSTALLED_EXTENSIONS  = 'plugin_installed_extensions'
PLUGIN_INSTALLED_VERSION  = 'plugin_installed_version'
PLUGIN_OPTION_NAME  = 'plugin_options'
$className  : string
$date_format  : string
$date_time_format  : string
$defaultTabs  : array<string|int, mixed>
$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_notice()  : void
Add admin notice, maybe after all_admin_notices has fired.
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_option_error()  : void
helper function for option settings error
add_option_info()  : void
helper function for option settings info
add_option_notice()  : void
helper function for option settings notice
add_option_success()  : void
helper function for option settings success
add_option_warning()  : void
helper function for option settings warning
add_settings_error()  : void
like WP add_settings_error() - add a settings error.
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.
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
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
deleteTransients()  : void
delete identifiable transients belonging to this plugin
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_network_backup()  : void
backup current options for all sites
do_network_restore()  : void
restore options for all sites
do_option_backup()  : void
backup currently registered options
do_option_Restore()  : void
restore previously backed up options
eacDoojigger_ready()  : void
eacDoojigger is fully loaded and ready.
error()  : object
wp_error with logging
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_config_path()  : string|bool
Generic config file writable pathname (administrators only)
get_network_backup()  : array<string|int, mixed>
get the previously backed up network options
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_backup()  : array<string|int, mixed>
get the previously backed up options
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_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
getMySqlVersion()  : string|false
Query MySQL DB for its version
getNetworkMetaData()  : array<string|int, mixed>
Get the $networkMetaData array (ungrouped)
getOptionMetaData()  : array<string|int, mixed>
Get the $optionMetaData array (ungrouped)
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).
getSavedNetworkOptions()  : array<string|int, mixed>
get all saved options for this network
getSavedPluginOptions()  : array<string|int, mixed>
get all saved options for this plugin
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
htaccess_handle()  : string|bool
Get the .htaccess pathname (administrators only)
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_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)
isAjaxRequest()  : bool
detect an ajax request
isCurrentScreen()  : 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
isVersionCompare()  : bool|int
version compare
isVersionCompatable()  : bool
is version compatable (>=)
isVersionEqualTo()  : bool
version compare equal to
isVersionGreaterThan()  : bool
version compare greater than
isVersionGreaterThanEqualTo()  : bool
version compare greater than or equal to
isVersionLessThan()  : bool
version compare less than
isVersionLessThanEqualTo()  : bool
version compare less than or equal to
isVersionNotEqualTo()  : bool
version compare not equal to
loadAllExtensions()  : void
Called after instantiation of this class to load all extension classes.
log()  : bool
console/file logging - info (notice)
log_write()  : bool
console/file logging
logAlways()  : bool
console/file logging - always
logData()  : bool
console/file logging - data (warning)
logDebug()  : bool
console/file logging - debug
logError()  : bool
console/file logging - error
logInfo()  : bool
console/file logging - info (notice)
logNotice()  : bool
console/file logging - notice
logv()  : bool
console/file logging - debug
logWarning()  : bool
console/file logging - warning
minifyString()  : string
conservative minify for JS or CSS content
options_settings_page()  : void
Creates HTML for the Administration page to set options for this plugin.
page_redirect()  : void
redirect the current page
page_reload()  : void
reload the current page
plugin_admin_activated()  : void
Activate the plugin (via register_activation_hook)
plugin_admin_add_settings_help()  : void
Add contextual help via plugin_help trait (on admin_menu action)
plugin_admin_add_settings_link()  : void
Add Setting link on Plugins page - on 'plugin_action_links_{plugin}' action
plugin_admin_add_settings_menu()  : void
Puts the configuration page in the menus - on 'admin_menu' action
plugin_admin_deactivated()  : void
Deactivate the plugin (via register_deactivation_hook)
plugin_admin_installed()  : void
Install/Upgrade the plugin (via admin_init, there is no register_install_hook)
plugin_admin_notices()  : void
settings errors / admin notices - on 'all_admin_notices' action.
plugin_admin_upgraded()  : void
after plugin upgrade on 'upgrader_process_complete' filter
plugin_daily_event()  : void
plugin_daily_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
output admin notice immediately, like wp_admin_notice()
registerNetworkOptions()  : void
add network options (meta) for the plugin
registerPluginOptions()  : void
add additional options (meta) 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_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
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.
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)
userini_handle()  : string|bool
Get the .user.ini pathname (administrators only)
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
wpconfig_handle()  : object|bool
Get the wp-config.php editor (administrators only)

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

OPTION_META_KEYS

public array<string|int, mixed> OPTION_META_KEYS = ['type' => '', 'label' => '', 'title' => '', 'before' => '', 'default' => '', 'after' => '', 'info' => '', 'attributes' => []]

required options meta keys

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_INSTALLED_EXTENSIONS

public string PLUGIN_INSTALLED_EXTENSIONS = 'plugin_installed_extensions'

option name for installed extension versions

PLUGIN_INSTALLED_VERSION

public string PLUGIN_INSTALLED_VERSION = 'plugin_installed_version'

option name for installed version

PLUGIN_OPTION_NAME

public string PLUGIN_OPTION_NAME = 'plugin_options'

plugin options name

Properties

$className

public string $className

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

Tags
used-by

getClassName()

$defaultTabs

public array<string|int, mixed> $defaultTabs = array('general')

default tab name(s) - set to control order

$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 = 'sanitize_textarea_field' ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = 'sanitize_textarea_field'
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 = 'sanitize_textarea_field' ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = 'sanitize_textarea_field'
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 = 'sanitize_textarea_field' ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = 'sanitize_textarea_field'
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 = 'sanitize_textarea_field' ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = 'sanitize_textarea_field'
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 = 'sanitize_textarea_field' ]) : mixed
Parameters
$name : string
$filter : mixed = FILTER_CALLBACK
$options : mixed = 'sanitize_textarea_field'
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_admin_notice()

Add admin notice, maybe after all_admin_notices has fired.

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

message text

$errorType : string = 'info'

'error', 'warning', 'info', '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_option_error()

helper function for option settings error

public add_option_error(string $optionName, string $message[, string $errorType = 'error' ][, string $moreInfo = '' ]) : void
Parameters
$optionName : string

option/field name

$message : string

error / notice message

$errorType : string = 'error'

error type (error)

$moreInfo : string = ''

additional line

Return values
void

add_option_info()

helper function for option settings info

public add_option_info(string $optionName, string $message[, string $errorType = 'info' ][, string $moreInfo = '' ]) : void
Parameters
$optionName : string

option/field name

$message : string

error / notice message

$errorType : string = 'info'

error type (info)

$moreInfo : string = ''

additional line

Return values
void

add_option_notice()

helper function for option settings notice

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

option/field name

$message : string

error / notice message

$errorType : string = 'notice'

error type (notice)

$moreInfo : string = ''

additional line

Return values
void

add_option_success()

helper function for option settings success

public add_option_success(string $optionName, string $message[, string $errorType = 'success' ][, string $moreInfo = '' ]) : void
Parameters
$optionName : string

option/field name

$message : string

error / notice message

$errorType : string = 'success'

error type (success)

$moreInfo : string = ''

additional line

Return values
void

add_option_warning()

helper function for option settings warning

public add_option_warning(string $optionName, string $message[, string $errorType = 'warning' ][, string $moreInfo = '' ]) : void
Parameters
$optionName : string

option/field name

$message : string

error / notice message

$errorType : string = 'warning'

error type (warning)

$moreInfo : string = ''

additional line

Return values
void

add_settings_error()

like WP add_settings_error() - add a settings error.

public add_settings_error(string $setting, string $code, string $message[, string $type = 'error' ]) : void

prefer using add_option_error() which in turn uses this

Parameters
$setting : string

setting id

$code : string

field id

$message : string

error / notice message

$type : string = 'error'
Return values
void

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

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

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

deleteTransients()

delete identifiable transients belonging to this plugin

public deleteTransients([bool $isNetwork = false ]) : void
Parameters
$isNetwork : bool = false
Tags
used-by

flush_caches()

used-by

plugin_admin_deactivated()

Return values
void

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

do_network_backup()

backup current options for all sites

public do_network_backup() : void
Return values
void

do_network_restore()

restore options for all sites

public do_network_restore() : void
Return values
void

do_option_backup()

backup currently registered options

public do_option_backup() : void
Return values
void

do_option_Restore()

restore previously backed up options

public do_option_Restore() : void
Return values
void

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 = '' ][, scalar $id = null ]) : object
Parameters
$code : string|int|object

Error code or wp_error or throwable instance

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : scalar = null

optional, source id

Return values
object

WP_Error object

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 = '' ][, scalar $id = null ]) : void
Parameters
$code : string|int

Error code

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : scalar = 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_config_path()

Generic config file writable pathname (administrators only)

public get_config_path([string $filePath = null ][, string $fileId = '' ][, bool $useWPfs = true ]) : string|bool
Parameters
$filePath : string = null
  • path to config file
$fileId : string = ''
  • used for hook name
$useWPfs : bool = true

use wp filesystem (default)

Return values
string|bool

get_network_backup()

get the previously backed up network options

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

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

get the previously backed up options

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

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_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

getMySqlVersion()

Query MySQL DB for its version

public getMySqlVersion() : string|false
Return values
string|false

getNetworkMetaData()

Get the $networkMetaData array (ungrouped)

public getNetworkMetaData([string $optionGroup = '' ]) : array<string|int, mixed>
Parameters
$optionGroup : string = ''

group name

Return values
array<string|int, mixed>

[optionName=>optionMeta]

getOptionMetaData()

Get the $optionMetaData array (ungrouped)

public getOptionMetaData([string $optionGroup = '' ]) : array<string|int, mixed>
Parameters
$optionGroup : string = ''

group name

Return values
array<string|int, mixed>

[optionName=>optionMeta]

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

getSavedNetworkOptions()

get all saved options for this network

public getSavedNetworkOptions([string $prefix = null ]) : array<string|int, mixed>
Parameters
$prefix : string = null

override default option prefix

Return values
array<string|int, mixed>

full (prefixed) option_name => option_value

getSavedPluginOptions()

get all saved options for this plugin

public getSavedPluginOptions([string $prefix = null ]) : array<string|int, mixed>
Parameters
$prefix : string = null

override default option prefix

Return values
array<string|int, mixed>

full (prefixed) option_name => option_value

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 = false ]) : string
Parameters
$extension : mixed = null
$default : mixed = false
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

htaccess_handle()

Get the .htaccess pathname (administrators only)

public htaccess_handle([string $filePath = null ]) : string|bool
Parameters
$filePath : string = null
  • path to .htaccess
Return values
string|bool

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_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

isAjaxRequest()

detect an ajax request

public isAjaxRequest() : bool
Return values
bool

isCurrentScreen()

get or check the current screen name

public isCurrentScreen([mixed $screen = null ]) : bool|string
Parameters
$screen : mixed = null
Return values
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

isVersionCompare()

version compare

public isVersionCompare(string $version1, string $version2[, mixed $eqVal = true ][, mixed $ltVal = -1 ][, mixed $gtVal = +1 ]) : bool|int
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

$eqVal : mixed = true

returned if $versions1 = $version2 (true)

$ltVal : mixed = -1

returned if $versions1 < $version2 (-1)

$gtVal : mixed = +1

returned if $versions1 > $version2 (1)

Return values
bool|int

true if $versions1 = $version2, $ltVal if $versions1 < $version2, $gtVal if $versions1 > $version2

isVersionCompatable()

is version compatable (>=)

public isVersionCompatable(string $version, string $required) : bool
Parameters
$version : string

(n.n.n)

$required : string

(n.n.n)

Return values
bool

true if $version >= $required

isVersionEqualTo()

version compare equal to

public isVersionEqualTo(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 = $version2

isVersionGreaterThan()

version compare greater than

public isVersionGreaterThan(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 > $version2

isVersionGreaterThanEqualTo()

version compare greater than or equal to

public isVersionGreaterThanEqualTo(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 >= $version2

isVersionLessThan()

version compare less than

public isVersionLessThan(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 < $version2

isVersionLessThanEqualTo()

version compare less than or equal to

public isVersionLessThanEqualTo(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 <= $version2

isVersionNotEqualTo()

version compare not equal to

public isVersionNotEqualTo(string $version1, string $version2) : bool
Parameters
$version1 : string

(n.n.n)

$version2 : string

(n.n.n)

Return values
bool

true if $versions1 <> $version2

loadAllExtensions()

Called after instantiation of this class to load all extension classes.

public loadAllExtensions() : void

Tracks extension versions and upgrades in backend

Return values
void

log()

console/file logging - info (notice)

public log(mixed $var[, mixed $context = null ]) : bool
Parameters
$var : mixed
$context : mixed = null
Tags
deprecated

use logNotice()

Return values
bool

log_write()

console/file logging

public log_write(int $level[, mixed $var = null ][, scalar $context = null ]) : bool
Parameters
$level : int

the debugging log level

$var : mixed = null

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logAlways()

console/file logging - always

public logAlways(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logData()

console/file logging - data (warning)

public logData(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logDebug()

console/file logging - debug

public logDebug(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logError()

console/file logging - error

public logError(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logInfo()

console/file logging - info (notice)

public logInfo(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logNotice()

console/file logging - notice

public logNotice(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logv()

console/file logging - debug

public logv(mixed $var[, mixed $context = null ]) : bool
Parameters
$var : mixed
$context : mixed = null
Tags
deprecated

use logDebug()

Return values
bool

logWarning()

console/file logging - warning

public logWarning(mixed $var[, scalar $context = null ]) : bool
Parameters
$var : mixed

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

minifyString()

conservative minify for JS or CSS content

public minifyString(string $content) : string
Parameters
$content : string
Return values
string

minified content

options_settings_page()

Creates HTML for the Administration page to set options for this plugin.

public options_settings_page() : void
Return values
void

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

Activate the plugin (via register_activation_hook)

public plugin_admin_activated([bool $isNetwork = false ]) : void

In multisite environment, if network-enabled, network admin calls activate for each active site. May occur twice on primary site (as network admin and not)

Parameters
$isNetwork : bool = false

true if network activated

Return values
void

plugin_admin_add_settings_help()

Add contextual help via plugin_help trait (on admin_menu action)

public plugin_admin_add_settings_help() : void
Return values
void

Add Setting link on Plugins page - on 'plugin_action_links_{plugin}' action

public plugin_admin_add_settings_link(array<string|int, mixed> $links, string $plugin_file[, mixed $plugin_data = [] ]) : void
Parameters
$links : array<string|int, mixed>
$plugin_file : string
$plugin_data : mixed = []
Return values
void

plugin_admin_add_settings_menu()

Puts the configuration page in the menus - on 'admin_menu' action

public plugin_admin_add_settings_menu() : void
Return values
void

plugin_admin_deactivated()

Deactivate the plugin (via register_deactivation_hook)

public plugin_admin_deactivated([bool $isNetwork = false ]) : void

In multisite environment, if network-enabled, network admin calls deactivate for each active site. May occur twice on primary site (as network admin and not)

Parameters
$isNetwork : bool = false

true if network deactivated

Return values
void

plugin_admin_installed()

Install/Upgrade the plugin (via admin_init, there is no register_install_hook)

public plugin_admin_installed() : void
Return values
void

plugin_admin_notices()

settings errors / admin notices - on 'all_admin_notices' action.

public plugin_admin_notices() : void

Add an action to output settings errors in the page footer

Return values
void

plugin_admin_upgraded()

after plugin upgrade on 'upgrader_process_complete' filter

public plugin_admin_upgraded(object $upgrader_object, array<string|int, mixed> $hook_extra) : void

$hook_extra may only have 'action' and 'type'; action may be 'update' or 'install' (on a manual update). Since we can't check that it's actually our plugin being updated, we do it for any plugin. And can't perform updates since we're still in the old version of our code at this point. We may pass through here more than once, if network-enabled. In multisite environment, network admin calls upgrade for each active site.

Parameters
$upgrader_object : object
$hook_extra : array<string|int, mixed>
Return values
void

plugin_daily_event()

plugin_daily_event -

public plugin_daily_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

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

output admin notice immediately, like wp_admin_notice()

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

message text

$errorType : string = 'info'

'error', 'warning', 'info', 'success'

$moreInfo : string = ''

additional message text

Return values
void

registerNetworkOptions()

add network options (meta) 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 (meta) 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_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

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

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

userini_handle()

Get the .user.ini pathname (administrators only)

public userini_handle([string $filePath = null ]) : string|bool
Parameters
$filePath : string = null
  • path to .user.ini
Return values
string|bool

varCookie()

Safely get $_COOKIE data using PHP filter.

public varCookie(string $name[, int|callable $filter = FILTER_CALLBACK ][, int|array<string|int, mixed>|callable $options = 'sanitize_textarea_field' ]) : 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 = 'sanitize_textarea_field'

passed to the filter

Tags
example

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

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 = 'sanitize_textarea_field' ]) : 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 = 'sanitize_textarea_field'

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 = 'sanitize_textarea_field' ]) : 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 = 'sanitize_textarea_field'

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 = 'sanitize_textarea_field' ]) : 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 = 'sanitize_textarea_field'

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 = 'sanitize_textarea_field' ]) : 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 = 'sanitize_textarea_field'

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

wpconfig_handle()

Get the wp-config.php editor (administrators only)

public wpconfig_handle([string $filePath = null ][, bool $useTransformer = true ]) : object|bool
Parameters
$filePath : string = null
  • path to wp-config.php
$useTransformer : bool = true
Return values
object|bool

Search results