{eac}Doojigger Reference

abstract_extension
in package

{eac}Doojigger for WordPress - Base class for custom plugin extensions.

Extensions create additional plugin options & methods while being managed by the main plugin

Tags
example

class myAwesomeExtension extends \EarthAsylumConsulting\abstract_extension

category

WordPress Plugin

author

Kevin Burkholder KBurkholder@EarthAsylum.com

copyright

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

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

\EarthAsylumConsulting\abstract_core

Table of Contents

ALLOW_ADMIN  = 0b1
ALLOW_ALL  = self::ALLOW_ADMIN | self::ALLOW_NETWORK | self::ALLOW_CRON | self::ALLOW_CLI
ALLOW_CLI  = 0b10000
ALLOW_CRON  = 0b1000
ALLOW_NETWORK  = 0b100
DEFAULT_DISABLED  = 0b100000
ONLY_ADMIN  = 0b10
PLUGIN_SHORTCUT_METHODS  = [ // site options 'is_option', 'get_option', 'get_option_decrypt', // 'set_option', 'add_option', 'delete_option', 'update_option', 'update_option_encrypt', // network options // 'is_network_option', 'get_network_option', 'get_network_option_decrypt', // 'set_network_option', 'add_network_option', 'delete_network_option', 'update_network_option', 'update_network_option_encrypt', // site or network options 'get_site_option', 'get_site_option_decrypt', // 'set_site_option', 'add_site_option', 'delete_site_option', 'update_site_option', 'update_site_option_encrypt', // filters 'has_filter', 'add_filter', 'remove_filter', 'apply_filters', 'did_filter', // actions 'has_action', 'add_action', 'remove_action', 'do_action', 'did_action', // contextual help 'addPluginHelpTab', 'addPluginSidebarText', 'addPluginSidebarLink', // other 'is_admin', 'is_network_admin', 'add_option_error', 'add_option_warning', 'add_option_success', 'add_option_notice', ]
VERSION  = false
__call()  : mixed
magic method to call plugin or extension methods
__construct()  : bool
Extension constructor method
__destruct()  : void
Extension destructor
addActionsAndFilters()  : void
Add extension actions and filter
addShortcodes()  : void
Add extension shortcodes
getClassName()  : bool
getClassName - get the class/extension name without namespace
getVersion()  : const
get the extension version
initialize()  : bool
Extension initialization
is_network_enabled()  : bool
is_network_enabled - set or test extension enabled for use at the network level
is_network_option()  : bool|mixed
is this class network enabled and does option match a value
isEnabled()  : bool
isEnabled - set or test extension enabled for use

Constants

ALLOW_ALL

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

PLUGIN_SHORTCUT_METHODS

public plugin PLUGIN_SHORTCUT_METHODS = [ // site options 'is_option', 'get_option', 'get_option_decrypt', // 'set_option', 'add_option', 'delete_option', 'update_option', 'update_option_encrypt', // network options // 'is_network_option', 'get_network_option', 'get_network_option_decrypt', // 'set_network_option', 'add_network_option', 'delete_network_option', 'update_network_option', 'update_network_option_encrypt', // site or network options 'get_site_option', 'get_site_option_decrypt', // 'set_site_option', 'add_site_option', 'delete_site_option', 'update_site_option', 'update_site_option_encrypt', // filters 'has_filter', 'add_filter', 'remove_filter', 'apply_filters', 'did_filter', // actions 'has_action', 'add_action', 'remove_action', 'do_action', 'did_action', // contextual help 'addPluginHelpTab', 'addPluginSidebarText', 'addPluginSidebarLink', // other 'is_admin', 'is_network_admin', 'add_option_error', 'add_option_warning', 'add_option_success', 'add_option_notice', ]

class method that can be called directly from extensions ($this->method() vs $this->plugin->method())

Methods

__call()

magic method to call plugin or extension methods

public __call(mixed $method, mixed $arguments) : mixed
Parameters
$method : mixed

the method name or [extension,method]

$arguments : mixed

the arguments to method name

Return values
mixed

result of method called

__construct()

Extension constructor method

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

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

Parameters
$plugin : object

parent/loader class object

$flags : int = null

see const values

Return values
bool

is enabled

addActionsAndFilters()

Add extension actions and filter

public addActionsAndFilters() : void

Called after loading, instantiating, and initializing all extensions

Return values
void

addShortcodes()

Add extension shortcodes

public addShortcodes() : void

Called after loading, instantiating, and initializing all extensions

Return values
void

getClassName()

getClassName - get the class/extension name without namespace

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

optional class object

Return values
bool

getVersion()

get the extension version

public getVersion() : const
Return values
const

VERSION string

initialize()

Extension initialization

public initialize() : bool

Called after loading and instantiating all extensions

Return values
bool

is enabled

is_network_enabled()

is_network_enabled - set or test extension enabled for use at the network level

public is_network_enabled() : bool
Return values
bool

is_network_option()

is this class network enabled and does option match a value

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

option name

$value : mixed = null

check this value

Return values
bool|mixed

option is set and has value

isEnabled()

isEnabled - set or test extension enabled for use

public isEnabled([bool|string $enabled = null ][, bool $perm = null ]) : bool
Parameters
$enabled : bool|string = null

true|false or other extension name

$perm : bool = null

optional, to permanently set enabled option

Return values
bool

Search results