{eac}Doojigger Reference

abstract_core
in package

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

abstract_frontend and abstract_backend extend abstract_core.

Tags
category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

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

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

\EarthAsylumConsulting\abstract_frontend

used-by

\EarthAsylumConsulting\abstract_backend

Table of Contents

ENVIRONMENT_LIVE  = 'Production (live)'
ENVIRONMENT_TEST  = 'Development (test)'
EXTENSION_BASE_CLASS  = __NAMESPACE__ . '\\abstract_extension'
NETWORK_OPTION_NAME  = 'network_options'
PLUGIN_EXTENSION_TRANSIENT  = 'plugin_loaded_extensions'
PLUGIN_HEADER_TRANSIENT  = 'plugin_header_data'
PLUGIN_OPTION_NAME  = 'plugin_options'
$className  : string
$date_format  : string
$date_time_format  : string
$extension_aliases  : array<string|int, mixed>
$extension_objects  : array<string|int, mixed>
$networkOptions  : array<string|int, mixed>
$plugin  : object
$PLUGIN_SLUG  : string
$PLUGIN_TEXTDOMAIN  : string
$pluginName  : string
$pluginOptions  : array<string|int, mixed>
$reservedOptions  : array<string|int, mixed>
$time_format  : string
$wpdb  : object
__get()  : object|null
__get magic method allows direct access to extension methods.
_COOKIE()  : mixed
Safely get $_COOKIE data using PHP filter.
_GET()  : mixed
Safely get $_GET data using PHP filter.
_POST()  : mixed
Safely get $_POST data using PHP filter.
_REQUEST()  : mixed
Safely get $_REQUEST data using PHP filter.
_SERVER()  : mixed
Safely get $_SERVER data using PHP filter.
add_action()  : mixed
add_action with prefixed name
add_admin_notice()  : void
Add admin notice, noop when not admin/backend
add_filter()  : mixed
add_filter with prefixed name
add_network_option()  : mixed
add_network_option() with prefixed option name (only network enabled)
add_option()  : mixed
add_option() with prefixed option name
add_site_option()  : mixed
add_option() with prefixed option name (single site or network enabled)
addActionsAndFilters()  : void
Add plugin actions and filter.
addShortcodes()  : void
Add plugin shortcodes.
after_switch_blog()  : void
after switching blogs, load internal option array.
apply_filters()  : mixed
apply_filters with prefixed name
before_switch_blog()  : void
before switching blogs, save internal option array.
callAllExtensions()  : array<string|int, mixed>
Execute a method in each/all loaded extension class
callExtension()  : mixed
call a specific extension method
callMethod()  : mixed
call an internal plugin or extension method
createUniqueId()  : string
Generates a Universally Unique IDentifier (UUID), version 4.
currentURL()  : string
get the current url
delete_network_option()  : bool
delete_network_option() with prefixed option name (only network enabled)
delete_option()  : bool
delete_option() with prefixed option name
delete_site_option()  : bool
delete_option() with prefixed option name (single site or network enabled)
delete_site_transient()  : bool
A wrapper function to WP delete_site_transient() with prefixed transient name
delete_transient()  : bool
A wrapper function to WP delete_transient() with prefixed transient name
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
eacDoojigger_ready()  : void
eacDoojigger is fully loaded and ready.
error()  : object
wp_error with logging
explode_with_keys()  : array<string|int, mixed>
explode a string into an associative array
fatal()  : void
fatal error with logging
flush_caches()  : void
clear cache and transient data
forEachNetworkSite()  : bool
in multisite environment, perform callback for each site from network admin, not as network admin
get()  : mixed
retrieve a stored variable
get_network_option()  : mixed
get_network_option() with prefixed option name, optional callback default (only network enabled)
get_network_option_decrypt()  : mixed
get_network_option() and decrypt with prefixed option name, optional callback default
get_option()  : mixed
get_option() with prefixed option name, optional callback default
get_option_decrypt()  : mixed
get_option() and decrypt with prefixed option name, optional callback default
get_page_footer()  : string
get a template page footer
get_page_header()  : string
get a template page header
get_post_by_slug()  : object
get a post (or page) by slug
get_site_option()  : mixed
get_option() with prefixed option name, optional callback default (single site or network enabled)
get_site_option_decrypt()  : mixed
get_site_option() and decrypt with prefixed option name, optional callback default
get_site_transient()  : mixed
A wrapper function to WP get_site_transient() with prefixed transient name and callable function
get_transient()  : mixed
A wrapper function to WP get_transient() with prefixed transient name and callable function
getClassName()  : string|bool
get the class name without namespace
getClassObject()  : object
get class or extension object
getDocumentationLink()  : string
get documentation link (i.e. the home/documentation page for this plugin) requires 'Plugin URI' in plugin header
getDocumentationURL()  : string
get documentation url (i.e. the home/documentation page for this plugin)
getExtension()  : bool|object
alias to isExtension - get enabled extension object
getMySqlVersion()  : string|false
Query MySQL DB for its version
getOptionNamePrefix()  : string
get the option prefix
getPageName()  : string|null
Get the page "name"
getPluginValue()  : string
get plugin value from pluginData (base file header)
getPluginValues()  : array<string|int, mixed>
get plugin value array from pluginData (base file header).
getSemanticVersion()  : object|null
Parse a Semantic or Calendar version number.
getSettingsCallback()  : array<string|int, mixed>
get settings page callback
getSettingsLink()  : string
get settings link (i.e. the page for setting options)
getSettingsSlug()  : string
get settings name (i.e. the page for setting options)
getSettingsURL()  : string
get settings link (i.e. the page for setting options)
getSupportLink()  : string
get WordPress support link for this plugin
getSupportURL()  : string
get WordPress support URL for this plugin
getVariable()  : mixed
retrieve a stored variable
getVersion()  : string
version of this code from the plugin header or from given extension
getVisitorCountry()  : string
Get the visitor's country from the language header
getVisitorId()  : string
Get a unique visitor id
getVisitorIP()  : string
Get the visitor's IP address
has_action()  : mixed
has_action with prefixed name
has_filter()  : mixed
has_filter with prefixed name
implode_with_keys()  : string
implode an associative array into a string
initialize()  : void
class initialization.
insert_with_markers()  : bool
like WordPress insert_with_markers, works with multiple file types
is_admin()  : bool
is admin (is_admin() or admin url) w/ability to set
is_backend()  : bool
is back-end (is_admin() or admin url)
is_frontend()  : bool
is front-end (not is_admin() or admin url)
is_network_admin()  : bool
is network admin (is_network_admin() or network admin url) w/ability to set
is_network_enabled()  : bool
is plugin network-enabled
is_network_option()  : bool|mixed
is network option a value or in a set of values (only network enabled)
is_option()  : bool|mixed
is option a value or in a set of values
is_plugin_active()  : bool
is plugin active (may be called from inactive site)
is_site_option()  : bool|mixed
is_option a value or in a set of values (single site or network enabled)
isAjaxRequest()  : bool
detect an ajax request
isCurrentScreen()  : bool|string
get or check the current screen name
isExtension()  : bool|object
is extension loaded and enabled
isFalse()  : bool
is value false? - false,off,no,0
isNewVisitor()  : string
Check visitor cookie
isPluginsPage()  : bool
when we're on the plugins page
isReservedOption()  : bool
test or set reserved option key
isSettingsPage()  : bool
when we're on our settings page
isTestSite()  : bool
is this a test or live production site
isTrue()  : bool
is value true? true,on,yes,1
log()  : bool
console/file logging - info (notice)
log_write()  : bool
console/file logging
logAlways()  : bool
console/file logging - always
logData()  : bool
console/file logging - data (warning)
logDebug()  : bool
console/file logging - debug
logError()  : bool
console/file logging - error
logInfo()  : bool
console/file logging - info (notice)
logNotice()  : bool
console/file logging - notice
logv()  : bool
console/file logging - debug
logWarning()  : bool
console/file logging - warning
minifyString()  : string
conservative minify for JS or CSS content
page_redirect()  : void
redirect the current page
page_reload()  : void
reload the current page
plugin_daily_event()  : void
plugin_daily_event -
plugin_ready()  : void
Plugin is fully loaded and ready.
plugin_weekly_event()  : void
plugin_weekly_event -
pluginHeader()  : string
get plugin value from pluginData (base file header)
pluginHeaders()  : array<string|int, mixed>
get plugin value array from pluginData (base file header).
pluginHelpEnabled()  : bool
pluginHelpEnabled
prefixHookName()  : string
Get the prefixed version of the hook name
prefixOptionName()  : string
Get the prefixed version input $name suitable for storing in WP options
prefixTableName()  : string
Prefix the table name with wpdb prefix and our class prefix (wpdb_classname_tablename)
prefixTransientName()  : string
Get the prefixed version of the transient name
print_admin_notice()  : void
write admin notice immediately, noop when not admin/backend
registerNetworkOptions()  : void
add network options (values) for the plugin
registerPluginOptions()  : void
add additional options (values) for the plugin (or extension)
remove_action()  : mixed
remove_action with prefixed name
remove_filter()  : mixed
remove_filter with prefixed name
rename_network_option()  : mixed
rename a network option (only network enabled)
rename_option()  : mixed
rename an option
rename_site_option()  : mixed
rename an option (single site or network enabled)
restore_current_blog()  : bool
restore_current_blog wrapper.
safeEcho()  : bool
safeEcho - only echo output when not wp_doing_ajax(), prevents interference with multiple/auto installs
sanitize()  : mixed
to filter/sanitize a variable
scheduleEvent()  : void
schedule a single event with callback
set()  : string
set a stored variable
set_network_option()  : mixed
set a network option value (only network enabled)
set_option()  : mixed
set an option value
set_site_option()  : mixed
temporarily set an option value (single site or network enabled)
set_site_transient()  : bool
A wrapper function to WP set_site_transient() with prefixed transient name
set_transient()  : bool
A wrapper function to WP set_transient() with prefixed transient name
setVariable()  : string
set a stored variable
standardizeOptionGroup()  : string|array<string|int, mixed>
standardize the options group display name
standardizeOptionName()  : string
standardize the option name
switch_to_blog()  : bool
switch_to_blog wrapper.
unprefixOptionName()  : string
Remove the prefix from the input $name
update_network_option()  : mixed
update_network_option() with prefixed option name (only network enabled)
update_network_option_encrypt()  : mixed
encrypt and update_network_option() with prefixed option name
update_option()  : mixed
update_option() with prefixed option name
update_option_encrypt()  : mixed
encrypt and update_option() with prefixed option name
update_site_option()  : mixed
update_site_option() with prefixed option name (single site or network enabled)
update_site_option_encrypt()  : mixed
encrypt and update_site_option() with prefixed option name (single site or network enabled)
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

