PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.11.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.11.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / actions / ActionScheduler_Action.php
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / actions Last commit date
ActionScheduler_Action.php 2 years ago ActionScheduler_CanceledAction.php 2 years ago ActionScheduler_FinishedAction.php 2 years ago ActionScheduler_NullAction.php 2 years ago
ActionScheduler_Action.php
136 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_Action
5 */
6 class ActionScheduler_Action {
7 protected $hook = '';
8 protected $args = array();
9 /** @var ActionScheduler_Schedule */
10 protected $schedule = NULL;
11 protected $group = '';
12
13 /**
14 * Priorities are conceptually similar to those used for regular WordPress actions.
15 * Like those, a lower priority takes precedence over a higher priority and the default
16 * is 10.
17 *
18 * Unlike regular WordPress actions, the priority of a scheduled action is strictly an
19 * integer and should be kept within the bounds 0-255 (anything outside the bounds will
20 * be brought back into the acceptable range).
21 *
22 * @var int
23 */
24 protected $priority = 10;
25
26 public function __construct( $hook, array $args = array(), ActionScheduler_Schedule $schedule = NULL, $group = '' ) {
27 $schedule = empty( $schedule ) ? new ActionScheduler_NullSchedule() : $schedule;
28 $this->set_hook($hook);
29 $this->set_schedule($schedule);
30 $this->set_args($args);
31 $this->set_group($group);
32 }
33
34 /**
35 * Executes the action.
36 *
37 * If no callbacks are registered, an exception will be thrown and the action will not be
38 * fired. This is useful to help detect cases where the code responsible for setting up
39 * a scheduled action no longer exists.
40 *
41 * @throws Exception If no callbacks are registered for this action.
42 */
43 public function execute() {
44 $hook = $this->get_hook();
45
46 if ( ! has_action( $hook ) ) {
47 throw new Exception(
48 sprintf(
49 /* translators: 1: action hook. */
50 __( 'Scheduled action for %1$s will not be executed as no callbacks are registered.', 'action-scheduler' ),
51 $hook
52 )
53 );
54 }
55
56 do_action_ref_array( $hook, array_values( $this->get_args() ) );
57 }
58
59 /**
60 * @param string $hook
61 */
62 protected function set_hook( $hook ) {
63 $this->hook = $hook;
64 }
65
66 public function get_hook() {
67 return $this->hook;
68 }
69
70 protected function set_schedule( ActionScheduler_Schedule $schedule ) {
71 $this->schedule = $schedule;
72 }
73
74 /**
75 * @return ActionScheduler_Schedule
76 */
77 public function get_schedule() {
78 return $this->schedule;
79 }
80
81 protected function set_args( array $args ) {
82 $this->args = $args;
83 }
84
85 public function get_args() {
86 return $this->args;
87 }
88
89 /**
90 * @param string $group
91 */
92 protected function set_group( $group ) {
93 $this->group = $group;
94 }
95
96 /**
97 * @return string
98 */
99 public function get_group() {
100 return $this->group;
101 }
102
103 /**
104 * @return bool If the action has been finished
105 */
106 public function is_finished() {
107 return FALSE;
108 }
109
110 /**
111 * Sets the priority of the action.
112 *
113 * @param int $priority Priority level (lower is higher priority). Should be in the range 0-255.
114 *
115 * @return void
116 */
117 public function set_priority( $priority ) {
118 if ( $priority < 0 ) {
119 $priority = 0;
120 } elseif ( $priority > 255 ) {
121 $priority = 255;
122 }
123
124 $this->priority = (int) $priority;
125 }
126
127 /**
128 * Gets the action priority.
129 *
130 * @return int
131 */
132 public function get_priority() {
133 return $this->priority;
134 }
135 }
136