abstract_backend
extends abstract_core
in package
Uses
version_compare, code_editor
{eac}Doojigger for WordPress - Plugin back-end (administration) methods and hooks.
Tags
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' => '', 'tooltip' => '', 'advanced' => false]
- 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'
- 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
- $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.
- access_denied() : WP_Error
- output forbidden response
- 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, 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.
- addClassNamePrefix() : string
- Get the prefix to the input $name suitable for storing
- addShortcodes() : void
- Add plugin shortcodes.
- admin_color_scheme() : array<string|int, mixed>
- Get the selected admin color scheme
- 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
- codeedit_enqueue() : void
- enqueue code mirror
- codeedit_get_codemirror() : string
- add code mirror textarea
- codeedit_get_wpeditor() : string
- add wp_editor
- config_advanced_mode() : void
- config advanced mode - aids in complexity and/or licensing limits.
- cookie_consent_patch() : 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 based on http request
- 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_admin_action_links() : void
- process action links from admin page.
- 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
- doing_ajax() : bool
- detect an ajax request
- 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_config_path() : string|bool
- Generic config file writable pathname (administrators only)
- 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_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_output_file() : string|wp_error
- When creating a file, find appropriate path a. where the debug log is stored b. in the upload folder
- 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
- getClassNamePrefix() : string
- get the class name prefix
- getClassObject() : object
- get class or extension object
- getCurrentTab() : string
- get settings tab (i.e. the page for setting options)
- 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
- get extension, loaded and enabled
- getFilterCallback() : array<string|int, mixed>
- to parse the PHP filter name and options
- 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)
- 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
- getRequestHost() : string
- Returns the local host from home_url
- getRequestOrigin() : string
- get the the request origin
- getRequestParts() : string
- get the current url part(s) based on WP request
- getRequestPath() : string
- get the current url path based on WP request
- getRequestURL() : string
- get the current url based on WP request
- 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_action_count() : int
- has_action with prefixed name - returns count of filters
- has_cookie_consent() : bool
- check consent is loaded and category set (convenience method)
- has_filter() : mixed
- has_filter with prefixed name
- has_filter_count() : int
- has_filter with prefixed name - returns count of filters
- hasClassNamePrefix() : bool
- has the class name prefix
- 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_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
- alias to getExtension - is extension loaded and enabled
- isFalse() : bool
- is value false? - false,off,no,0
- isIpInList() : bool
- Check an IP address against list of IPs/subnets
- 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() : 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.
- options_settings_page() : void
- Creates HTML for the Administration page to set options for this plugin.
- options_settings_page_admin_style() : string
- Get admin color variables
- options_settings_page_block() : void
- for html input fields, get input field block
- options_settings_page_field() : void
- create the correct form input control for an option (used here and in custom WP_POST fields)
- options_settings_page_help() : void
- add contextual help from meta data
- options_settings_page_jquery() : void
- Creates Script tag for the jQuery/jQuery-ui.
- options_settings_page_sanitize() : mixed
- Sanitize _POSTed fields
- options_settings_page_section() : void
- for html input fields, get section headers
- options_settings_page_style() : string
- Creates Style tag for the Administration page to set options for this plugin.
- options_settings_page_validate() : mixed
- Validate _POSTed fields
- 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_plugin_meta() : void
- Add meta value to plugin row - on after_plugin_row_meta action
- plugin_admin_add_settings_help() : void
- Add contextual help via plugin_help trait (on admin_menu action)
- plugin_admin_add_settings_link() : array<string|int, mixed>
- 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_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 of the option name
- 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()
- purge_expired_transients() : mixed
- purge expired transients for current blog
- 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
- removeClassNamePrefix() : string
- Remove the prefix from the input $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
- 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
- toKeyString() : string
- convert a display title/name to a key/class string
- unprefixOptionName() : string
- Get the un-prefixed version of the option 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
- wp_action_count() : int
- wp has_action - returns count of actions
- wp_filter_count() : int
- wp has_filter - returns count of filters
- wp_kses() : string
- customized wp_kses
- 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' => '', 'tooltip' => '', 'advanced' => false]
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
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
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
$cookie_default_service
public
string
$cookie_default_service
= ''
default consent service name (set by using class)
$date_format
public
string
$date_format
date format
$date_time_format
public
string
$date_time_format
date/time format
$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
$networkOptions
public
array<string|int, mixed>
$networkOptions
= array()
network options/settings array (optionName=>value)
$plugin
public
object
$plugin
$PLUGIN_SLUG
public
string
$PLUGIN_SLUG
plugin slug name (directory/pluginname.php)
$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
$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)
$time_format
public
string
$time_format
time format
$wpdb
public
object
$wpdb
WordPress DB
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
Return values
object|null —_COOKIE()
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
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
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
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
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
Return values
mixed —access_denied()
output forbidden response
public
access_denied([string $logMsg = '' ], int $status[, string $message = '' ]) : WP_Error
Parameters
- $logMsg : string = ''
-
to log error message
- $status : int
-
override default status
- $message : string = ''
-
override default message
Tags
Return values
WP_Error —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_action_link()
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, 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
addActionsAndFilters()
Add plugin actions and filter.
public
addActionsAndFilters() : void
Called after loading, instantiating, and initializing all extensions
Tags
Return values
void —addClassNamePrefix()
Get the prefix to the input $name suitable for storing
public
addClassNamePrefix(string $name[, string $prefix = null ]) : string
Parameters
- $name : string
-
option/hook/table name
- $prefix : string = null
-
override default prefix
Return values
string —option/hook/table name with prefix
addShortcodes()
Add plugin shortcodes.
public
addShortcodes() : void
Called after loading, instantiating, and initializing all extensions
Tags
Return values
void —admin_color_scheme()
Get the selected admin color scheme
public
admin_color_scheme() : array<string|int, mixed>
Return values
array<string|int, mixed> —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
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
codeedit_enqueue()
enqueue code mirror
public
codeedit_enqueue([string $styles = '' ][, array<string|int, mixed> $options = [] ]) : void
Parameters
- $styles : string = ''
-
optional code editor styling
- $options : array<string|int, mixed> = []
-
optional code editor settings
Return values
void —codeedit_get_codemirror()
add code mirror textarea
public
codeedit_get_codemirror(string $name[, string $value = '' ][, string $type = 'html' ][, string $class = '' ][, string $attributes = '' ]) : string
Parameters
- $name : string
-
field name/id
- $value : string = ''
-
field value
- $type : string = 'html'
-
code editor type (js, css, html, php)
- $class : string = ''
-
optional class name(s)
- $attributes : string = ''
-
optional field attributes
Return values
string —textarea field
codeedit_get_wpeditor()
add wp_editor
public
codeedit_get_wpeditor(string $name[, string $value = '' ][, string $class = '' ][, string $wpoptions = [] ][, string $tinymce = [] ][, string $quicktags = [] ]) : string
Parameters
- $name : string
-
field name/id
- $value : string = ''
-
field value
- $class : string = ''
-
optional class name(s)
- $wpoptions : string = []
-
optional override wp_editor options
- $tinymce : string = []
-
optional override tinymce options
- $quicktags : string = []
-
optional override quicktags options
Return values
string —textarea field
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 —cookie_consent_patch()
enqueue javascripts to patch consent interface between browser and server
public
cookie_consent_patch() : void
Return values
void —createUniqueId()
Generates a Universally Unique IDentifier (UUID), version 4.
public
createUniqueId() : string
Tags
Return values
string —UUID
currentURL()
get the current url based on http request
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
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_admin_action_links()
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 —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 —doing_ajax()
detect an ajax request
public
doing_ajax() : bool
Tags
Return values
bool —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
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
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
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_cookie()
get a cookie (convenience method, since we have set_cookie)
public
get_cookie(string|array<string|int, mixed> $name[, string $default = null ]) : string
Parameters
- $name : string|array<string|int, mixed>
-
the cookie name (and alternates)
- $default : string = null
-
if cookie not set
Return values
string —cookie value
get_cookie_consent()
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_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
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
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_output_file()
When creating a file, find appropriate path a. where the debug log is stored b. in the upload folder
public
get_output_file(string $filePath[, bool $create = true ][, string $firstRecord = '' ]) : string|wp_error
Parameters
- $filePath : string
- $create : bool = true
-
create path/file
- $firstRecord : string = ''
Return values
string|wp_error —file path name
get_page_footer()
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
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
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 —getClassNamePrefix()
get the class name prefix
public
getClassNamePrefix([string $prefix = null ]) : string
Parameters
- $prefix : string = null
-
override default prefix
Return values
string —short_classname_
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
getCurrentTab()
get settings tab (i.e. the page for setting options)
public
getCurrentTab([mixed $tabNames = null ]) : string
Parameters
- $tabNames : mixed = null
Return values
string —the settings slug name
getDocumentationLink()
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()
get extension, loaded and enabled
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
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]
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
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
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 __ (__)'
getRequestHost()
Returns the local host from home_url
public
getRequestHost() : string
Tags
Return values
string —getRequestOrigin()
get the the request origin
public
getRequestOrigin() : string
Tags
Return values
string —the origin host
getRequestParts()
get the current url part(s) based on WP request
public
getRequestParts(mixed $part) : string
Parameters
- $part : mixed
Tags
Return values
string —getRequestPath()
get the current url path based on WP request
public
getRequestPath() : string
Tags
Return values
string —getRequestURL()
get the current url based on WP request
public
getRequestURL() : string
Tags
Return values
string —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
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
getSettingsLink()
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([mixed $tab = null ]) : string
Parameters
- $tab : mixed = null
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
getSupportLink()
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 $default = 'US' ]) : string
Parameters
- $default : string = 'US'
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 $callback = false ]) : mixed
Parameters
- $hookName : string
-
the name of the action
- $callback : mixed = false
Return values
mixed —has_action_count()
has_action with prefixed name - returns count of filters
public
has_action_count(string $hookName[, mixed $callback = false ]) : int
Parameters
- $hookName : string
-
the name of the action
- $callback : mixed = false
Return values
int —has_cookie_consent()
check consent is loaded and category set (convenience method)
public
has_cookie_consent([string $category = null ]) : bool
Parameters
- $category : string = null
-
consent category to check.
Return values
bool —has_filter()
has_filter with prefixed name
public
has_filter(string $hookName[, mixed $callback = false ]) : mixed
Parameters
- $hookName : string
-
the name of the filter
- $callback : mixed = false
Return values
mixed —has_filter_count()
has_filter with prefixed name - returns count of filters
public
has_filter_count(string $hookName[, mixed $callback = false ]) : int
Parameters
- $hookName : string
-
the name of the filter
- $callback : mixed = false
Return values
int —hasClassNamePrefix()
has the class name prefix
public
hasClassNamePrefix(string $name[, string $prefix = null ]) : bool
Parameters
- $name : string
-
option/hook/table name
- $prefix : string = null
-
override default prefix
Return values
bool —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_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
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
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
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
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|array<string|int, mixed> $level = null ]) : bool
Parameters
- $what : string = null
-
- what is in advanced mode
- $level : string|array<string|int, mixed> = null
-
- what level(s) is in advanced mode (default, basic, standard, pro)
Tags
Return values
bool —- is or is not
isAjaxRequest()
now an alias to $tthis->doing_ajax()
public
isAjaxRequest() : bool
Tags
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()
alias to getExtension - 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 —isIpInList()
Check an IP address against list of IPs/subnets
public
isIpInList(string $ipAddress, array<string|int, mixed> $ipList) : bool
Parameters
- $ipAddress : string
-
IPv4 or IPv6 address
- $ipList : array<string|int, mixed>
-
list of IP addresses or subnets (cidr)
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
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()
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
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
Return values
string —options_settings_page()
Creates HTML for the Administration page to set options for this plugin.
public
options_settings_page() : void
Return values
void —options_settings_page_admin_style()
Get admin color variables
public
options_settings_page_admin_style() : string
Tags
Return values
string —the root style variables
options_settings_page_block()
for html input fields, get input field block
public
options_settings_page_block(string $optionKey, array<string|int, mixed> $optionMeta, mixed $optionValue[, string $width = '50' ][, string $height = '4' ]) : void
Parameters
- $optionKey : string
-
option/field name
- $optionMeta : array<string|int, mixed>
-
meta-data for $fieldName
- $optionValue : mixed
-
current value for $fieldName
- $width : string = '50'
-
optional, override default field width (columns)
- $height : string = '4'
-
optional, override default field height (rows)
Return values
void —options_settings_page_field()
create the correct form input control for an option (used here and in custom WP_POST fields)
public
options_settings_page_field(string $optionKey, array<string|int, mixed> $optionMeta, mixed $savedOptionValue[, string $width = '50' ][, string $height = '4' ]) : void
Parameters
- $optionKey : string
-
option name
- $optionMeta : array<string|int, mixed>
-
meta-data for $optionKey
- $savedOptionValue : mixed
-
current value for $optionKey
- $width : string = '50'
-
optional, override default field width (columns)
- $height : string = '4'
-
optional, override default field height (rows)
Return values
void —options_settings_page_help()
add contextual help from meta data
public
options_settings_page_help(string|array<string|int, mixed> $helpTabs, string $optionKey, array<string|int, mixed> $optionMeta) : void
Parameters
- $helpTabs : string|array<string|int, mixed>
-
[$groupname,$tabname] - uses first found in help tabs
- $optionKey : string
-
option name
- $optionMeta : array<string|int, mixed>
-
option meta data
Return values
void —options_settings_page_jquery()
Creates Script tag for the jQuery/jQuery-ui.
public
options_settings_page_jquery() : void
Return values
void —options_settings_page_sanitize()
Sanitize _POSTed fields
public
options_settings_page_sanitize(mixed $values, string $optionKey, array<string|int, mixed> $optionMeta[, mixed $savedOptionValue = null ]) : mixed
Parameters
- $values : mixed
-
posted option value(s)
- $optionKey : string
-
option name
- $optionMeta : array<string|int, mixed>
-
option meta data
- $savedOptionValue : mixed = null
-
current value for $optionKey
Return values
mixed —sanitized option value(s)
options_settings_page_section()
for html input fields, get section headers
public
options_settings_page_section(string $groupName, array<string|int, mixed> &$optionMeta[, string $currentTab = '' ]) : void
Parameters
- $groupName : string
-
option group name
- $optionMeta : array<string|int, mixed>
-
meta-data for $group
- $currentTab : string = ''
Return values
void —options_settings_page_style()
Creates Style tag for the Administration page to set options for this plugin.
public
options_settings_page_style() : string
Return values
string —the stylesheet id
options_settings_page_validate()
Validate _POSTed fields
public
options_settings_page_validate(mixed $values, string $optionKey, array<string|int, mixed> $optionMeta[, mixed $savedOptionValue = null ]) : mixed
Parameters
- $values : mixed
-
posted option value(s)
- $optionKey : string
-
option name
- $optionMeta : array<string|int, mixed>
-
option meta data
- $savedOptionValue : mixed = null
-
current value for $optionKey
Return values
mixed —sanitized option value(s)
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_plugin_meta()
Add meta value to plugin row - on after_plugin_row_meta action
public
plugin_admin_add_plugin_meta(string $plugin_file[, mixed $plugin_data = [] ]) : void
Parameters
- $plugin_file : string
- $plugin_data : mixed = []
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 —plugin_admin_add_settings_link()
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 = [] ]) : array<string|int, mixed>
Parameters
- $links : array<string|int, mixed>
- $plugin_file : string
- $plugin_data : mixed = []
Return values
array<string|int, mixed> —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_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 of the option name
public
prefixOptionName(string $optionName) : string
Parameters
- $optionName : string
-
option name
Return values
string —$optionName 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 —purge_expired_transients()
purge expired transients for current blog
public
purge_expired_transients() : mixed
Return values
mixed —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 —removeClassNamePrefix()
Remove the prefix from the input $name
public
removeClassNamePrefix(string $name[, string $prefix = null ]) : string
Parameters
- $name : string
-
option/hook/table name
- $prefix : string = null
-
override default prefix
Return values
string —option/hook/table name without prefix
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
Return values
mixed —the filtered value, false if filter failed
set()
set a stored variable
public
set(string $key[, mixed $default = null ]) : string
Parameters
- $key : string
-
stored key
- $default : mixed = null
Tags
Return values
string —stored variable (serialized)
set_cookie()
set a cookie supporting wp_consent if enabled
public
set_cookie(string|array<string|int, mixed> $name, mixed $value, string|int $expires[, array<string|int, mixed> $options = [] ][, mixed $consent = [] ]) : bool
Parameters
- $name : string|array<string|int, mixed>
-
the cookie name
- $value : mixed
-
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_cookie_consent()
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_cookie_expiration()
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
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
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
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
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 = [';'] ][, callable $callback = 'trim' ]) : array<string|int, mixed>
Parameters
- $string : string
-
delimited by \n or $delimiters
- $delimiters : array<string|int, mixed> = [';']
-
split string on these delimiters
- $callback : callable = 'trim'
-
array_map callback function (i.e. sanitize_textarea_field)
Return values
array<string|int, mixed> —toKeyString()
convert a display title/name to a key/class string
public
toKeyString(string $string[, string $with = '-' ]) : string
Parameters
- $string : string
-
to be converted
- $with : string = '-'
-
to replace ' '
Return values
string —unprefixOptionName()
Get the un-prefixed version of the option name
public
unprefixOptionName(string $optionName) : string
Parameters
- $optionName : string
-
prefixed option name
Return values
string —$optionName 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 = 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
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
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
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
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
Return values
mixed —the filtered value, false if filter failed, null if not found
wp_action_count()
wp has_action - returns count of actions
public
wp_action_count(string $hookName[, mixed $callback = false ]) : int
Parameters
- $hookName : string
-
the name of the action
- $callback : mixed = false
Return values
int —wp_filter_count()
wp has_filter - returns count of filters
public
wp_filter_count(string $hookName[, mixed $callback = false ]) : int
Parameters
- $hookName : string
-
the name of the filter
- $callback : mixed = false
Return values
int —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.
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