Constants

ENVIRONMENT_LIVE

public string ENVIRONMENT_LIVE = 'Production (live)'

environment - live

ENVIRONMENT_TEST

public string ENVIRONMENT_TEST = 'Development (test)'

environment - test

EXTENSION_BASE_CLASS

public string EXTENSION_BASE_CLASS = __NAMESPACE__ . '\\abstract_extension'

base class name of extensions

NETWORK_OPTION_NAME

public string NETWORK_OPTION_NAME = 'network_options'

network options name

PLUGIN_EXTENSION_TRANSIENT

public string PLUGIN_EXTENSION_TRANSIENT = 'plugin_loaded_extensions'

transient name for plugin extensions to load

PLUGIN_HEADER_TRANSIENT

public string PLUGIN_HEADER_TRANSIENT = 'plugin_header_data'

transient name for plugin header info

Tags
see
setPluginHeaderValues()

PLUGIN_OPTION_NAME

public string PLUGIN_OPTION_NAME = 'plugin_options'

plugin options name

Properties

$className

public string $className

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

Tags
used-by

getClassName()

$extension_aliases

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

extension aliases (alias_name=>class_object)

$extension_objects

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

extension objects (class_name=>class_object)

Tags
used-by

loadextensions()

$networkOptions

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

network options/settings array (optionName=>value)

