@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | * @return string The job ID |
20 | 20 | */ |
21 | 21 | function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
22 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
22 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | + return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @return string The job ID |
38 | 38 | */ |
39 | 39 | function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
40 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
40 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | + return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return string The job ID |
66 | 66 | */ |
67 | 67 | function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
68 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | - return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
68 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | + return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @deprecated 2.1.0 |
80 | 80 | */ |
81 | 81 | function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
82 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | - as_unschedule_action( $hook, $args, $group ); |
|
82 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | + as_unschedule_action( $hook, $args, $group ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
94 | 94 | */ |
95 | 95 | function wc_next_scheduled_action( $hook, $args = null, $group = '' ) { |
96 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | - return as_next_scheduled_action( $hook, $args, $group ); |
|
96 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | + return as_next_scheduled_action( $hook, $args, $group ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -121,6 +121,6 @@ discard block |
||
121 | 121 | * @return array |
122 | 122 | */ |
123 | 123 | function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
124 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | - return as_get_scheduled_actions( $args, $return_format ); |
|
124 | + _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | + return as_get_scheduled_actions( $args, $return_format ); |
|
126 | 126 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The job ID |
20 | 20 | */ |
21 | -function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
|
22 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
|
23 | - return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
|
21 | +function wc_schedule_single_action($timestamp, $hook, $args = array(), $group = '') { |
|
22 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_single_action()'); |
|
23 | + return as_schedule_single_action($timestamp, $hook, $args, $group); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return string The job ID |
38 | 38 | */ |
39 | -function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
|
40 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
|
41 | - return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
|
39 | +function wc_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args = array(), $group = '') { |
|
40 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_recurring_action()'); |
|
41 | + return as_schedule_recurring_action($timestamp, $interval_in_seconds, $hook, $args, $group); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string The job ID |
66 | 66 | */ |
67 | -function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
|
68 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
|
69 | - return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
|
67 | +function wc_schedule_cron_action($timestamp, $schedule, $hook, $args = array(), $group = '') { |
|
68 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_schedule_cron_action()'); |
|
69 | + return as_schedule_cron_action($timestamp, $schedule, $hook, $args, $group); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @deprecated 2.1.0 |
80 | 80 | */ |
81 | -function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
|
82 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
|
83 | - as_unschedule_action( $hook, $args, $group ); |
|
81 | +function wc_unschedule_action($hook, $args = array(), $group = '') { |
|
82 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_unschedule_action()'); |
|
83 | + as_unschedule_action($hook, $args, $group); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
94 | 94 | */ |
95 | -function wc_next_scheduled_action( $hook, $args = null, $group = '' ) { |
|
96 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
|
97 | - return as_next_scheduled_action( $hook, $args, $group ); |
|
95 | +function wc_next_scheduled_action($hook, $args = null, $group = '') { |
|
96 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_next_scheduled_action()'); |
|
97 | + return as_next_scheduled_action($hook, $args, $group); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return array |
122 | 122 | */ |
123 | -function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
|
124 | - _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
|
125 | - return as_get_scheduled_actions( $args, $return_format ); |
|
123 | +function wc_get_scheduled_actions($args = array(), $return_format = OBJECT) { |
|
124 | + _deprecated_function(__FUNCTION__, '2.1.0', 'as_get_scheduled_actions()'); |
|
125 | + return as_get_scheduled_actions($args, $return_format); |
|
126 | 126 | } |
@@ -10,138 +10,138 @@ |
||
10 | 10 | */ |
11 | 11 | class ActionScheduler_AdminView_Deprecated { |
12 | 12 | |
13 | - public function action_scheduler_post_type_args( $args ) { |
|
14 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
15 | - return $args; |
|
16 | - } |
|
13 | + public function action_scheduler_post_type_args( $args ) { |
|
14 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
15 | + return $args; |
|
16 | + } |
|
17 | 17 | |
18 | - /** |
|
19 | - * Customise the post status related views displayed on the Scheduled Actions administration screen. |
|
20 | - * |
|
21 | - * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
22 | - * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
23 | - */ |
|
24 | - public function list_table_views( $views ) { |
|
25 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
26 | - return $views; |
|
27 | - } |
|
18 | + /** |
|
19 | + * Customise the post status related views displayed on the Scheduled Actions administration screen. |
|
20 | + * |
|
21 | + * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
22 | + * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
|
23 | + */ |
|
24 | + public function list_table_views( $views ) { |
|
25 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
26 | + return $views; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Do not include the "Edit" action for the Scheduled Actions administration screen. |
|
31 | - * |
|
32 | - * Hooked to the 'bulk_actions-edit-action-scheduler' filter. |
|
33 | - * |
|
34 | - * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
35 | - * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
36 | - */ |
|
37 | - public function bulk_actions( $actions ) { |
|
38 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
39 | - return $actions; |
|
40 | - } |
|
29 | + /** |
|
30 | + * Do not include the "Edit" action for the Scheduled Actions administration screen. |
|
31 | + * |
|
32 | + * Hooked to the 'bulk_actions-edit-action-scheduler' filter. |
|
33 | + * |
|
34 | + * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
35 | + * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
36 | + */ |
|
37 | + public function bulk_actions( $actions ) { |
|
38 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
39 | + return $actions; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Completely customer the columns displayed on the Scheduled Actions administration screen. |
|
44 | - * |
|
45 | - * Because we can't filter the content of the default title and date columns, we need to recreate our own |
|
46 | - * custom columns for displaying those post fields. For the column content, @see self::list_table_column_content(). |
|
47 | - * |
|
48 | - * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
49 | - * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
50 | - */ |
|
51 | - public function list_table_columns( $columns ) { |
|
52 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
53 | - return $columns; |
|
54 | - } |
|
42 | + /** |
|
43 | + * Completely customer the columns displayed on the Scheduled Actions administration screen. |
|
44 | + * |
|
45 | + * Because we can't filter the content of the default title and date columns, we need to recreate our own |
|
46 | + * custom columns for displaying those post fields. For the column content, @see self::list_table_column_content(). |
|
47 | + * |
|
48 | + * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
49 | + * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
|
50 | + */ |
|
51 | + public function list_table_columns( $columns ) { |
|
52 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
53 | + return $columns; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Make our custom title & date columns use defaulting title & date sorting. |
|
58 | - * |
|
59 | - * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
60 | - * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
61 | - */ |
|
62 | - public static function list_table_sortable_columns( $columns ) { |
|
63 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
64 | - return $columns; |
|
65 | - } |
|
56 | + /** |
|
57 | + * Make our custom title & date columns use defaulting title & date sorting. |
|
58 | + * |
|
59 | + * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
60 | + * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
|
61 | + */ |
|
62 | + public static function list_table_sortable_columns( $columns ) { |
|
63 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
64 | + return $columns; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Print the content for our custom columns. |
|
69 | - * |
|
70 | - * @param string $column_name The key for the column for which we should output our content. |
|
71 | - * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
|
72 | - */ |
|
73 | - public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
75 | - } |
|
67 | + /** |
|
68 | + * Print the content for our custom columns. |
|
69 | + * |
|
70 | + * @param string $column_name The key for the column for which we should output our content. |
|
71 | + * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
|
72 | + */ |
|
73 | + public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Hide the inline "Edit" action for all 'scheduled-action' posts. |
|
79 | - * |
|
80 | - * Hooked to the 'post_row_actions' filter. |
|
81 | - * |
|
82 | - * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
83 | - * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
84 | - */ |
|
85 | - public static function row_actions( $actions, $post ) { |
|
86 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
87 | - return $actions; |
|
88 | - } |
|
77 | + /** |
|
78 | + * Hide the inline "Edit" action for all 'scheduled-action' posts. |
|
79 | + * |
|
80 | + * Hooked to the 'post_row_actions' filter. |
|
81 | + * |
|
82 | + * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
83 | + * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
|
84 | + */ |
|
85 | + public static function row_actions( $actions, $post ) { |
|
86 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
87 | + return $actions; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Run an action when triggered from the Action Scheduler administration screen. |
|
92 | - * |
|
93 | - * @codeCoverageIgnore |
|
94 | - */ |
|
95 | - public static function maybe_execute_action() { |
|
96 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
97 | - } |
|
90 | + /** |
|
91 | + * Run an action when triggered from the Action Scheduler administration screen. |
|
92 | + * |
|
93 | + * @codeCoverageIgnore |
|
94 | + */ |
|
95 | + public static function maybe_execute_action() { |
|
96 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Convert an interval of seconds into a two part human friendly string. |
|
101 | - * |
|
102 | - * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning |
|
103 | - * even if an action is 1 day and 11 hours away, it will display "1 day". This funciton goes one step |
|
104 | - * further to display two degrees of accuracy. |
|
105 | - * |
|
106 | - * Based on Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ |
|
107 | - * |
|
108 | - * @param int $interval A interval in seconds. |
|
109 | - * @return string A human friendly string representation of the interval. |
|
110 | - */ |
|
111 | - public static function admin_notices() { |
|
112 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
113 | - } |
|
99 | + /** |
|
100 | + * Convert an interval of seconds into a two part human friendly string. |
|
101 | + * |
|
102 | + * The WordPress human_time_diff() function only calculates the time difference to one degree, meaning |
|
103 | + * even if an action is 1 day and 11 hours away, it will display "1 day". This funciton goes one step |
|
104 | + * further to display two degrees of accuracy. |
|
105 | + * |
|
106 | + * Based on Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/ |
|
107 | + * |
|
108 | + * @param int $interval A interval in seconds. |
|
109 | + * @return string A human friendly string representation of the interval. |
|
110 | + */ |
|
111 | + public static function admin_notices() { |
|
112 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
117 | - * |
|
118 | - * @param string $orderby MySQL orderby string. |
|
119 | - * @param WP_Query $query Instance of a WP_Query object |
|
120 | - * @return string MySQL orderby string. |
|
121 | - */ |
|
122 | - public function custom_orderby( $orderby, $query ) { |
|
123 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
124 | - } |
|
115 | + /** |
|
116 | + * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
117 | + * |
|
118 | + * @param string $orderby MySQL orderby string. |
|
119 | + * @param WP_Query $query Instance of a WP_Query object |
|
120 | + * @return string MySQL orderby string. |
|
121 | + */ |
|
122 | + public function custom_orderby( $orderby, $query ) { |
|
123 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
128 | - * |
|
129 | - * @param string $search MySQL search string. |
|
130 | - * @param WP_Query $query Instance of a WP_Query object |
|
131 | - * @return string MySQL search string. |
|
132 | - */ |
|
133 | - public function search_post_password( $search, $query ) { |
|
134 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
135 | - } |
|
126 | + /** |
|
127 | + * Filter search queries to allow searching by Claim ID (i.e. post_password). |
|
128 | + * |
|
129 | + * @param string $search MySQL search string. |
|
130 | + * @param WP_Query $query Instance of a WP_Query object |
|
131 | + * @return string MySQL search string. |
|
132 | + */ |
|
133 | + public function search_post_password( $search, $query ) { |
|
134 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Change messages when a scheduled action is updated. |
|
139 | - * |
|
140 | - * @param array $messages |
|
141 | - * @return array |
|
142 | - */ |
|
143 | - public function post_updated_messages( $messages ) { |
|
144 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
145 | - return $messages; |
|
146 | - } |
|
137 | + /** |
|
138 | + * Change messages when a scheduled action is updated. |
|
139 | + * |
|
140 | + * @param array $messages |
|
141 | + * @return array |
|
142 | + */ |
|
143 | + public function post_updated_messages( $messages ) { |
|
144 | + _deprecated_function( __METHOD__, '2.0.0' ); |
|
145 | + return $messages; |
|
146 | + } |
|
147 | 147 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class ActionScheduler_AdminView_Deprecated { |
12 | 12 | |
13 | - public function action_scheduler_post_type_args( $args ) { |
|
14 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
13 | + public function action_scheduler_post_type_args($args) { |
|
14 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
15 | 15 | return $args; |
16 | 16 | } |
17 | 17 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * @param array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
22 | 22 | * @return array $views An associative array of views and view labels which can be used to filter the 'scheduled-action' posts displayed on the Scheduled Actions administration screen. |
23 | 23 | */ |
24 | - public function list_table_views( $views ) { |
|
25 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
24 | + public function list_table_views($views) { |
|
25 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
26 | 26 | return $views; |
27 | 27 | } |
28 | 28 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
35 | 35 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
36 | 36 | */ |
37 | - public function bulk_actions( $actions ) { |
|
38 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
37 | + public function bulk_actions($actions) { |
|
38 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
39 | 39 | return $actions; |
40 | 40 | } |
41 | 41 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
49 | 49 | * @return array $columns An associative array of columns that are use for the table on the Scheduled Actions administration screen. |
50 | 50 | */ |
51 | - public function list_table_columns( $columns ) { |
|
52 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
51 | + public function list_table_columns($columns) { |
|
52 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
53 | 53 | return $columns; |
54 | 54 | } |
55 | 55 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * @param array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
60 | 60 | * @return array $columns An associative array of columns that can be used to sort the table on the Scheduled Actions administration screen. |
61 | 61 | */ |
62 | - public static function list_table_sortable_columns( $columns ) { |
|
63 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
62 | + public static function list_table_sortable_columns($columns) { |
|
63 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
64 | 64 | return $columns; |
65 | 65 | } |
66 | 66 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @param string $column_name The key for the column for which we should output our content. |
71 | 71 | * @param int $post_id The ID of the 'scheduled-action' post for which this row relates. |
72 | 72 | */ |
73 | - public static function list_table_column_content( $column_name, $post_id ) { |
|
74 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
73 | + public static function list_table_column_content($column_name, $post_id) { |
|
74 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
83 | 83 | * @return array $actions An associative array of actions which can be performed on the 'scheduled-action' post type. |
84 | 84 | */ |
85 | - public static function row_actions( $actions, $post ) { |
|
86 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
85 | + public static function row_actions($actions, $post) { |
|
86 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
87 | 87 | return $actions; |
88 | 88 | } |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @codeCoverageIgnore |
94 | 94 | */ |
95 | 95 | public static function maybe_execute_action() { |
96 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
96 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string A human friendly string representation of the interval. |
110 | 110 | */ |
111 | 111 | public static function admin_notices() { |
112 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
112 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param WP_Query $query Instance of a WP_Query object |
120 | 120 | * @return string MySQL orderby string. |
121 | 121 | */ |
122 | - public function custom_orderby( $orderby, $query ) { |
|
123 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
122 | + public function custom_orderby($orderby, $query) { |
|
123 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @param WP_Query $query Instance of a WP_Query object |
131 | 131 | * @return string MySQL search string. |
132 | 132 | */ |
133 | - public function search_post_password( $search, $query ) { |
|
134 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
133 | + public function search_post_password($search, $query) { |
|
134 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * @param array $messages |
141 | 141 | * @return array |
142 | 142 | */ |
143 | - public function post_updated_messages( $messages ) { |
|
144 | - _deprecated_function( __METHOD__, '2.0.0' ); |
|
143 | + public function post_updated_messages($messages) { |
|
144 | + _deprecated_function(__METHOD__, '2.0.0'); |
|
145 | 145 | return $messages; |
146 | 146 | } |
147 | 147 | } |
@@ -4,20 +4,20 @@ |
||
4 | 4 | * Class ActionScheduler_ActionClaim |
5 | 5 | */ |
6 | 6 | class ActionScheduler_ActionClaim { |
7 | - private $id = ''; |
|
8 | - private $action_ids = array(); |
|
7 | + private $id = ''; |
|
8 | + private $action_ids = array(); |
|
9 | 9 | |
10 | - public function __construct( $id, array $action_ids ) { |
|
11 | - $this->id = $id; |
|
12 | - $this->action_ids = $action_ids; |
|
13 | - } |
|
10 | + public function __construct( $id, array $action_ids ) { |
|
11 | + $this->id = $id; |
|
12 | + $this->action_ids = $action_ids; |
|
13 | + } |
|
14 | 14 | |
15 | - public function get_id() { |
|
16 | - return $this->id; |
|
17 | - } |
|
15 | + public function get_id() { |
|
16 | + return $this->id; |
|
17 | + } |
|
18 | 18 | |
19 | - public function get_actions() { |
|
20 | - return $this->action_ids; |
|
21 | - } |
|
19 | + public function get_actions() { |
|
20 | + return $this->action_ids; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | private $id = ''; |
8 | 8 | private $action_ids = array(); |
9 | 9 | |
10 | - public function __construct( $id, array $action_ids ) { |
|
10 | + public function __construct($id, array $action_ids) { |
|
11 | 11 | $this->id = $id; |
12 | 12 | $this->action_ids = $action_ids; |
13 | 13 | } |
@@ -5,53 +5,53 @@ |
||
5 | 5 | */ |
6 | 6 | class ActionScheduler_CanceledSchedule extends ActionScheduler_SimpleSchedule { |
7 | 7 | |
8 | - /** |
|
9 | - * Deprecated property @see $this->__wakeup() for details. |
|
10 | - **/ |
|
11 | - private $timestamp = null; |
|
8 | + /** |
|
9 | + * Deprecated property @see $this->__wakeup() for details. |
|
10 | + **/ |
|
11 | + private $timestamp = null; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param DateTime $after |
|
15 | - * |
|
16 | - * @return DateTime|null |
|
17 | - */ |
|
18 | - public function calculate_next( DateTime $after ) { |
|
19 | - return null; |
|
20 | - } |
|
13 | + /** |
|
14 | + * @param DateTime $after |
|
15 | + * |
|
16 | + * @return DateTime|null |
|
17 | + */ |
|
18 | + public function calculate_next( DateTime $after ) { |
|
19 | + return null; |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * Cancelled actions should never have a next schedule, even if get_next() |
|
24 | - * is called with $after < $this->scheduled_date. |
|
25 | - * |
|
26 | - * @param DateTime $after |
|
27 | - * @return DateTime|null |
|
28 | - */ |
|
29 | - public function get_next( DateTime $after ) { |
|
30 | - return null; |
|
31 | - } |
|
22 | + /** |
|
23 | + * Cancelled actions should never have a next schedule, even if get_next() |
|
24 | + * is called with $after < $this->scheduled_date. |
|
25 | + * |
|
26 | + * @param DateTime $after |
|
27 | + * @return DateTime|null |
|
28 | + */ |
|
29 | + public function get_next( DateTime $after ) { |
|
30 | + return null; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * @return bool |
|
35 | - */ |
|
36 | - public function is_recurring() { |
|
37 | - return false; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @return bool |
|
35 | + */ |
|
36 | + public function is_recurring() { |
|
37 | + return false; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Unserialize recurring schedules serialized/stored prior to AS 3.0.0 |
|
42 | - * |
|
43 | - * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
44 | - * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
45 | - * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
46 | - * aligned properties and property names for better inheritance. To maintain backward |
|
47 | - * compatibility with schedules serialized and stored prior to 3.0, we need to correctly |
|
48 | - * map the old property names with matching visibility. |
|
49 | - */ |
|
50 | - public function __wakeup() { |
|
51 | - if ( $this->timestamp !== null ) { |
|
52 | - $this->scheduled_timestamp = $this->timestamp; |
|
53 | - unset( $this->timestamp ); |
|
54 | - } |
|
55 | - parent::__wakeup(); |
|
56 | - } |
|
40 | + /** |
|
41 | + * Unserialize recurring schedules serialized/stored prior to AS 3.0.0 |
|
42 | + * |
|
43 | + * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
44 | + * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
45 | + * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
46 | + * aligned properties and property names for better inheritance. To maintain backward |
|
47 | + * compatibility with schedules serialized and stored prior to 3.0, we need to correctly |
|
48 | + * map the old property names with matching visibility. |
|
49 | + */ |
|
50 | + public function __wakeup() { |
|
51 | + if ( $this->timestamp !== null ) { |
|
52 | + $this->scheduled_timestamp = $this->timestamp; |
|
53 | + unset( $this->timestamp ); |
|
54 | + } |
|
55 | + parent::__wakeup(); |
|
56 | + } |
|
57 | 57 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @return DateTime|null |
17 | 17 | */ |
18 | - public function calculate_next( DateTime $after ) { |
|
18 | + public function calculate_next(DateTime $after) { |
|
19 | 19 | return null; |
20 | 20 | } |
21 | 21 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param DateTime $after |
27 | 27 | * @return DateTime|null |
28 | 28 | */ |
29 | - public function get_next( DateTime $after ) { |
|
29 | + public function get_next(DateTime $after) { |
|
30 | 30 | return null; |
31 | 31 | } |
32 | 32 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * map the old property names with matching visibility. |
49 | 49 | */ |
50 | 50 | public function __wakeup() { |
51 | - if ( $this->timestamp !== null ) { |
|
51 | + if ($this->timestamp !== null) { |
|
52 | 52 | $this->scheduled_timestamp = $this->timestamp; |
53 | - unset( $this->timestamp ); |
|
53 | + unset($this->timestamp); |
|
54 | 54 | } |
55 | 55 | parent::__wakeup(); |
56 | 56 | } |
@@ -4,15 +4,15 @@ |
||
4 | 4 | * Class ActionScheduler_Schedule |
5 | 5 | */ |
6 | 6 | interface ActionScheduler_Schedule { |
7 | - /** |
|
8 | - * @param DateTime $after |
|
9 | - * @return DateTime|null |
|
10 | - */ |
|
11 | - public function next( DateTime $after = null ); |
|
7 | + /** |
|
8 | + * @param DateTime $after |
|
9 | + * @return DateTime|null |
|
10 | + */ |
|
11 | + public function next( DateTime $after = null ); |
|
12 | 12 | |
13 | - /** |
|
14 | - * @return bool |
|
15 | - */ |
|
16 | - public function is_recurring(); |
|
13 | + /** |
|
14 | + * @return bool |
|
15 | + */ |
|
16 | + public function is_recurring(); |
|
17 | 17 | } |
18 | 18 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @param DateTime $after |
9 | 9 | * @return DateTime|null |
10 | 10 | */ |
11 | - public function next( DateTime $after = null ); |
|
11 | + public function next(DateTime $after = null); |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @return bool |
@@ -5,80 +5,80 @@ |
||
5 | 5 | */ |
6 | 6 | class ActionScheduler_IntervalSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule { |
7 | 7 | |
8 | - /** |
|
9 | - * Deprecated property @see $this->__wakeup() for details. |
|
10 | - **/ |
|
11 | - private $start_timestamp = null; |
|
8 | + /** |
|
9 | + * Deprecated property @see $this->__wakeup() for details. |
|
10 | + **/ |
|
11 | + private $start_timestamp = null; |
|
12 | 12 | |
13 | - /** |
|
14 | - * Deprecated property @see $this->__wakeup() for details. |
|
15 | - **/ |
|
16 | - private $interval_in_seconds = null; |
|
13 | + /** |
|
14 | + * Deprecated property @see $this->__wakeup() for details. |
|
15 | + **/ |
|
16 | + private $interval_in_seconds = null; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Calculate when this schedule should start after a given date & time using |
|
20 | - * the number of seconds between recurrences. |
|
21 | - * |
|
22 | - * @param DateTime $after |
|
23 | - * @return DateTime |
|
24 | - */ |
|
25 | - protected function calculate_next( DateTime $after ) { |
|
26 | - $after->modify( '+' . (int) $this->get_recurrence() . ' seconds' ); |
|
27 | - return $after; |
|
28 | - } |
|
18 | + /** |
|
19 | + * Calculate when this schedule should start after a given date & time using |
|
20 | + * the number of seconds between recurrences. |
|
21 | + * |
|
22 | + * @param DateTime $after |
|
23 | + * @return DateTime |
|
24 | + */ |
|
25 | + protected function calculate_next( DateTime $after ) { |
|
26 | + $after->modify( '+' . (int) $this->get_recurrence() . ' seconds' ); |
|
27 | + return $after; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @return int |
|
32 | - */ |
|
33 | - public function interval_in_seconds() { |
|
34 | - _deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' ); |
|
35 | - return (int) $this->get_recurrence(); |
|
36 | - } |
|
30 | + /** |
|
31 | + * @return int |
|
32 | + */ |
|
33 | + public function interval_in_seconds() { |
|
34 | + _deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' ); |
|
35 | + return (int) $this->get_recurrence(); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Serialize interval schedules with data required prior to AS 3.0.0 |
|
40 | - * |
|
41 | - * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to |
|
42 | - * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
43 | - * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
44 | - * aligned properties and property names for better inheritance. To guard against the |
|
45 | - * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to |
|
46 | - * also store the data with the old property names so if it's unserialized in AS < 3.0, |
|
47 | - * the schedule doesn't end up with a null/false/0 recurrence. |
|
48 | - * |
|
49 | - * @return array |
|
50 | - */ |
|
51 | - public function __sleep() { |
|
38 | + /** |
|
39 | + * Serialize interval schedules with data required prior to AS 3.0.0 |
|
40 | + * |
|
41 | + * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to |
|
42 | + * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
43 | + * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
44 | + * aligned properties and property names for better inheritance. To guard against the |
|
45 | + * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to |
|
46 | + * also store the data with the old property names so if it's unserialized in AS < 3.0, |
|
47 | + * the schedule doesn't end up with a null/false/0 recurrence. |
|
48 | + * |
|
49 | + * @return array |
|
50 | + */ |
|
51 | + public function __sleep() { |
|
52 | 52 | |
53 | - $sleep_params = parent::__sleep(); |
|
53 | + $sleep_params = parent::__sleep(); |
|
54 | 54 | |
55 | - $this->start_timestamp = $this->scheduled_timestamp; |
|
56 | - $this->interval_in_seconds = $this->recurrence; |
|
55 | + $this->start_timestamp = $this->scheduled_timestamp; |
|
56 | + $this->interval_in_seconds = $this->recurrence; |
|
57 | 57 | |
58 | - return array_merge( |
|
59 | - $sleep_params, |
|
60 | - array( |
|
61 | - 'start_timestamp', |
|
62 | - 'interval_in_seconds', |
|
63 | - ) |
|
64 | - ); |
|
65 | - } |
|
58 | + return array_merge( |
|
59 | + $sleep_params, |
|
60 | + array( |
|
61 | + 'start_timestamp', |
|
62 | + 'interval_in_seconds', |
|
63 | + ) |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Unserialize interval schedules serialized/stored prior to AS 3.0.0 |
|
69 | - * |
|
70 | - * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
|
71 | - */ |
|
72 | - public function __wakeup() { |
|
73 | - if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
74 | - $this->scheduled_timestamp = $this->start_timestamp; |
|
75 | - unset( $this->start_timestamp ); |
|
76 | - } |
|
67 | + /** |
|
68 | + * Unserialize interval schedules serialized/stored prior to AS 3.0.0 |
|
69 | + * |
|
70 | + * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
|
71 | + */ |
|
72 | + public function __wakeup() { |
|
73 | + if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
74 | + $this->scheduled_timestamp = $this->start_timestamp; |
|
75 | + unset( $this->start_timestamp ); |
|
76 | + } |
|
77 | 77 | |
78 | - if ( $this->recurrence === null && $this->interval_in_seconds !== null ) { |
|
79 | - $this->recurrence = $this->interval_in_seconds; |
|
80 | - unset( $this->interval_in_seconds ); |
|
81 | - } |
|
82 | - parent::__wakeup(); |
|
83 | - } |
|
78 | + if ( $this->recurrence === null && $this->interval_in_seconds !== null ) { |
|
79 | + $this->recurrence = $this->interval_in_seconds; |
|
80 | + unset( $this->interval_in_seconds ); |
|
81 | + } |
|
82 | + parent::__wakeup(); |
|
83 | + } |
|
84 | 84 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * @param DateTime $after |
23 | 23 | * @return DateTime |
24 | 24 | */ |
25 | - protected function calculate_next( DateTime $after ) { |
|
26 | - $after->modify( '+' . (int) $this->get_recurrence() . ' seconds' ); |
|
25 | + protected function calculate_next(DateTime $after) { |
|
26 | + $after->modify('+'.(int) $this->get_recurrence().' seconds'); |
|
27 | 27 | return $after; |
28 | 28 | } |
29 | 29 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return int |
32 | 32 | */ |
33 | 33 | public function interval_in_seconds() { |
34 | - _deprecated_function( __METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()' ); |
|
34 | + _deprecated_function(__METHOD__, '3.0.0', '(int)ActionScheduler_Abstract_RecurringSchedule::get_recurrence()'); |
|
35 | 35 | return (int) $this->get_recurrence(); |
36 | 36 | } |
37 | 37 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
71 | 71 | */ |
72 | 72 | public function __wakeup() { |
73 | - if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
73 | + if ($this->scheduled_timestamp === null && $this->start_timestamp !== null) { |
|
74 | 74 | $this->scheduled_timestamp = $this->start_timestamp; |
75 | - unset( $this->start_timestamp ); |
|
75 | + unset($this->start_timestamp); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( $this->recurrence === null && $this->interval_in_seconds !== null ) { |
|
78 | + if ($this->recurrence === null && $this->interval_in_seconds !== null) { |
|
79 | 79 | $this->recurrence = $this->interval_in_seconds; |
80 | - unset( $this->interval_in_seconds ); |
|
80 | + unset($this->interval_in_seconds); |
|
81 | 81 | } |
82 | 82 | parent::__wakeup(); |
83 | 83 | } |
@@ -5,101 +5,101 @@ |
||
5 | 5 | */ |
6 | 6 | class ActionScheduler_CronSchedule extends ActionScheduler_Abstract_RecurringSchedule implements ActionScheduler_Schedule { |
7 | 7 | |
8 | - /** |
|
9 | - * Deprecated property @see $this->__wakeup() for details. |
|
10 | - **/ |
|
11 | - private $start_timestamp = null; |
|
12 | - |
|
13 | - /** |
|
14 | - * Deprecated property @see $this->__wakeup() for details. |
|
15 | - **/ |
|
16 | - private $cron = null; |
|
17 | - |
|
18 | - /** |
|
19 | - * Wrapper for parent constructor to accept a cron expression string and map it to a CronExpression for this |
|
20 | - * objects $recurrence property. |
|
21 | - * |
|
22 | - * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used. |
|
23 | - * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance. |
|
24 | - * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance. |
|
25 | - */ |
|
26 | - public function __construct( DateTime $start, $recurrence, DateTime $first = null ) { |
|
27 | - if ( ! is_a( $recurrence, 'CronExpression' ) ) { |
|
28 | - $recurrence = CronExpression::factory( $recurrence ); |
|
29 | - } |
|
30 | - |
|
31 | - // For backward compatibility, we need to make sure the date is set to the first matching cron date, not whatever date is passed in. Importantly, by passing true as the 3rd param, if $start matches the cron expression, then it will be used. This was previously handled in the now deprecated next() method. |
|
32 | - $date = $recurrence->getNextRunDate( $start, 0, true ); |
|
33 | - |
|
34 | - // parent::__construct() will set this to $date by default, but that may be different to $start now. |
|
35 | - $first = empty( $first ) ? $start : $first; |
|
36 | - |
|
37 | - parent::__construct( $date, $recurrence, $first ); |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * Calculate when an instance of this schedule would start based on a given |
|
42 | - * date & time using its the CronExpression. |
|
43 | - * |
|
44 | - * @param DateTime $after |
|
45 | - * @return DateTime |
|
46 | - */ |
|
47 | - protected function calculate_next( DateTime $after ) { |
|
48 | - return $this->recurrence->getNextRunDate( $after, 0, false ); |
|
49 | - } |
|
50 | - |
|
51 | - /** |
|
52 | - * @return string |
|
53 | - */ |
|
54 | - public function get_recurrence() { |
|
55 | - return strval( $this->recurrence ); |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Serialize cron schedules with data required prior to AS 3.0.0 |
|
60 | - * |
|
61 | - * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to |
|
62 | - * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
63 | - * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
64 | - * aligned properties and property names for better inheritance. To guard against the |
|
65 | - * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to |
|
66 | - * also store the data with the old property names so if it's unserialized in AS < 3.0, |
|
67 | - * the schedule doesn't end up with a null recurrence. |
|
68 | - * |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function __sleep() { |
|
72 | - |
|
73 | - $sleep_params = parent::__sleep(); |
|
74 | - |
|
75 | - $this->start_timestamp = $this->scheduled_timestamp; |
|
76 | - $this->cron = $this->recurrence; |
|
77 | - |
|
78 | - return array_merge( |
|
79 | - $sleep_params, |
|
80 | - array( |
|
81 | - 'start_timestamp', |
|
82 | - 'cron', |
|
83 | - ) |
|
84 | - ); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Unserialize cron schedules serialized/stored prior to AS 3.0.0 |
|
89 | - * |
|
90 | - * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
|
91 | - */ |
|
92 | - public function __wakeup() { |
|
93 | - if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
94 | - $this->scheduled_timestamp = $this->start_timestamp; |
|
95 | - unset( $this->start_timestamp ); |
|
96 | - } |
|
97 | - |
|
98 | - if ( $this->recurrence === null && $this->cron !== null ) { |
|
99 | - $this->recurrence = $this->cron; |
|
100 | - unset( $this->cron ); |
|
101 | - } |
|
102 | - parent::__wakeup(); |
|
103 | - } |
|
8 | + /** |
|
9 | + * Deprecated property @see $this->__wakeup() for details. |
|
10 | + **/ |
|
11 | + private $start_timestamp = null; |
|
12 | + |
|
13 | + /** |
|
14 | + * Deprecated property @see $this->__wakeup() for details. |
|
15 | + **/ |
|
16 | + private $cron = null; |
|
17 | + |
|
18 | + /** |
|
19 | + * Wrapper for parent constructor to accept a cron expression string and map it to a CronExpression for this |
|
20 | + * objects $recurrence property. |
|
21 | + * |
|
22 | + * @param DateTime $start The date & time to run the action at or after. If $start aligns with the CronSchedule passed via $recurrence, it will be used. If it does not align, the first matching date after it will be used. |
|
23 | + * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance. |
|
24 | + * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance. |
|
25 | + */ |
|
26 | + public function __construct( DateTime $start, $recurrence, DateTime $first = null ) { |
|
27 | + if ( ! is_a( $recurrence, 'CronExpression' ) ) { |
|
28 | + $recurrence = CronExpression::factory( $recurrence ); |
|
29 | + } |
|
30 | + |
|
31 | + // For backward compatibility, we need to make sure the date is set to the first matching cron date, not whatever date is passed in. Importantly, by passing true as the 3rd param, if $start matches the cron expression, then it will be used. This was previously handled in the now deprecated next() method. |
|
32 | + $date = $recurrence->getNextRunDate( $start, 0, true ); |
|
33 | + |
|
34 | + // parent::__construct() will set this to $date by default, but that may be different to $start now. |
|
35 | + $first = empty( $first ) ? $start : $first; |
|
36 | + |
|
37 | + parent::__construct( $date, $recurrence, $first ); |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * Calculate when an instance of this schedule would start based on a given |
|
42 | + * date & time using its the CronExpression. |
|
43 | + * |
|
44 | + * @param DateTime $after |
|
45 | + * @return DateTime |
|
46 | + */ |
|
47 | + protected function calculate_next( DateTime $after ) { |
|
48 | + return $this->recurrence->getNextRunDate( $after, 0, false ); |
|
49 | + } |
|
50 | + |
|
51 | + /** |
|
52 | + * @return string |
|
53 | + */ |
|
54 | + public function get_recurrence() { |
|
55 | + return strval( $this->recurrence ); |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Serialize cron schedules with data required prior to AS 3.0.0 |
|
60 | + * |
|
61 | + * Prior to Action Scheduler 3.0.0, reccuring schedules used different property names to |
|
62 | + * refer to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
63 | + * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
64 | + * aligned properties and property names for better inheritance. To guard against the |
|
65 | + * possibility of infinite loops if downgrading to Action Scheduler < 3.0.0, we need to |
|
66 | + * also store the data with the old property names so if it's unserialized in AS < 3.0, |
|
67 | + * the schedule doesn't end up with a null recurrence. |
|
68 | + * |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function __sleep() { |
|
72 | + |
|
73 | + $sleep_params = parent::__sleep(); |
|
74 | + |
|
75 | + $this->start_timestamp = $this->scheduled_timestamp; |
|
76 | + $this->cron = $this->recurrence; |
|
77 | + |
|
78 | + return array_merge( |
|
79 | + $sleep_params, |
|
80 | + array( |
|
81 | + 'start_timestamp', |
|
82 | + 'cron', |
|
83 | + ) |
|
84 | + ); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Unserialize cron schedules serialized/stored prior to AS 3.0.0 |
|
89 | + * |
|
90 | + * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
|
91 | + */ |
|
92 | + public function __wakeup() { |
|
93 | + if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
94 | + $this->scheduled_timestamp = $this->start_timestamp; |
|
95 | + unset( $this->start_timestamp ); |
|
96 | + } |
|
97 | + |
|
98 | + if ( $this->recurrence === null && $this->cron !== null ) { |
|
99 | + $this->recurrence = $this->cron; |
|
100 | + unset( $this->cron ); |
|
101 | + } |
|
102 | + parent::__wakeup(); |
|
103 | + } |
|
104 | 104 | } |
105 | 105 |
@@ -23,18 +23,18 @@ discard block |
||
23 | 23 | * @param CronExpression|string $recurrence The CronExpression used to calculate the schedule's next instance. |
24 | 24 | * @param DateTime|null $first (Optional) The date & time the first instance of this interval schedule ran. Default null, meaning this is the first instance. |
25 | 25 | */ |
26 | - public function __construct( DateTime $start, $recurrence, DateTime $first = null ) { |
|
27 | - if ( ! is_a( $recurrence, 'CronExpression' ) ) { |
|
28 | - $recurrence = CronExpression::factory( $recurrence ); |
|
26 | + public function __construct(DateTime $start, $recurrence, DateTime $first = null) { |
|
27 | + if ( ! is_a($recurrence, 'CronExpression')) { |
|
28 | + $recurrence = CronExpression::factory($recurrence); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // For backward compatibility, we need to make sure the date is set to the first matching cron date, not whatever date is passed in. Importantly, by passing true as the 3rd param, if $start matches the cron expression, then it will be used. This was previously handled in the now deprecated next() method. |
32 | - $date = $recurrence->getNextRunDate( $start, 0, true ); |
|
32 | + $date = $recurrence->getNextRunDate($start, 0, true); |
|
33 | 33 | |
34 | 34 | // parent::__construct() will set this to $date by default, but that may be different to $start now. |
35 | - $first = empty( $first ) ? $start : $first; |
|
35 | + $first = empty($first) ? $start : $first; |
|
36 | 36 | |
37 | - parent::__construct( $date, $recurrence, $first ); |
|
37 | + parent::__construct($date, $recurrence, $first); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @param DateTime $after |
45 | 45 | * @return DateTime |
46 | 46 | */ |
47 | - protected function calculate_next( DateTime $after ) { |
|
48 | - return $this->recurrence->getNextRunDate( $after, 0, false ); |
|
47 | + protected function calculate_next(DateTime $after) { |
|
48 | + return $this->recurrence->getNextRunDate($after, 0, false); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @return string |
53 | 53 | */ |
54 | 54 | public function get_recurrence() { |
55 | - return strval( $this->recurrence ); |
|
55 | + return strval($this->recurrence); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * For more background, @see ActionScheduler_Abstract_RecurringSchedule::__wakeup(). |
91 | 91 | */ |
92 | 92 | public function __wakeup() { |
93 | - if ( $this->scheduled_timestamp === null && $this->start_timestamp !== null ) { |
|
93 | + if ($this->scheduled_timestamp === null && $this->start_timestamp !== null) { |
|
94 | 94 | $this->scheduled_timestamp = $this->start_timestamp; |
95 | - unset( $this->start_timestamp ); |
|
95 | + unset($this->start_timestamp); |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( $this->recurrence === null && $this->cron !== null ) { |
|
98 | + if ($this->recurrence === null && $this->cron !== null) { |
|
99 | 99 | $this->recurrence = $this->cron; |
100 | - unset( $this->cron ); |
|
100 | + unset($this->cron); |
|
101 | 101 | } |
102 | 102 | parent::__wakeup(); |
103 | 103 | } |
@@ -5,70 +5,70 @@ |
||
5 | 5 | */ |
6 | 6 | class ActionScheduler_SimpleSchedule extends ActionScheduler_Abstract_Schedule { |
7 | 7 | |
8 | - /** |
|
9 | - * Deprecated property @see $this->__wakeup() for details. |
|
10 | - **/ |
|
11 | - private $timestamp = null; |
|
8 | + /** |
|
9 | + * Deprecated property @see $this->__wakeup() for details. |
|
10 | + **/ |
|
11 | + private $timestamp = null; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @param DateTime $after |
|
15 | - * |
|
16 | - * @return DateTime|null |
|
17 | - */ |
|
18 | - public function calculate_next( DateTime $after ) { |
|
19 | - return null; |
|
20 | - } |
|
13 | + /** |
|
14 | + * @param DateTime $after |
|
15 | + * |
|
16 | + * @return DateTime|null |
|
17 | + */ |
|
18 | + public function calculate_next( DateTime $after ) { |
|
19 | + return null; |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * @return bool |
|
24 | - */ |
|
25 | - public function is_recurring() { |
|
26 | - return false; |
|
27 | - } |
|
22 | + /** |
|
23 | + * @return bool |
|
24 | + */ |
|
25 | + public function is_recurring() { |
|
26 | + return false; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Serialize schedule with data required prior to AS 3.0.0 |
|
31 | - * |
|
32 | - * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
33 | - * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
34 | - * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
35 | - * aligned properties and property names for better inheritance. To guard against the |
|
36 | - * scheduled date for single actions always being seen as "now" if downgrading to |
|
37 | - * Action Scheduler < 3.0.0, we need to also store the data with the old property names |
|
38 | - * so if it's unserialized in AS < 3.0, the schedule doesn't end up with a null recurrence. |
|
39 | - * |
|
40 | - * @return array |
|
41 | - */ |
|
42 | - public function __sleep() { |
|
29 | + /** |
|
30 | + * Serialize schedule with data required prior to AS 3.0.0 |
|
31 | + * |
|
32 | + * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
33 | + * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
34 | + * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
35 | + * aligned properties and property names for better inheritance. To guard against the |
|
36 | + * scheduled date for single actions always being seen as "now" if downgrading to |
|
37 | + * Action Scheduler < 3.0.0, we need to also store the data with the old property names |
|
38 | + * so if it's unserialized in AS < 3.0, the schedule doesn't end up with a null recurrence. |
|
39 | + * |
|
40 | + * @return array |
|
41 | + */ |
|
42 | + public function __sleep() { |
|
43 | 43 | |
44 | - $sleep_params = parent::__sleep(); |
|
44 | + $sleep_params = parent::__sleep(); |
|
45 | 45 | |
46 | - $this->timestamp = $this->scheduled_timestamp; |
|
46 | + $this->timestamp = $this->scheduled_timestamp; |
|
47 | 47 | |
48 | - return array_merge( |
|
49 | - $sleep_params, |
|
50 | - array( |
|
51 | - 'timestamp', |
|
52 | - ) |
|
53 | - ); |
|
54 | - } |
|
48 | + return array_merge( |
|
49 | + $sleep_params, |
|
50 | + array( |
|
51 | + 'timestamp', |
|
52 | + ) |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Unserialize recurring schedules serialized/stored prior to AS 3.0.0 |
|
58 | - * |
|
59 | - * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
60 | - * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
61 | - * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
62 | - * aligned properties and property names for better inheritance. To maintain backward |
|
63 | - * compatibility with schedules serialized and stored prior to 3.0, we need to correctly |
|
64 | - * map the old property names with matching visibility. |
|
65 | - */ |
|
66 | - public function __wakeup() { |
|
56 | + /** |
|
57 | + * Unserialize recurring schedules serialized/stored prior to AS 3.0.0 |
|
58 | + * |
|
59 | + * Prior to Action Scheduler 3.0.0, schedules used different property names to refer |
|
60 | + * to equivalent data. For example, ActionScheduler_IntervalSchedule::start_timestamp |
|
61 | + * was the same as ActionScheduler_SimpleSchedule::timestamp. Action Scheduler 3.0.0 |
|
62 | + * aligned properties and property names for better inheritance. To maintain backward |
|
63 | + * compatibility with schedules serialized and stored prior to 3.0, we need to correctly |
|
64 | + * map the old property names with matching visibility. |
|
65 | + */ |
|
66 | + public function __wakeup() { |
|
67 | 67 | |
68 | - if ( $this->scheduled_timestamp === null && $this->timestamp !== null ) { |
|
69 | - $this->scheduled_timestamp = $this->timestamp; |
|
70 | - unset( $this->timestamp ); |
|
71 | - } |
|
72 | - parent::__wakeup(); |
|
73 | - } |
|
68 | + if ( $this->scheduled_timestamp === null && $this->timestamp !== null ) { |
|
69 | + $this->scheduled_timestamp = $this->timestamp; |
|
70 | + unset( $this->timestamp ); |
|
71 | + } |
|
72 | + parent::__wakeup(); |
|
73 | + } |
|
74 | 74 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @return DateTime|null |
17 | 17 | */ |
18 | - public function calculate_next( DateTime $after ) { |
|
18 | + public function calculate_next(DateTime $after) { |
|
19 | 19 | return null; |
20 | 20 | } |
21 | 21 | |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function __wakeup() { |
67 | 67 | |
68 | - if ( $this->scheduled_timestamp === null && $this->timestamp !== null ) { |
|
68 | + if ($this->scheduled_timestamp === null && $this->timestamp !== null) { |
|
69 | 69 | $this->scheduled_timestamp = $this->timestamp; |
70 | - unset( $this->timestamp ); |
|
70 | + unset($this->timestamp); |
|
71 | 71 | } |
72 | 72 | parent::__wakeup(); |
73 | 73 | } |
@@ -5,63 +5,63 @@ |
||
5 | 5 | */ |
6 | 6 | class ActionScheduler_LogEntry { |
7 | 7 | |
8 | - /** |
|
9 | - * @var int $action_id |
|
10 | - */ |
|
11 | - protected $action_id = ''; |
|
8 | + /** |
|
9 | + * @var int $action_id |
|
10 | + */ |
|
11 | + protected $action_id = ''; |
|
12 | 12 | |
13 | - /** |
|
14 | - * @var string $message |
|
15 | - */ |
|
16 | - protected $message = ''; |
|
13 | + /** |
|
14 | + * @var string $message |
|
15 | + */ |
|
16 | + protected $message = ''; |
|
17 | 17 | |
18 | - /** |
|
19 | - * @var Datetime $date |
|
20 | - */ |
|
21 | - protected $date; |
|
18 | + /** |
|
19 | + * @var Datetime $date |
|
20 | + */ |
|
21 | + protected $date; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Constructor |
|
25 | - * |
|
26 | - * @param mixed $action_id Action ID |
|
27 | - * @param string $message Message |
|
28 | - * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is |
|
29 | - * not provided a new Datetime object (with current time) will be created. |
|
30 | - */ |
|
31 | - public function __construct( $action_id, $message, $date = null ) { |
|
23 | + /** |
|
24 | + * Constructor |
|
25 | + * |
|
26 | + * @param mixed $action_id Action ID |
|
27 | + * @param string $message Message |
|
28 | + * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is |
|
29 | + * not provided a new Datetime object (with current time) will be created. |
|
30 | + */ |
|
31 | + public function __construct( $action_id, $message, $date = null ) { |
|
32 | 32 | |
33 | - /* |
|
33 | + /* |
|
34 | 34 | * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type |
35 | 35 | * to ActionScheduler_LogEntry::__construct(), goodness knows why, and the Follow-up Emails plugin |
36 | 36 | * hard-codes loading its own version of ActionScheduler_wpCommentLogger with that out-dated method, |
37 | 37 | * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration |
38 | 38 | * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE. |
39 | 39 | */ |
40 | - if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { |
|
41 | - _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); |
|
42 | - $date = null; |
|
43 | - } |
|
40 | + if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { |
|
41 | + _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); |
|
42 | + $date = null; |
|
43 | + } |
|
44 | 44 | |
45 | - $this->action_id = $action_id; |
|
46 | - $this->message = $message; |
|
47 | - $this->date = $date ? $date : new Datetime(); |
|
48 | - } |
|
45 | + $this->action_id = $action_id; |
|
46 | + $this->message = $message; |
|
47 | + $this->date = $date ? $date : new Datetime(); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Returns the date when this log entry was created |
|
52 | - * |
|
53 | - * @return Datetime |
|
54 | - */ |
|
55 | - public function get_date() { |
|
56 | - return $this->date; |
|
57 | - } |
|
50 | + /** |
|
51 | + * Returns the date when this log entry was created |
|
52 | + * |
|
53 | + * @return Datetime |
|
54 | + */ |
|
55 | + public function get_date() { |
|
56 | + return $this->date; |
|
57 | + } |
|
58 | 58 | |
59 | - public function get_action_id() { |
|
60 | - return $this->action_id; |
|
61 | - } |
|
59 | + public function get_action_id() { |
|
60 | + return $this->action_id; |
|
61 | + } |
|
62 | 62 | |
63 | - public function get_message() { |
|
64 | - return $this->message; |
|
65 | - } |
|
63 | + public function get_message() { |
|
64 | + return $this->message; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param Datetime $date Datetime object with the time when this log entry was created. If this parameter is |
29 | 29 | * not provided a new Datetime object (with current time) will be created. |
30 | 30 | */ |
31 | - public function __construct( $action_id, $message, $date = null ) { |
|
31 | + public function __construct($action_id, $message, $date = null) { |
|
32 | 32 | |
33 | 33 | /* |
34 | 34 | * ActionScheduler_wpCommentLogger::get_entry() previously passed a 3rd param of $comment->comment_type |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * goodness knows why, so we need to guard against that here instead of using a DateTime type declaration |
38 | 38 | * for the constructor's 3rd param of $date and causing a fatal error with older versions of FUE. |
39 | 39 | */ |
40 | - if ( null !== $date && ! is_a( $date, 'DateTime' ) ) { |
|
41 | - _doing_it_wrong( __METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0' ); |
|
40 | + if (null !== $date && ! is_a($date, 'DateTime')) { |
|
41 | + _doing_it_wrong(__METHOD__, 'The third parameter must be a valid DateTime instance, or null.', '2.0.0'); |
|
42 | 42 | $date = null; |
43 | 43 | } |
44 | 44 |