plugin updates
This commit is contained in:
@@ -4,10 +4,13 @@
|
||||
* Class ActionScheduler_Action
|
||||
*/
|
||||
class ActionScheduler_Action {
|
||||
/** @var string */
|
||||
protected $hook = '';
|
||||
/** @var array<string, mixed> */
|
||||
protected $args = array();
|
||||
/** @var ActionScheduler_Schedule */
|
||||
protected $schedule = NULL;
|
||||
/** @var string */
|
||||
protected $group = '';
|
||||
|
||||
/**
|
||||
@@ -23,6 +26,14 @@ class ActionScheduler_Action {
|
||||
*/
|
||||
protected $priority = 10;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param string $hook Action's hook.
|
||||
* @param mixed[] $args Action's arguments.
|
||||
* @param null|ActionScheduler_Schedule $schedule Action's schedule.
|
||||
* @param string $group Action's group.
|
||||
*/
|
||||
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
|
||||
$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
|
||||
$this->set_hook($hook);
|
||||
@@ -57,16 +68,26 @@ class ActionScheduler_Action {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hook
|
||||
* Set action's hook.
|
||||
*
|
||||
* @param string $hook Action's hook.
|
||||
*/
|
||||
protected function set_hook( $hook ) {
|
||||
$this->hook = $hook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action's hook.
|
||||
*/
|
||||
public function get_hook() {
|
||||
return $this->hook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action's schedule.
|
||||
*
|
||||
* @param ActionScheduler_Schedule $schedule Action's schedule.
|
||||
*/
|
||||
protected function set_schedule( ActionScheduler_Schedule $schedule ) {
|
||||
$this->schedule = $schedule;
|
||||
}
|
||||
@@ -78,16 +99,26 @@ class ActionScheduler_Action {
|
||||
return $this->schedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set action's args.
|
||||
*
|
||||
* @param mixed[] $args Action's arguments.
|
||||
*/
|
||||
protected function set_args( array $args ) {
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get action's args.
|
||||
*/
|
||||
public function get_args() {
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
* Section action's group.
|
||||
*
|
||||
* @param string $group Action's group.
|
||||
*/
|
||||
protected function set_group( $group ) {
|
||||
$this->group = $group;
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
class ActionScheduler_CanceledAction extends ActionScheduler_FinishedAction {
|
||||
|
||||
/**
|
||||
* @param string $hook
|
||||
* @param array $args
|
||||
* @param ActionScheduler_Schedule $schedule
|
||||
* @param string $group
|
||||
* Construct.
|
||||
*
|
||||
* @param string $hook Action's hook.
|
||||
* @param array $args Action's arguments.
|
||||
* @param null|ActionScheduler_Schedule $schedule Action's schedule.
|
||||
* @param string $group Action's group.
|
||||
*/
|
||||
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
|
||||
parent::__construct( $hook, $args, $schedule, $group );
|
||||
|
||||
@@ -5,12 +5,17 @@
|
||||
*/
|
||||
class ActionScheduler_FinishedAction extends ActionScheduler_Action {
|
||||
|
||||
/**
|
||||
* Execute action.
|
||||
*/
|
||||
public function execute() {
|
||||
// don't execute
|
||||
// don't execute.
|
||||
}
|
||||
|
||||
/**
|
||||
* Get finished state.
|
||||
*/
|
||||
public function is_finished() {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,21 @@
|
||||
*/
|
||||
class ActionScheduler_NullAction extends ActionScheduler_Action {
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param string $hook Action hook.
|
||||
* @param mixed[] $args Action arguments.
|
||||
* @param null|ActionScheduler_Schedule $schedule Action schedule.
|
||||
*/
|
||||
public function __construct( $hook = '', array $args = array(), ActionScheduler_Schedule $schedule = NULL ) {
|
||||
$this->set_schedule( new ActionScheduler_NullSchedule() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute action.
|
||||
*/
|
||||
public function execute() {
|
||||
// don't execute
|
||||
// don't execute.
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user