$PLUGIN_TEXTDOMAIN

public string $PLUGIN_TEXTDOMAIN

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

$pluginName

public string $pluginName

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

Tags
used-by

getClassName()

$pluginOptions

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

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

$reservedOptions

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

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

Methods

__get()

__get magic method allows direct access to extension methods.

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

the property name or extension name

Tags
example

$this->extension->method()

Return values
object|null

Safely get $_COOKIE data using PHP filter.

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

_GET()

Safely get $_GET data using PHP filter.

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

_POST()

Safely get $_POST data using PHP filter.

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

_REQUEST()

Safely get $_REQUEST data using PHP filter.

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

_SERVER()

Safely get $_SERVER data using PHP filter.

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

add_action()

add_action with prefixed name

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

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

add_admin_notice()

Add admin notice, noop when not admin/backend

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

message text

$errorType : string = 'notice'

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

$moreInfo : string = ''

additional message text

Return values
void

add_filter()

add_filter with prefixed name

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

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

add_network_option()

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

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

option name

$value : mixed

option value

Return values
mixed

option value

add_option()

add_option() with prefixed option name

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

option value

add_site_option()

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

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from add_option

after_switch_blog()

after switching blogs, load internal option array.

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

called from WP 'switch_blog' action.

Parameters
$new_blog_id : string

