Plugin Updates
This commit is contained in:
@@ -10,6 +10,19 @@ class ActionScheduler_Action {
|
||||
protected $schedule = NULL;
|
||||
protected $group = '';
|
||||
|
||||
/**
|
||||
* Priorities are conceptually similar to those used for regular WordPress actions.
|
||||
* Like those, a lower priority takes precedence over a higher priority and the default
|
||||
* is 10.
|
||||
*
|
||||
* Unlike regular WordPress actions, the priority of a scheduled action is strictly an
|
||||
* integer and should be kept within the bounds 0-255 (anything outside the bounds will
|
||||
* be brought back into the acceptable range).
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $priority = 10;
|
||||
|
||||
public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
|
||||
$schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
|
||||
$this->set_hook($hook);
|
||||
@@ -93,4 +106,30 @@ class ActionScheduler_Action {
|
||||
public function is_finished() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the priority of the action.
|
||||
*
|
||||
* @param int $priority Priority level (lower is higher priority). Should be in the range 0-255.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_priority( $priority ) {
|
||||
if ( $priority < 0 ) {
|
||||
$priority = 0;
|
||||
} elseif ( $priority > 255 ) {
|
||||
$priority = 255;
|
||||
}
|
||||
|
||||
$this->priority = (int) $priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the action priority.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_priority() {
|
||||
return $this->priority;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user