@@ -21,31 +21,31 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | // Avoid direct calls to this file. |
24 | -if ( ! function_exists( 'add_action' ) ) { |
|
25 | - header( 'Status: 403 Forbidden' ); |
|
26 | - header( 'HTTP/1.1 403 Forbidden' ); |
|
24 | +if ( ! function_exists('add_action')) { |
|
25 | + header('Status: 403 Forbidden'); |
|
26 | + header('HTTP/1.1 403 Forbidden'); |
|
27 | 27 | exit(); |
28 | 28 | } |
29 | 29 | |
30 | -if ( ! function_exists( 'debug_bar_cron_has_parent_plugin' ) ) { |
|
30 | +if ( ! function_exists('debug_bar_cron_has_parent_plugin')) { |
|
31 | 31 | /** |
32 | 32 | * Show admin notice & de-activate if debug-bar plugin not active. |
33 | 33 | */ |
34 | 34 | function debug_bar_cron_has_parent_plugin() { |
35 | - if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) ) { |
|
36 | - add_action( 'admin_notices', create_function( null, 'echo \'<div class="error"><p>\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar Cron</strong> Plugin. %sVisit your plugins page to activate.\', \'zt-debug-bar-cron\' ), \'<a href="\' . esc_url( admin_url( \'plugins.php#debug-bar\' ) ) . \'">\' ), \'</a></p></div>\';' ) ); |
|
35 | + if (is_admin() && ( ! class_exists('Debug_Bar') && current_user_can('activate_plugins'))) { |
|
36 | + add_action('admin_notices', create_function(null, 'echo \'<div class="error"><p>\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar Cron</strong> Plugin. %sVisit your plugins page to activate.\', \'zt-debug-bar-cron\' ), \'<a href="\' . esc_url( admin_url( \'plugins.php#debug-bar\' ) ) . \'">\' ), \'</a></p></div>\';')); |
|
37 | 37 | |
38 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
39 | - if ( isset( $_GET['activate'] ) ) { |
|
40 | - unset( $_GET['activate'] ); |
|
38 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
39 | + if (isset($_GET['activate'])) { |
|
40 | + unset($_GET['activate']); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | - add_action( 'admin_init', 'debug_bar_cron_has_parent_plugin' ); |
|
44 | + add_action('admin_init', 'debug_bar_cron_has_parent_plugin'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | -if ( ! function_exists( 'zt_add_debug_bar_cron_panel' ) ) { |
|
48 | +if ( ! function_exists('zt_add_debug_bar_cron_panel')) { |
|
49 | 49 | /** |
50 | 50 | * Adds panel, as defined in the included class, to Debug Bar. |
51 | 51 | * |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return array |
55 | 55 | */ |
56 | - function zt_add_debug_bar_cron_panel( $panels ) { |
|
57 | - if ( ! class_exists( 'ZT_Debug_Bar_Cron' ) ) { |
|
56 | + function zt_add_debug_bar_cron_panel($panels) { |
|
57 | + if ( ! class_exists('ZT_Debug_Bar_Cron')) { |
|
58 | 58 | require_once 'class-debug-bar-cron.php'; |
59 | 59 | $panels[] = new ZT_Debug_Bar_Cron(); |
60 | 60 | } |
61 | 61 | return $panels; |
62 | 62 | } |
63 | - add_filter( 'debug_bar_panels', 'zt_add_debug_bar_cron_panel' ); |
|
63 | + add_filter('debug_bar_panels', 'zt_add_debug_bar_cron_panel'); |
|
64 | 64 | } |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Avoid direct calls to this file. |
13 | -if ( ! function_exists( 'add_action' ) ) { |
|
14 | - header( 'Status: 403 Forbidden' ); |
|
15 | - header( 'HTTP/1.1 403 Forbidden' ); |
|
13 | +if ( ! function_exists('add_action')) { |
|
14 | + header('Status: 403 Forbidden'); |
|
15 | + header('HTTP/1.1 403 Forbidden'); |
|
16 | 16 | exit(); |
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The class in this file extends the functionality provided by the parent plugin "Debug Bar". |
21 | 21 | */ |
22 | -if ( ! class_exists( 'ZT_Debug_Bar_Cron' ) && class_exists( 'Debug_Bar_Panel' ) ) { |
|
22 | +if ( ! class_exists('ZT_Debug_Bar_Cron') && class_exists('Debug_Bar_Panel')) { |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Add a new Debug Bar Panel. |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | * @return void |
87 | 87 | */ |
88 | 88 | public function init() { |
89 | - load_plugin_textdomain( 'zt-debug-bar-cron', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
90 | - $this->title( __( 'Cron', 'zt-debug-bar-cron' ) ); |
|
91 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
92 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
89 | + load_plugin_textdomain('zt-debug-bar-cron', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
90 | + $this->title(__('Cron', 'zt-debug-bar-cron')); |
|
91 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
92 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public function enqueue_scripts_styles() { |
102 | - $suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ); |
|
102 | + $suffix = ((defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'); |
|
103 | 103 | |
104 | 104 | wp_enqueue_style( |
105 | 105 | self::DBCRON_NAME, |
106 | - plugins_url( 'css/' . self::DBCRON_NAME . $suffix . '.css', __FILE__ ), |
|
107 | - array( 'debug-bar' ), |
|
106 | + plugins_url('css/'.self::DBCRON_NAME.$suffix.'.css', __FILE__), |
|
107 | + array('debug-bar'), |
|
108 | 108 | self::DBCRON_STYLES_VERSION |
109 | 109 | ); |
110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | */ |
118 | 118 | public function prerender() { |
119 | - $this->set_visible( true ); |
|
119 | + $this->set_visible(true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -128,71 +128,71 @@ discard block |
||
128 | 128 | public function render() { |
129 | 129 | $this->get_crons(); |
130 | 130 | |
131 | - $this->_doing_cron = get_transient( 'doing_cron' ) ? __( 'Yes', 'zt-debug-bar-cron' ) : __( 'No', 'zt-debug-bar-cron' ); |
|
131 | + $this->_doing_cron = get_transient('doing_cron') ? __('Yes', 'zt-debug-bar-cron') : __('No', 'zt-debug-bar-cron'); |
|
132 | 132 | |
133 | 133 | // Get the time of the next event. |
134 | - $cron_times = ( is_array( $this->_crons ) ? array_keys( $this->_crons ) : array() ); |
|
134 | + $cron_times = (is_array($this->_crons) ? array_keys($this->_crons) : array()); |
|
135 | 135 | $unix_time_next_cron = $cron_times[0]; |
136 | - $time_next_cron = date( 'Y-m-d H:i:s', $unix_time_next_cron ); |
|
136 | + $time_next_cron = date('Y-m-d H:i:s', $unix_time_next_cron); |
|
137 | 137 | |
138 | - $human_time_next_cron = human_time_diff( $unix_time_next_cron ); |
|
138 | + $human_time_next_cron = human_time_diff($unix_time_next_cron); |
|
139 | 139 | |
140 | 140 | // Add a class if past current time and doing cron is not running. |
141 | - $times_class = ( time() > $unix_time_next_cron && 'No' === $this->_doing_cron ) ? ' past' : ''; |
|
141 | + $times_class = (time() > $unix_time_next_cron && 'No' === $this->_doing_cron) ? ' past' : ''; |
|
142 | 142 | |
143 | - if ( ! class_exists( 'Debug_Bar_Pretty_Output' ) ) { |
|
144 | - require_once plugin_dir_path( __FILE__ ) . 'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php'; |
|
143 | + if ( ! class_exists('Debug_Bar_Pretty_Output')) { |
|
144 | + require_once plugin_dir_path(__FILE__).'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // Limit recursion depth if possible - method available since DBPO v1.4. |
148 | - if ( method_exists( 'Debug_Bar_Pretty_Output', 'limit_recursion' ) ) { |
|
149 | - Debug_Bar_Pretty_Output::limit_recursion( 2 ); |
|
148 | + if (method_exists('Debug_Bar_Pretty_Output', 'limit_recursion')) { |
|
149 | + Debug_Bar_Pretty_Output::limit_recursion(2); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | echo ' |
153 | 153 | <div class="debug-bar-cron"> |
154 | - <h2><span>', esc_html__( 'Total Events', 'zt-debug-bar-cron' ), ':</span>', intval( $this->_total_crons ), '</h2> |
|
155 | - <h2><span>', esc_html__( 'Core Events', 'zt-debug-bar-cron' ), ':</span>', intval( $this->_total_core_crons ), '</h2> |
|
156 | - <h2><span>', esc_html__( 'Custom Events', 'zt-debug-bar-cron' ), ':</span>', intval( $this->_total_user_crons ), '</h2> |
|
157 | - <h2><span>', esc_html__( 'Doing Cron', 'zt-debug-bar-cron' ), ':</span>', esc_html( $this->_doing_cron ), '</h2> |
|
158 | - <h2 class="times', esc_attr( $times_class ), '"><span>', esc_html__( 'Next Event', 'zt-debug-bar-cron' ), ':</span> |
|
159 | - ', esc_html( $time_next_cron ), '<br /> |
|
160 | - ', intval( $unix_time_next_cron ), '<br /> |
|
161 | - ', esc_html( $this->display_past_time( $human_time_next_cron, $unix_time_next_cron ) ), ' |
|
154 | + <h2><span>', esc_html__('Total Events', 'zt-debug-bar-cron'), ':</span>', intval($this->_total_crons), '</h2> |
|
155 | + <h2><span>', esc_html__('Core Events', 'zt-debug-bar-cron'), ':</span>', intval($this->_total_core_crons), '</h2> |
|
156 | + <h2><span>', esc_html__('Custom Events', 'zt-debug-bar-cron'), ':</span>', intval($this->_total_user_crons), '</h2> |
|
157 | + <h2><span>', esc_html__('Doing Cron', 'zt-debug-bar-cron'), ':</span>', esc_html($this->_doing_cron), '</h2> |
|
158 | + <h2 class="times', esc_attr($times_class), '"><span>', esc_html__('Next Event', 'zt-debug-bar-cron'), ':</span> |
|
159 | + ', esc_html($time_next_cron), '<br /> |
|
160 | + ', intval($unix_time_next_cron), '<br /> |
|
161 | + ', esc_html($this->display_past_time($human_time_next_cron, $unix_time_next_cron)), ' |
|
162 | 162 | </h2> |
163 | - <h2><span>', esc_html__( 'Current Time', 'zt-debug-bar-cron' ), ':</span>', esc_html( date( 'H:i:s' ) ), '</h2> |
|
163 | + <h2><span>', esc_html__('Current Time', 'zt-debug-bar-cron'), ':</span>', esc_html(date('H:i:s')), '</h2> |
|
164 | 164 | |
165 | 165 | <div class="clear"></div> |
166 | 166 | |
167 | - <h3>', esc_html__( 'Schedules', 'zt-debug-bar-cron' ), '</h3>'; |
|
167 | + <h3>', esc_html__('Schedules', 'zt-debug-bar-cron'), '</h3>'; |
|
168 | 168 | |
169 | 169 | $this->display_schedules(); |
170 | 170 | |
171 | 171 | echo ' |
172 | - <h3>', esc_html__( 'Custom Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
172 | + <h3>', esc_html__('Custom Events', 'zt-debug-bar-cron'), '</h3>'; |
|
173 | 173 | |
174 | - if ( ! is_null( $this->_user_crons ) ) { |
|
175 | - $this->display_events( $this->_user_crons ); |
|
174 | + if ( ! is_null($this->_user_crons)) { |
|
175 | + $this->display_events($this->_user_crons); |
|
176 | 176 | } else { |
177 | 177 | echo ' |
178 | - <p>', esc_html__( 'No Custom Events scheduled.', 'zt-debug-bar-cron' ), '</p>'; |
|
178 | + <p>', esc_html__('No Custom Events scheduled.', 'zt-debug-bar-cron'), '</p>'; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | echo ' |
182 | - <h3>', esc_html__( 'Core Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
182 | + <h3>', esc_html__('Core Events', 'zt-debug-bar-cron'), '</h3>'; |
|
183 | 183 | |
184 | - if ( ! is_null( $this->_core_crons ) ) { |
|
185 | - $this->display_events( $this->_core_crons ); |
|
184 | + if ( ! is_null($this->_core_crons)) { |
|
185 | + $this->display_events($this->_core_crons); |
|
186 | 186 | } else { |
187 | 187 | echo ' |
188 | - <p>', esc_html__( 'No Core Events scheduled.', 'zt-debug-bar-cron' ), '</p>'; |
|
188 | + <p>', esc_html__('No Core Events scheduled.', 'zt-debug-bar-cron'), '</p>'; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | echo ' |
192 | 192 | </div>'; |
193 | 193 | |
194 | 194 | // Unset recursion depth limit if possible - method available since DBPO v1.4. |
195 | - if ( method_exists( 'Debug_Bar_Pretty_Output', 'unset_recursion_limit' ) ) { |
|
195 | + if (method_exists('Debug_Bar_Pretty_Output', 'unset_recursion_limit')) { |
|
196 | 196 | Debug_Bar_Pretty_Output::unset_recursion_limit(); |
197 | 197 | } |
198 | 198 | } |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | * @return array Array of crons. |
208 | 208 | */ |
209 | 209 | private function get_crons() { |
210 | - if ( ! is_null( $this->_crons ) ) { |
|
210 | + if ( ! is_null($this->_crons)) { |
|
211 | 211 | return $this->_crons; |
212 | 212 | } |
213 | 213 | |
214 | - if ( ! $crons = _get_cron_array() ) { |
|
214 | + if ( ! $crons = _get_cron_array()) { |
|
215 | 215 | return $this->_crons; |
216 | 216 | } |
217 | 217 | |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | // @internal To find all, search WP trunk for `wp_schedule_(single_)?event`. |
222 | 222 | $core_cron_hooks = array( |
223 | 223 | 'do_pings', |
224 | - 'importer_scheduled_cleanup', // WP 3.1+. |
|
224 | + 'importer_scheduled_cleanup', // WP 3.1+. |
|
225 | 225 | 'publish_future_post', |
226 | - 'update_network_counts', // WP 3.1+. |
|
227 | - 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
228 | - 'wp_maybe_auto_update', // WP 3.7+. |
|
226 | + 'update_network_counts', // WP 3.1+. |
|
227 | + 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
228 | + 'wp_maybe_auto_update', // WP 3.7+. |
|
229 | 229 | 'wp_scheduled_auto_draft_delete', // WP 3.4+. |
230 | - 'wp_scheduled_delete', // WP 2.9+. |
|
231 | - 'wp_split_shared_term_batch', // WP 4.3+. |
|
230 | + 'wp_scheduled_delete', // WP 2.9+. |
|
231 | + 'wp_split_shared_term_batch', // WP 4.3+. |
|
232 | 232 | 'wp_update_plugins', |
233 | 233 | 'wp_update_themes', |
234 | 234 | 'wp_version_check', |
235 | 235 | ); |
236 | 236 | |
237 | 237 | // Sort and count crons. |
238 | - foreach ( $this->_crons as $time => $time_cron_array ) { |
|
239 | - foreach ( $time_cron_array as $hook => $data ) { |
|
238 | + foreach ($this->_crons as $time => $time_cron_array) { |
|
239 | + foreach ($time_cron_array as $hook => $data) { |
|
240 | 240 | $this->_total_crons++; |
241 | 241 | |
242 | - if ( in_array( $hook, $core_cron_hooks, true ) ) { |
|
243 | - $this->_core_crons[ $time ][ $hook ] = $data; |
|
244 | - $this->_total_core_crons += count( $data ); |
|
242 | + if (in_array($hook, $core_cron_hooks, true)) { |
|
243 | + $this->_core_crons[$time][$hook] = $data; |
|
244 | + $this->_total_core_crons += count($data); |
|
245 | 245 | } else { |
246 | - $this->_user_crons[ $time ][ $hook ] = $data; |
|
247 | - $this->_total_user_crons += count( $data ); |
|
246 | + $this->_user_crons[$time][$hook] = $data; |
|
247 | + $this->_total_user_crons += count($data); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | } |
@@ -260,71 +260,71 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return void|string Void on failure; table display of events on success. |
262 | 262 | */ |
263 | - private function display_events( $events ) { |
|
264 | - if ( is_null( $events ) || empty( $events ) ) { |
|
263 | + private function display_events($events) { |
|
264 | + if (is_null($events) || empty($events)) { |
|
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
268 | 268 | echo ' |
269 | 269 | <table class="zt-debug-bar-cron-event-table"> |
270 | 270 | <thead><tr> |
271 | - <th class="col1">', esc_html__( 'Next Execution', 'zt-debug-bar-cron' ), '</th> |
|
272 | - <th class="col2">', esc_html__( 'Hook', 'zt-debug-bar-cron' ), '</th> |
|
273 | - <th class="col3">', esc_html__( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
274 | - <th class="col4">', esc_html__( 'Interval Value', 'zt-debug-bar-cron' ), '</th> |
|
275 | - <th class="col5">', esc_html__( 'Args', 'zt-debug-bar-cron' ), '</th> |
|
271 | + <th class="col1">', esc_html__('Next Execution', 'zt-debug-bar-cron'), '</th> |
|
272 | + <th class="col2">', esc_html__('Hook', 'zt-debug-bar-cron'), '</th> |
|
273 | + <th class="col3">', esc_html__('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
274 | + <th class="col4">', esc_html__('Interval Value', 'zt-debug-bar-cron'), '</th> |
|
275 | + <th class="col5">', esc_html__('Args', 'zt-debug-bar-cron'), '</th> |
|
276 | 276 | </tr></thead> |
277 | 277 | <tbody>'; |
278 | 278 | |
279 | - foreach ( $events as $time => $time_cron_array ) { |
|
280 | - foreach ( $time_cron_array as $hook => $data ) { |
|
281 | - foreach ( $data as $hash => $info ) { |
|
279 | + foreach ($events as $time => $time_cron_array) { |
|
280 | + foreach ($time_cron_array as $hook => $data) { |
|
281 | + foreach ($data as $hash => $info) { |
|
282 | 282 | echo ' |
283 | 283 | <tr> |
284 | 284 | <td'; |
285 | 285 | |
286 | 286 | // Add a class if past current time. |
287 | - if ( time() > $time && 'No' === $this->_doing_cron ) { |
|
287 | + if (time() > $time && 'No' === $this->_doing_cron) { |
|
288 | 288 | echo ' class="past"'; |
289 | 289 | } |
290 | 290 | |
291 | 291 | echo '> |
292 | - ', esc_html( date( 'Y-m-d H:i:s', $time ) ), '<br /> |
|
293 | - ', intval( $time ), '<br /> |
|
294 | - ', esc_html( $this->display_past_time( human_time_diff( $time ), $time ) ), ' |
|
292 | + ', esc_html(date('Y-m-d H:i:s', $time)), '<br /> |
|
293 | + ', intval($time), '<br /> |
|
294 | + ', esc_html($this->display_past_time(human_time_diff($time), $time)), ' |
|
295 | 295 | </td> |
296 | - <td>', esc_html( $hook ), '</td>'; |
|
296 | + <td>', esc_html($hook), '</td>'; |
|
297 | 297 | |
298 | 298 | |
299 | 299 | // Report the schedule. |
300 | 300 | echo ' |
301 | 301 | <td>'; |
302 | - if ( $info['schedule'] ) { |
|
303 | - echo esc_html( $info['schedule'] ); |
|
302 | + if ($info['schedule']) { |
|
303 | + echo esc_html($info['schedule']); |
|
304 | 304 | } else { |
305 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
305 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
306 | 306 | } |
307 | 307 | echo '</td>'; |
308 | 308 | |
309 | 309 | // Report the interval. |
310 | 310 | echo ' |
311 | 311 | <td>'; |
312 | - if ( isset( $info['interval'] ) ) { |
|
312 | + if (isset($info['interval'])) { |
|
313 | 313 | /* TRANSLATORS: %s is number of seconds. */ |
314 | - printf( esc_html__( '%ss', 'zt-debug-bar-cron' ) . '<br />', intval( wp_strip_all_tags( $info['interval'] ) ) ); |
|
314 | + printf(esc_html__('%ss', 'zt-debug-bar-cron').'<br />', intval(wp_strip_all_tags($info['interval']))); |
|
315 | 315 | /* TRANSLATORS: %s is number of minutes. */ |
316 | - printf( esc_html__( '%sm', 'zt-debug-bar-cron' ) . '<br />', intval( wp_strip_all_tags( $info['interval'] ) / 60 ) ); |
|
316 | + printf(esc_html__('%sm', 'zt-debug-bar-cron').'<br />', intval(wp_strip_all_tags($info['interval']) / 60)); |
|
317 | 317 | /* TRANSLATORS: %s is number of hours. */ |
318 | - printf( esc_html__( '%sh', 'zt-debug-bar-cron' ), intval( wp_strip_all_tags( $info['interval'] ) / ( 60 * 60 ) ) ); |
|
318 | + printf(esc_html__('%sh', 'zt-debug-bar-cron'), intval(wp_strip_all_tags($info['interval']) / (60 * 60))); |
|
319 | 319 | } else { |
320 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
320 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
321 | 321 | } |
322 | 322 | echo '</td>'; |
323 | 323 | |
324 | 324 | // Report the args. |
325 | 325 | echo ' |
326 | 326 | <td>'; |
327 | - $this->display_cron_arguments( $info['args'] ); |
|
327 | + $this->display_cron_arguments($info['args']); |
|
328 | 328 | echo '</td> |
329 | 329 | </tr>'; |
330 | 330 | } |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return void |
346 | 346 | */ |
347 | - private function display_cron_arguments( $args ) { |
|
347 | + private function display_cron_arguments($args) { |
|
348 | 348 | // Arguments defaults to an empty array if no arguments are given. |
349 | - if ( is_array( $args ) && array() === $args ) { |
|
350 | - echo esc_html__( 'No Args', 'zt-debug-bar-cron' ); |
|
349 | + if (is_array($args) && array() === $args) { |
|
350 | + echo esc_html__('No Args', 'zt-debug-bar-cron'); |
|
351 | 351 | return; |
352 | 352 | } |
353 | 353 | |
354 | 354 | // Ok, we have an argument, let's pretty print it. |
355 | - if ( defined( 'Debug_Bar_Pretty_Output::VERSION' ) ) { |
|
356 | - echo Debug_Bar_Pretty_Output::get_output( $args, '', true ); // WPCS: XSS ok. |
|
355 | + if (defined('Debug_Bar_Pretty_Output::VERSION')) { |
|
356 | + echo Debug_Bar_Pretty_Output::get_output($args, '', true); // WPCS: XSS ok. |
|
357 | 357 | } else { |
358 | 358 | // An old version of the pretty output class was loaded. |
359 | 359 | // Real possibility as there are several DB plugins using the pretty print class. |
360 | - Debug_Bar_Pretty_Output::output( $args, '', true ); |
|
360 | + Debug_Bar_Pretty_Output::output($args, '', true); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
@@ -371,24 +371,24 @@ discard block |
||
371 | 371 | echo ' |
372 | 372 | <table class="zt-debug-bar-cron-event-table"> |
373 | 373 | <thead><tr> |
374 | - <th class="col1">', esc_html__( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
375 | - <th class="col2">', esc_html__( 'Interval (S)', 'zt-debug-bar-cron' ), '</th> |
|
376 | - <th class="col3">', esc_html__( 'Interval (M)', 'zt-debug-bar-cron' ), '</th> |
|
377 | - <th class="col4">', esc_html__( 'Interval (H)', 'zt-debug-bar-cron' ), '</th> |
|
378 | - <th class="col5">', esc_html__( 'Display Name', 'zt-debug-bar-cron' ), '</th> |
|
374 | + <th class="col1">', esc_html__('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
375 | + <th class="col2">', esc_html__('Interval (S)', 'zt-debug-bar-cron'), '</th> |
|
376 | + <th class="col3">', esc_html__('Interval (M)', 'zt-debug-bar-cron'), '</th> |
|
377 | + <th class="col4">', esc_html__('Interval (H)', 'zt-debug-bar-cron'), '</th> |
|
378 | + <th class="col5">', esc_html__('Display Name', 'zt-debug-bar-cron'), '</th> |
|
379 | 379 | </tr></thead> |
380 | 380 | <tbody>'; |
381 | 381 | |
382 | 382 | |
383 | 383 | $schedules = wp_get_schedules(); |
384 | - foreach ( $schedules as $interval_hook => $data ) { |
|
384 | + foreach ($schedules as $interval_hook => $data) { |
|
385 | 385 | echo ' |
386 | 386 | <tr> |
387 | - <td>', esc_html( $interval_hook ), '</td> |
|
388 | - <td>', intval( wp_strip_all_tags( $data['interval'] ) ), '</td> |
|
389 | - <td>', intval( wp_strip_all_tags( $data['interval'] ) / 60 ), '</td> |
|
390 | - <td>', intval( wp_strip_all_tags( $data['interval'] ) / ( 60 * 60 ) ), '</td> |
|
391 | - <td>', esc_html( $data['display'] ) . '</td> |
|
387 | + <td>', esc_html($interval_hook), '</td> |
|
388 | + <td>', intval(wp_strip_all_tags($data['interval'])), '</td> |
|
389 | + <td>', intval(wp_strip_all_tags($data['interval']) / 60), '</td> |
|
390 | + <td>', intval(wp_strip_all_tags($data['interval']) / (60 * 60)), '</td> |
|
391 | + <td>', esc_html($data['display']).'</td> |
|
392 | 392 | </tr>'; |
393 | 393 | } |
394 | 394 | |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return string |
408 | 408 | */ |
409 | - private function display_past_time( $human_time, $time ) { |
|
410 | - if ( time() > $time ) { |
|
409 | + private function display_past_time($human_time, $time) { |
|
410 | + if (time() > $time) { |
|
411 | 411 | /* TRANSLATORS: %s is a human readable time difference. */ |
412 | - return sprintf( __( '%s ago', 'zt-debug-bar-cron' ), $human_time ); |
|
412 | + return sprintf(__('%s ago', 'zt-debug-bar-cron'), $human_time); |
|
413 | 413 | } else { |
414 | 414 | return $human_time; |
415 | 415 | } |