switching to blog

$prev_blog_id : string

switching from blog

$switch : string

'switch' or 'restore'

Return values
void

apply_filters()

apply_filters with prefixed name

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

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

before_switch_blog()

before switching blogs, save internal option array.

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

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

Parameters
$new_blog_id : string

switching to blog

$prev_blog_id : string

switching from blog

$switch : string

'switch' or 'restore'

Return values
void

callAllExtensions()

Execute a method in each/all loaded extension class

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

the method name

$arguments : mixed

the arguments to method name

Return values
array<string|int, mixed>

results from each call

callExtension()

call a specific extension method

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

the extension name

$method : string

the method name

$arguments : mixed

the arguments to method name

Return values
mixed

result of extension method called

callMethod()

call an internal plugin or extension method

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

the method name or [extension,method]

$arguments : mixed

the arguments to method name

Return values
mixed

result of call

currentURL()

get the current url

public currentURL() : string
Return values
string

the full url of the current request

delete_network_option()

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

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

option name

Return values
bool

returned from delete_option

delete_option()

delete_option() with prefixed option name

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

option name

Return values
bool

returned from delete_option

delete_site_option()

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

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

option name

Return values
bool

returned from delete_option

delete_site_transient()

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

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

transient name

Return values
bool

delete_transient()

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

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

transient name

Return values
bool

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

eacDoojigger_ready()

eacDoojigger is fully loaded and ready.

public eacDoojigger_ready() : void

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

Return values
void

error()

wp_error with logging

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

Error code or wp_error or throwable instance

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : scalar = null

optional, source id

Return values
object

WP_Error object

explode_with_keys()

explode a string into an associative array

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

the glue value

$string : string

the string value to explode

$delimiter : string = '='

the key=value delimiter

Return values
array<string|int, mixed>

the exploded array

fatal()

fatal error with logging

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

Error code

$message : string = ''

Error message

$data : mixed = ''

optional, Error data

$id : scalar = null

optional, source id

Return values
void

flush_caches()

clear cache and transient data

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

forEachNetworkSite()

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

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

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

Return values
bool

is network admin

get()

retrieve a stored variable

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

stored key

$default : mixed = null

default value

Tags
deprecated

use getVariable()

Return values
mixed

stored variable (unserialized)

get_network_option()

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

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

option name

$default : mixed = false

default value or callable function to set value

