event_scheduler_extension
extends abstract_extension
in package
Extension: event_schedule - Schedule timed, repeating event(s).
Tags
Table of Contents
- ALIAS = 'cron'
- 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
- ALLOW_NON_PHP = 0b100000
- DEFAULT_DISABLED = 0b1000000
- ENABLE_OPTION = ['type' => 'hidden', 'label' => "<abbr title='Set regularly scheduled, recurring events. These events do nothing by " . "themselves but can be used to trigger other actions by hooking into the event action name.'>" . "Scheduled Events</abbr>", 'advanced' => true]
- ONLY_ADMIN = 0b10
- TAB_NAME = 'General'
- VERSION = '25.0419.1'
- WP_CORE_SCHEDULES = ['hourly' => 'Hourly', 'twicedaily' => 'Twice Daily', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly']
- __call() : mixed
- magic method to call plugin or extension methods
- __construct() : void
- constructor method
- __destruct() : void
- Extension destructor
- __get() : mixed
- magic method to call parent plugin __get()
- addActionsAndFilters() : void
- Add extension actions and filter
- addActionsAndFilters_early() : void
- Add filters and actions - called from main plugin
- addEventTask() : bool
- Add an event and task hook for the event
- addShortcodes() : void
- Add extension shortcodes
- admin_options_help() : void
- Add help tab on admin page
- admin_options_settings() : void
- register options on options_settings_page
- getAlias() : const
- get the extension alias
- getClassName() : bool
- getClassName - get the class/extension name without namespace
- getEvent() : object|bool
- Get a scheduled event
- getInterval() : array<string|int, mixed>|bool
- Get a custom interval
- getIntervals() : array<string|int, mixed>
- Get a set of defined interval schedules
- getVersion() : const
- get the extension version
- initialize() : void
- initialize method - called from main plugin
- 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
- isEvent() : bool
- Is a scheduled event already set
- isInterval() : bool
- Does a custom interval exist
- isTask() : bool
- Is there a task hook for a scheduled event (has_action() shortcut)
- remove_active_events() : void
- deactivated active events
- scheduledEventName() : bool|string
- Get the eventName of a scheduled event.
- setEvent() : int|bool
- Set a scheduled event
- setInterval() : array<string|int, mixed>
- Create a custom interval
- setTask() : bool
- Add a task hook for a scheduled event (add_action() shortcut)
- sortIntervals() : array<string|int, mixed>
- Sort array of defined interval schedules
- unsetEvent() : int|bool
- Remove a scheduled event
- unsetInterval() : array<string|int, mixed>
- Delete a custom interval
- unsetTask() : bool
- Remove a task hook for a scheduled event (remove_action() shortcut)
- validate_schedules() : void
- validate/set validate_schedules when form submitted
- verify_active_events() : void
- verify active events
Constants
ALIAS
public
string
ALIAS
= 'cron'
alias class name
ALLOW_ADMIN
public
constructor
ALLOW_ADMIN
= 0b1
flags (actual values subject to change)
ALLOW_ALL
public
mixed
ALLOW_ALL
= self::ALLOW_ADMIN | self::ALLOW_NETWORK | self::ALLOW_CRON | self::ALLOW_CLI
ALLOW_CLI
public
mixed
ALLOW_CLI
= 0b10000
ALLOW_CRON
public
mixed
ALLOW_CRON
= 0b1000
ALLOW_NETWORK
public
mixed
ALLOW_NETWORK
= 0b100
ALLOW_NON_PHP
public
mixed
ALLOW_NON_PHP
= 0b100000
DEFAULT_DISABLED
public
mixed
DEFAULT_DISABLED
= 0b1000000
ENABLE_OPTION
public
string|array<string|int, mixed>|bool
ENABLE_OPTION
= ['type' => 'hidden', 'label' => "<abbr title='Set regularly scheduled, recurring events. These events do nothing by " . "themselves but can be used to trigger other actions by hooking into the event action name.'>" . "Scheduled Events</abbr>", 'advanced' => true]
to set (or disable) default group display/switch false disable the 'Enabled'' option for this group string the label for the 'Enabled' option array override options for the 'Enabled' option (label,help,title,info, etc.)
ONLY_ADMIN
public
mixed
ONLY_ADMIN
= 0b10
TAB_NAME
public
string
TAB_NAME
= 'General'
to set default tab name
VERSION
public
string
VERSION
= '25.0419.1'
extension version
WP_CORE_SCHEDULES
public
mixed
WP_CORE_SCHEDULES
= ['hourly' => 'Hourly', 'twicedaily' => 'Twice Daily', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly']
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()
constructor method
public
__construct(object $plugin) : void
Parameters
- $plugin : object
-
main plugin object
Return values
void —__destruct()
Extension destructor
public
__destruct() : void
Return values
void —__get()
magic method to call parent plugin __get()
public
__get(string $property) : mixed
Parameters
- $property : string
-
the property name or extension name
Return values
mixed —result of plugin __get()
addActionsAndFilters()
Add extension actions and filter
public
addActionsAndFilters() : void
Called after loading, instantiating, and initializing all extensions
Return values
void —addActionsAndFilters_early()
Add filters and actions - called from main plugin
public
addActionsAndFilters_early() : void
Return values
void —addEventTask()
Add an event and task hook for the event
public
addEventTask(string $name, mixed ...$args) : bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $args : mixed
Return values
bool —addShortcodes()
Add extension shortcodes
public
addShortcodes() : void
Called after loading, instantiating, and initializing all extensions
Return values
void —admin_options_help()
Add help tab on admin page
public
admin_options_help() : void
Tags
Return values
void —admin_options_settings()
register options on options_settings_page
public
admin_options_settings() : void
Tags
Return values
void —getAlias()
get the extension alias
public
getAlias() : const
Return values
const —ALIAS string
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 —getEvent()
Get a scheduled event
public
getEvent(string $name) : object|bool
Parameters
- $name : string
-
event name (e.g.'every_x_hours')
Return values
object|bool —event
getInterval()
Get a custom interval
public
getInterval(string $name, int $interval[, string $display = '' ]) : array<string|int, mixed>|bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $interval : int
-
time interval in seconds
- $display : string = ''
-
description for this interval
Return values
array<string|int, mixed>|bool —interval
getIntervals()
Get a set of defined interval schedules
public
getIntervals([string $include = null ][, mixed $default = [] ]) : array<string|int, mixed>
Parameters
- $include : string = null
-
core = wp core, cron = added by plugins, self = ours
- $default : mixed = []
Return values
array<string|int, mixed> —getVersion()
get the extension version
public
getVersion() : const
Return values
const —VERSION string
initialize()
initialize method - called from main plugin
public
initialize() : void
Return values
void —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 —isEvent()
Is a scheduled event already set
public
isEvent(string $name) : bool
Parameters
- $name : string
-
event name (e.g.'every_x_hours')
Return values
bool —isInterval()
Does a custom interval exist
public
isInterval(string $name, int $interval[, string $display = '' ]) : bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $interval : int
-
time interval in seconds
- $display : string = ''
-
description for this interval
Return values
bool —isTask()
Is there a task hook for a scheduled event (has_action() shortcut)
public
isTask(string $name, mixed ...$args) : bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $args : mixed
Return values
bool —remove_active_events()
deactivated active events
public
remove_active_events() : void
Return values
void —scheduledEventName()
Get the eventName of a scheduled event.
public
scheduledEventName(string $name) : bool|string
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
Return values
bool|string —setEvent()
Set a scheduled event
public
setEvent(string $name[, DateTime|int|string $scheduledTime = null ][, string $interval = null ][, array<string|int, mixed> $args = [] ]) : int|bool
Parameters
- $name : string
-
event name (e.g.'every_x_hours')
- $scheduledTime : DateTime|int|string = null
-
custom start time
- $interval : string = null
-
interval name (e.g.'every_x_hours')
- $args : array<string|int, mixed> = []
-
arguments to pass to the hook’s callback function
Return values
int|bool —timestamp
setInterval()
Create a custom interval
public
setInterval(string $name, int $interval, string $display) : array<string|int, mixed>
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $interval : int
-
time interval in seconds
- $display : string
-
description for this interval
Return values
array<string|int, mixed> —custom intervals
setTask()
Add a task hook for a scheduled event (add_action() shortcut)
public
setTask(string $name, mixed ...$args) : bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $args : mixed
Return values
bool —sortIntervals()
Sort array of defined interval schedules
public
sortIntervals(array<string|int, mixed> $intervals) : array<string|int, mixed>
Parameters
- $intervals : array<string|int, mixed>
Return values
array<string|int, mixed> —unsetEvent()
Remove a scheduled event
public
unsetEvent(string $name) : int|bool
Parameters
- $name : string
-
event name (e.g.'every_x_hours')
Return values
int|bool —timestamp
unsetInterval()
Delete a custom interval
public
unsetInterval(string $name) : array<string|int, mixed>
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
Return values
array<string|int, mixed> —custom intervals
unsetTask()
Remove a task hook for a scheduled event (remove_action() shortcut)
public
unsetTask(string $name, mixed ...$args) : bool
Parameters
- $name : string
-
interval name (e.g.'every_x_hours')
- $args : mixed
Return values
bool —validate_schedules()
validate/set validate_schedules when form submitted
public
validate_schedules(mixed $scheduledTime, string $fieldName, array<string|int, mixed> $metaData, mixed $priorValue) : void
Parameters
- $scheduledTime : mixed
-
the value POSTed
- $fieldName : string
-
the name of the field/option
- $metaData : array<string|int, mixed>
-
the option metadata
- $priorValue : mixed
-
the previous value
Return values
void —verify_active_events()
verify active events
public
verify_active_events() : void