Tags
example

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

example

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

example

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

Return values
mixed

option value

get_network_option_decrypt()

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

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

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_option()

get_option() with prefixed option name, optional callback default

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

option name

$default : mixed = false

default value or callable function to set value

Tags
example

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

example

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

example

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

Return values
mixed

option value

get_option_decrypt()

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

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

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get a template page footer

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

special footer name

Return values
string

the footer content

get_page_header()

get a template page header

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

special header name

Return values
string

the header content

get_post_by_slug()

get a post (or page) by slug

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

the name to search for

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

augment/override query options

Return values
object

the first matching post

get_site_option()

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

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

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_site_option_decrypt()

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

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

option name

$default : mixed = false

default value or callable function

Return values
mixed

option value

get_site_transient()

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

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

transient name

$default : mixed = false

default value or callable function

$expiration : int

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

Tags
example

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

Return values
mixed

transient value

get_transient()

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

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

transient name

$default : mixed = false

default value or callable function

$expiration : int

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

Tags
example

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

Return values
mixed

transient value

getClassName()

get the class name without namespace

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

optional class object

Return values
string|bool

getClassObject()

get class or extension object

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

class/extension name

Return values
object

class object or null

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

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

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

$permalink : string = null

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

$name : string = 'Docs'

link name ('Docs')

$title : string = 'Documentation'

title ('Documentation')

Return values
string

the Documentation link

getDocumentationURL()

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

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

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

$permalink : string = null

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

Return values
string

the Documentation link

getExtension()

alias to isExtension - get enabled extension object

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

extension class or name

$checkEnabled : bool = true

check isEnabled()

Return values
bool|object

false or extension object

getMySqlVersion()

Query MySQL DB for its version

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

getOptionNamePrefix()

get the option prefix

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

override default prefix

Return values
string

short_classname_

getPageName()

Get the page "name"

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

get post permalink name

Return values
string|null

the requested page name (sans extension)

getPluginValue()

get plugin value from pluginData (base file header)

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

name of plugin data value

Tags
deprecated
  • use pluginHeader()
Return values
string

data value from plugin header

getPluginValues()

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

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

values from plugin header

getSemanticVersion()

Parse a Semantic or Calendar version number.

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

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

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

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

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

getSettingsCallback()

get settings page callback

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

the settings page callback

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

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

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

$tab : string = null

add tab name to url

$name : string = 'Settings'

link name ('Settings')

$title : string = 'Settings'

title ('Settings')

Return values
string

the settings link

getSettingsSlug()

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

public getSettingsSlug() : string
Return values
string

the settings slug name

getSettingsURL()

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

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

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

$tab : string = null

add tab name to url

Return values
string

the settings link

get WordPress support link for this plugin

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

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

$slug : string = null

uri plugin slug

$name : string = 'Support'

link name ('Support')

$title : string = 'Support'

title ('Support')

Return values
string

the Support link

getSupportURL()

get WordPress support URL for this plugin

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

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

$slug : string = null

uri plugin slug

Return values
string

the Support URL

getVariable()

retrieve a stored variable

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

stored key

$default : mixed = null

default value

Return values
mixed

stored variable (unserialized)

getVersion()

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

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

'n.n.n'

getVisitorCountry()

Get the visitor's country from the language header

public getVisitorCountry() : string
Return values
string

2 character country code (default=US)

getVisitorId()

Get a unique visitor id

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

unique to this request

Return values
string

ID

getVisitorIP()

Get the visitor's IP address

public getVisitorIP() : string
Return values
string

IP address

has_action()

has_action with prefixed name

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

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

has_filter()

has_filter with prefixed name

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

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

implode_with_keys()

implode an associative array into a string

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

the glue value

$array : array<string|int, mixed>

the associative array to implode

$delimiter : string = '='

the key=value delimiter

Return values
string

the imploded string

initialize()

class initialization.

public initialize() : void

Called after instantiating and loading extensions

Return values
void

insert_with_markers()

like WordPress insert_with_markers, works with multiple file types

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

is_admin()

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

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

set/override is_admin

Return values
bool

is_backend()

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

public is_backend() : bool
Return values
bool

is_frontend()

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

public is_frontend() : bool
Return values
bool

is_network_admin()

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

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

set/override is_network_admin

Return values
bool

is_network_enabled()

is plugin network-enabled

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

is_network_option()

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

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

option name

$value : mixed = null

check this value

Tags
example

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

example

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

example

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

Return values
bool|mixed

option is set and has value

is_option()

is option a value or in a set of values

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

option name

$value : mixed = null

check for this value (optional)

$network : bool = false

using network options (internal)

Tags
example

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

example

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

example

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

Return values
bool|mixed

null or option value

is_plugin_active()

is plugin active (may be called from inactive site)

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

plugin slug

Return values
bool

is_site_option()

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

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

option name

$value : mixed = null

check this value

Tags
example

$this->is_site_option('my_option')

example

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

example

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

Return values
bool|mixed

option is set and has value

isAjaxRequest()

detect an ajax request

public isAjaxRequest() : bool
Return values
bool

isCurrentScreen()

get or check the current screen name

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

isExtension()

is extension loaded and enabled

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

extension class or name

$checkEnabled : bool = true

check isEnabled()

Return values
bool|object

false or extension object

isFalse()

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

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

value to check

Return values
bool

isNewVisitor()

Check visitor cookie

public isNewVisitor() : string
Return values
string

ID

isPluginsPage()

when we're on the plugins page

public isPluginsPage() : bool
Return values
bool

isReservedOption()

test or set reserved option key

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

option name

$set : bool = null

set as reserved or not

Tags
example

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

example

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

Return values
bool

isSettingsPage()

when we're on our settings page

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

check specific tab name

Return values
bool

isTestSite()

is this a test or live production site

public isTestSite() : bool
Return values
bool

sets $site_is_test

isTrue()

is value true? true,on,yes,1

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

value to check

Return values
bool

log()

console/file logging - info (notice)

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

use logNotice()

Return values
bool

log_write()

console/file logging

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

the debugging log level

$var : mixed = null

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logAlways()

console/file logging - always

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logData()

console/file logging - data (warning)

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logDebug()

console/file logging - debug

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logError()

console/file logging - error

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logInfo()

console/file logging - info (notice)

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logNotice()

console/file logging - notice

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

logv()

console/file logging - debug

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

use logDebug()

Return values
bool

logWarning()

console/file logging - warning

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

variable to log or WP_Error object

$context : scalar = null

optional, source id

Return values
bool

minifyString()

conservative minify for JS or CSS content

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

minified content

page_redirect()

redirect the current page

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

destination url

$status : int = 302

http status (302)

$die : bool = false

true to die()

Return values
void

page_reload()

reload the current page

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

true to die()

Return values
void

plugin_daily_event()

plugin_daily_event -

public plugin_daily_event() : void
Return values
void

plugin_ready()

Plugin is fully loaded and ready.

public plugin_ready() : void

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

Return values
void

plugin_weekly_event()

plugin_weekly_event -

public plugin_weekly_event() : void
Return values
void

pluginHeader()

get plugin value from pluginData (base file header)

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

name of plugin data value

Return values
string

data value from plugin header

pluginHeaders()

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

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

values from plugin header

pluginHelpEnabled()

pluginHelpEnabled

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

enable/disable tabs

$fields : bool = null

enable/disable fields

Return values
bool

prefixHookName()

Get the prefixed version of the hook name

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

filter/action name

Return values
string

hookname with prefix

prefixOptionName()

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

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

override default prefix

Return values
string

option name with prefix

prefixTableName()

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

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

override default prefix

Return values
string

full table name

prefixTransientName()

Get the prefixed version of the transient name

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

transient name

$prefix : string = null

override default prefix

Return values
string

transient name with prefix

print_admin_notice()

write admin notice immediately, noop when not admin/backend

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

message text

$errorType : string = 'notice'

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

$moreInfo : string = ''

additional message text

Return values
void

registerNetworkOptions()

add network options (values) for the plugin

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

group name or [groupname, tabname]]

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

group option meta

Return values
void

registerPluginOptions()

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

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

group name or [groupname, tabname]]

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

group option meta

Return values
void

remove_action()

remove_action with prefixed name

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

the name of the action

$args : mixed

arguments passed to action

Return values
mixed

remove_filter()

remove_filter with prefixed name

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

the name of the filter

$args : mixed

arguments passed to filter

Return values
mixed

rename_network_option()

rename a network option (only network enabled)

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

old (current) option name

$newOptionName : string

new option name

Return values
mixed

returned from update_option

rename_option()

rename an option

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

old (current) option name

$newOptionName : string

new option name

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

rename_site_option()

rename an option (single site or network enabled)

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

old (current) option name

$newOptionName : string

new option name

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

restore_current_blog()

restore_current_blog wrapper.

public restore_current_blog() : bool

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

Return values
bool

safeEcho()

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

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

to echo

Return values
bool

sanitize()

to filter/sanitize a variable

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

the value to be filtered

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

example

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

example

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

Return values
mixed

the filtered value, false if filter failed

scheduleEvent()

schedule a single event with callback

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

time in seconds in the future

$arguments : array<string|int, mixed>

passed to callback

$callback : mixed
Return values
void

set()

set a stored variable

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

stored key

$default : mixed = null
Tags
deprecated

use setVariable()

Return values
string

stored variable (serialized)

set_network_option()

set a network option value (only network enabled)

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

option name

$value : mixed

value to set

Tags
deprecated

use update_network_option()

Return values
mixed

option value

set_option()

set an option value

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

option name

$value : mixed

value to set

Tags
deprecated

use update_option()

Return values
mixed

option value

set_site_option()

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

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

option name

$value : mixed

value to set

Tags
deprecated

use update_site_option()

Return values
mixed

option value

set_site_transient()

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

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

transient name

$value : mixed

value to save

$expiration : int

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

Return values
bool

set_transient()

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

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

transient name

$value : mixed

value to save

$expiration : int

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

Return values
bool

setVariable()

set a stored variable

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

stored key

$value : mixed

stored variable

Return values
string

stored variable (serialized)

standardizeOptionGroup()

standardize the options group display name

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

group name or [groupname, tabname]]

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

standardized option group name

standardizeOptionName()

standardize the option name

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

option name

$toLC : bool = true

convert to lower case

Return values
string

standardized option name

switch_to_blog()

switch_to_blog wrapper.

public switch_to_blog(string $new_blog_id) : bool

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

Parameters
$new_blog_id : string

switching to blog

Return values
bool

always true

unprefixOptionName()

Remove the prefix from the input $name

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

override default prefix

Return values
string

option name without prefix

update_network_option()

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

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

option name

$value : mixed

option value

Return values
mixed

option value

update_network_option_encrypt()

encrypt and update_network_option() with prefixed option name

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

option name

$value : mixed

option value

Return values
mixed

returned from update_option

update_option()

update_option() with prefixed option name

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

option value

update_option_encrypt()

encrypt and update_option() with prefixed option name

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

update_site_option()

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

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

update_site_option_encrypt()

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

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

option name

$value : mixed

option value

$autoload : bool = true

WordPress autoload/cache

Return values
mixed

returned from update_option

varCookie()

Safely get $_COOKIE data using PHP filter.

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

the name of the cookie

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

Return values
mixed

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

varGet()

Safely get $_GET data if set using PHP filter

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

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

Return values
mixed

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

varPost()

Safely get $_POST data if set using PHP filter

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

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

Return values
mixed

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

varRequest()

Safely get $_REQUEST data if set, using PHP filter

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

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

Return values
mixed

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

varServer()

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

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

the name of the variable

$filter : int|callable = FILTER_CALLBACK

the filter to use

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

passed to the filter

Tags
example

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

Return values
mixed

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

Search results