@@ -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. |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private $_core_cron_hooks = array( |
90 | 90 | 'do_pings', |
91 | - 'importer_scheduled_cleanup', // WP 3.1+. |
|
91 | + 'importer_scheduled_cleanup', // WP 3.1+. |
|
92 | 92 | 'publish_future_post', |
93 | - 'update_network_counts', // WP 3.1+. |
|
94 | - 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
95 | - 'wp_maybe_auto_update', // WP 3.7+. |
|
93 | + 'update_network_counts', // WP 3.1+. |
|
94 | + 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
95 | + 'wp_maybe_auto_update', // WP 3.7+. |
|
96 | 96 | 'wp_scheduled_auto_draft_delete', // WP 3.4+. |
97 | - 'wp_scheduled_delete', // WP 2.9+. |
|
98 | - 'wp_split_shared_term_batch', // WP 4.3+. |
|
97 | + 'wp_scheduled_delete', // WP 2.9+. |
|
98 | + 'wp_split_shared_term_batch', // WP 4.3+. |
|
99 | 99 | 'wp_update_plugins', |
100 | 100 | 'wp_update_themes', |
101 | 101 | 'wp_version_check', |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * @return void |
110 | 110 | */ |
111 | 111 | public function init() { |
112 | - load_plugin_textdomain( 'zt-debug-bar-cron', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
113 | - $this->title( __( 'Cron', 'zt-debug-bar-cron' ) ); |
|
114 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
115 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
112 | + load_plugin_textdomain('zt-debug-bar-cron', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
113 | + $this->title(__('Cron', 'zt-debug-bar-cron')); |
|
114 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
115 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public function enqueue_scripts_styles() { |
125 | - $suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ); |
|
125 | + $suffix = ((defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'); |
|
126 | 126 | |
127 | 127 | wp_enqueue_style( |
128 | 128 | self::DBCRON_NAME, |
129 | - plugins_url( 'css/' . self::DBCRON_NAME . $suffix . '.css', __FILE__ ), |
|
130 | - array( 'debug-bar' ), |
|
129 | + plugins_url('css/'.self::DBCRON_NAME.$suffix.'.css', __FILE__), |
|
130 | + array('debug-bar'), |
|
131 | 131 | self::DBCRON_STYLES_VERSION |
132 | 132 | ); |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @return void |
140 | 140 | */ |
141 | 141 | public function prerender() { |
142 | - $this->set_visible( true ); |
|
142 | + $this->set_visible(true); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -151,49 +151,49 @@ discard block |
||
151 | 151 | public function render() { |
152 | 152 | $this->get_crons(); |
153 | 153 | |
154 | - $this->_doing_cron = get_transient( 'doing_cron' ) ? __( 'Yes', 'zt-debug-bar-cron' ) : __( 'No', 'zt-debug-bar-cron' ); |
|
154 | + $this->_doing_cron = get_transient('doing_cron') ? __('Yes', 'zt-debug-bar-cron') : __('No', 'zt-debug-bar-cron'); |
|
155 | 155 | |
156 | 156 | // Get the time of the next event. |
157 | - $cron_times = ( is_array( $this->_crons ) ? array_keys( $this->_crons ) : array() ); |
|
157 | + $cron_times = (is_array($this->_crons) ? array_keys($this->_crons) : array()); |
|
158 | 158 | $unix_time_next_cron = (int) $cron_times[0]; |
159 | - $time_next_cron = date( 'Y-m-d H:i:s', $unix_time_next_cron ); |
|
159 | + $time_next_cron = date('Y-m-d H:i:s', $unix_time_next_cron); |
|
160 | 160 | |
161 | - $human_time_next_cron = human_time_diff( $unix_time_next_cron ); |
|
161 | + $human_time_next_cron = human_time_diff($unix_time_next_cron); |
|
162 | 162 | |
163 | 163 | // Add a class if past current time and doing cron is not running. |
164 | - $times_class = $this->is_time_in_past( $unix_time_next_cron ) ? ' past' : ''; |
|
164 | + $times_class = $this->is_time_in_past($unix_time_next_cron) ? ' past' : ''; |
|
165 | 165 | |
166 | 166 | $this->load_debug_bar_pretty_output(); |
167 | 167 | |
168 | 168 | echo // WPCS: XSS ok. |
169 | 169 | ' |
170 | 170 | <div class="debug-bar-cron"> |
171 | - <h2><span>', esc_html__( 'Total Events', 'zt-debug-bar-cron' ), ':</span>', $this->_total_crons, '</h2> |
|
172 | - <h2><span>', esc_html__( 'Core Events', 'zt-debug-bar-cron' ), ':</span>', $this->_total_core_crons, '</h2> |
|
173 | - <h2><span>', esc_html__( 'Custom Events', 'zt-debug-bar-cron' ), ':</span>', $this->_total_user_crons, '</h2> |
|
174 | - <h2><span>', esc_html__( 'Doing Cron', 'zt-debug-bar-cron' ), ':</span>', esc_html( $this->_doing_cron ), '</h2> |
|
175 | - <h2 class="times', esc_attr( $times_class ), '"><span>', esc_html__( 'Next Event', 'zt-debug-bar-cron' ), ':</span> |
|
176 | - ', esc_html( $time_next_cron ), '<br /> |
|
171 | + <h2><span>', esc_html__('Total Events', 'zt-debug-bar-cron'), ':</span>', $this->_total_crons, '</h2> |
|
172 | + <h2><span>', esc_html__('Core Events', 'zt-debug-bar-cron'), ':</span>', $this->_total_core_crons, '</h2> |
|
173 | + <h2><span>', esc_html__('Custom Events', 'zt-debug-bar-cron'), ':</span>', $this->_total_user_crons, '</h2> |
|
174 | + <h2><span>', esc_html__('Doing Cron', 'zt-debug-bar-cron'), ':</span>', esc_html($this->_doing_cron), '</h2> |
|
175 | + <h2 class="times', esc_attr($times_class), '"><span>', esc_html__('Next Event', 'zt-debug-bar-cron'), ':</span> |
|
176 | + ', esc_html($time_next_cron), '<br /> |
|
177 | 177 | ', $unix_time_next_cron, '<br /> |
178 | - ', esc_html( $this->display_past_time( $human_time_next_cron, $unix_time_next_cron ) ), ' |
|
178 | + ', esc_html($this->display_past_time($human_time_next_cron, $unix_time_next_cron)), ' |
|
179 | 179 | </h2> |
180 | - <h2><span>', esc_html__( 'Current Time', 'zt-debug-bar-cron' ), ':</span>', esc_html( date( 'H:i:s' ) ), '</h2> |
|
180 | + <h2><span>', esc_html__('Current Time', 'zt-debug-bar-cron'), ':</span>', esc_html(date('H:i:s')), '</h2> |
|
181 | 181 | |
182 | 182 | <div class="clear"></div> |
183 | 183 | |
184 | - <h3>', esc_html__( 'Schedules', 'zt-debug-bar-cron' ), '</h3>'; |
|
184 | + <h3>', esc_html__('Schedules', 'zt-debug-bar-cron'), '</h3>'; |
|
185 | 185 | |
186 | 186 | $this->display_schedules(); |
187 | 187 | |
188 | 188 | echo ' |
189 | - <h3>', esc_html__( 'Custom Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
189 | + <h3>', esc_html__('Custom Events', 'zt-debug-bar-cron'), '</h3>'; |
|
190 | 190 | |
191 | - $this->display_events( $this->_user_crons, __( 'No Custom Events scheduled.', 'zt-debug-bar-cron' ) ); |
|
191 | + $this->display_events($this->_user_crons, __('No Custom Events scheduled.', 'zt-debug-bar-cron')); |
|
192 | 192 | |
193 | 193 | echo ' |
194 | - <h3>', esc_html__( 'Core Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
194 | + <h3>', esc_html__('Core Events', 'zt-debug-bar-cron'), '</h3>'; |
|
195 | 195 | |
196 | - $this->display_events( $this->_core_crons, __( 'No Core Events scheduled.', 'zt-debug-bar-cron' ) ); |
|
196 | + $this->display_events($this->_core_crons, __('No Core Events scheduled.', 'zt-debug-bar-cron')); |
|
197 | 197 | |
198 | 198 | echo ' |
199 | 199 | </div>'; |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | * @return array|null Array of crons. |
209 | 209 | */ |
210 | 210 | private function get_crons() { |
211 | - if ( is_array( $this->_crons ) ) { |
|
211 | + if (is_array($this->_crons)) { |
|
212 | 212 | return $this->_crons; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $crons = _get_cron_array(); |
216 | - if ( is_array( $crons ) && ! empty( $crons ) ) { |
|
216 | + if (is_array($crons) && ! empty($crons)) { |
|
217 | 217 | $this->_crons = $crons; |
218 | 218 | $this->sort_count_crons(); |
219 | 219 | } |
@@ -229,16 +229,16 @@ discard block |
||
229 | 229 | * a total count for the crons as this number is otherwise tough to get. |
230 | 230 | */ |
231 | 231 | private function sort_count_crons() { |
232 | - foreach ( $this->_crons as $time => $time_cron_array ) { |
|
233 | - foreach ( $time_cron_array as $hook => $data ) { |
|
234 | - $this->_total_crons += count( $data ); |
|
232 | + foreach ($this->_crons as $time => $time_cron_array) { |
|
233 | + foreach ($time_cron_array as $hook => $data) { |
|
234 | + $this->_total_crons += count($data); |
|
235 | 235 | |
236 | - if ( in_array( $hook, $this->_core_cron_hooks, true ) ) { |
|
237 | - $this->_core_crons[ $time ][ $hook ] = $data; |
|
238 | - $this->_total_core_crons += count( $data ); |
|
236 | + if (in_array($hook, $this->_core_cron_hooks, true)) { |
|
237 | + $this->_core_crons[$time][$hook] = $data; |
|
238 | + $this->_total_core_crons += count($data); |
|
239 | 239 | } else { |
240 | - $this->_user_crons[ $time ][ $hook ] = $data; |
|
241 | - $this->_total_user_crons += count( $data ); |
|
240 | + $this->_user_crons[$time][$hook] = $data; |
|
241 | + $this->_total_user_crons += count($data); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -251,74 +251,74 @@ discard block |
||
251 | 251 | * @param array $events Array of events. |
252 | 252 | * @param string $no_events_msg Message to display if there are no events. |
253 | 253 | */ |
254 | - private function display_events( $events, $no_events_msg ) { |
|
254 | + private function display_events($events, $no_events_msg) { |
|
255 | 255 | // Exit early if no events found. |
256 | - if ( ! is_array( $events ) || empty( $events ) ) { |
|
256 | + if ( ! is_array($events) || empty($events)) { |
|
257 | 257 | echo ' |
258 | - <p>', esc_html( $no_events_msg ), '</p>'; |
|
258 | + <p>', esc_html($no_events_msg), '</p>'; |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
262 | 262 | echo ' |
263 | 263 | <table class="zt-debug-bar-cron-table zt-debug-bar-cron-event-table"> |
264 | 264 | <thead><tr> |
265 | - <th class="col1">', esc_html__( 'Next Execution', 'zt-debug-bar-cron' ), '</th> |
|
266 | - <th class="col2">', esc_html__( 'Hook', 'zt-debug-bar-cron' ), '</th> |
|
267 | - <th class="col3">', esc_html__( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
268 | - <th class="col4">', esc_html__( 'Interval Value', 'zt-debug-bar-cron' ), '</th> |
|
269 | - <th class="col5">', esc_html__( 'Args', 'zt-debug-bar-cron' ), '</th> |
|
265 | + <th class="col1">', esc_html__('Next Execution', 'zt-debug-bar-cron'), '</th> |
|
266 | + <th class="col2">', esc_html__('Hook', 'zt-debug-bar-cron'), '</th> |
|
267 | + <th class="col3">', esc_html__('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
268 | + <th class="col4">', esc_html__('Interval Value', 'zt-debug-bar-cron'), '</th> |
|
269 | + <th class="col5">', esc_html__('Args', 'zt-debug-bar-cron'), '</th> |
|
270 | 270 | </tr></thead> |
271 | 271 | <tbody>'; |
272 | 272 | |
273 | - foreach ( $events as $time => $time_cron_array ) { |
|
273 | + foreach ($events as $time => $time_cron_array) { |
|
274 | 274 | $time = (int) $time; |
275 | - $event_count = $this->get_arg_set_count( $time_cron_array ); |
|
275 | + $event_count = $this->get_arg_set_count($time_cron_array); |
|
276 | 276 | $show_time = true; |
277 | 277 | |
278 | - foreach ( $time_cron_array as $hook => $data ) { |
|
279 | - $row_attributes = $this->get_event_row_attributes( $time, $hook ); |
|
280 | - $arg_set_count = count( $data ); |
|
278 | + foreach ($time_cron_array as $hook => $data) { |
|
279 | + $row_attributes = $this->get_event_row_attributes($time, $hook); |
|
280 | + $arg_set_count = count($data); |
|
281 | 281 | $show_hook = true; |
282 | 282 | |
283 | - foreach ( $data as $hash => $info ) { |
|
283 | + foreach ($data as $hash => $info) { |
|
284 | 284 | echo // WPCS: xss ok. |
285 | 285 | ' |
286 | 286 | <tr', $row_attributes, '>'; |
287 | 287 | |
288 | - if ( true === $show_time ) { |
|
289 | - $this->display_event_time( $time, $event_count ); |
|
288 | + if (true === $show_time) { |
|
289 | + $this->display_event_time($time, $event_count); |
|
290 | 290 | $show_time = false; |
291 | 291 | } |
292 | 292 | |
293 | - if ( true === $show_hook ) { |
|
294 | - $this->display_event_hook( $hook, $arg_set_count ); |
|
293 | + if (true === $show_hook) { |
|
294 | + $this->display_event_hook($hook, $arg_set_count); |
|
295 | 295 | $show_hook = false; |
296 | 296 | } |
297 | 297 | |
298 | 298 | // Report the schedule. |
299 | 299 | echo ' |
300 | 300 | <td>'; |
301 | - $this->display_event_schedule( $info ); |
|
301 | + $this->display_event_schedule($info); |
|
302 | 302 | echo '</td>'; |
303 | 303 | |
304 | 304 | // Report the interval. |
305 | 305 | echo ' |
306 | 306 | <td class="intervals">'; |
307 | - $this->display_event_intervals( $info ); |
|
307 | + $this->display_event_intervals($info); |
|
308 | 308 | echo '</td>'; |
309 | 309 | |
310 | 310 | // Report the args. |
311 | 311 | echo ' |
312 | 312 | <td>'; |
313 | - $this->display_event_cron_arguments( $info['args'] ); |
|
313 | + $this->display_event_cron_arguments($info['args']); |
|
314 | 314 | echo '</td> |
315 | 315 | </tr>'; |
316 | 316 | } |
317 | - unset( $hash, $info ); |
|
317 | + unset($hash, $info); |
|
318 | 318 | } |
319 | - unset( $hook, $data, $row_attributes, $arg_set_count, $show_hook ); |
|
319 | + unset($hook, $data, $row_attributes, $arg_set_count, $show_hook); |
|
320 | 320 | } |
321 | - unset( $time, $time_cron_array, $hook_count, $show_time ); |
|
321 | + unset($time, $time_cron_array, $hook_count, $show_time); |
|
322 | 322 | |
323 | 323 | echo ' |
324 | 324 | </tbody> |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @return int |
335 | 335 | */ |
336 | - private function get_arg_set_count( $hook_array ) { |
|
336 | + private function get_arg_set_count($hook_array) { |
|
337 | 337 | $count = 0; |
338 | - foreach ( $hook_array as $set ) { |
|
339 | - $count += count( $set ); |
|
338 | + foreach ($hook_array as $set) { |
|
339 | + $count += count($set); |
|
340 | 340 | } |
341 | 341 | return $count; |
342 | 342 | } |
@@ -350,24 +350,24 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - private function get_event_row_attributes( $time, $hook ) { |
|
353 | + private function get_event_row_attributes($time, $hook) { |
|
354 | 354 | $attributes = ''; |
355 | 355 | $classes = array(); |
356 | 356 | |
357 | 357 | // Add a class if past current time. |
358 | - if ( $this->is_time_in_past( $time ) ) { |
|
358 | + if ($this->is_time_in_past($time)) { |
|
359 | 359 | $classes[] = 'past'; |
360 | 360 | } |
361 | 361 | |
362 | 362 | // Verify if any events are hooked in. |
363 | - if ( false === has_action( $hook ) ) { |
|
363 | + if (false === has_action($hook)) { |
|
364 | 364 | /* TRANSLATORS: This text will display as a tooltip. %1$s will be replaced by a line break. */ |
365 | - $attributes .= ' title="' . sprintf( esc_attr__( 'No actions are hooked into this event at this time.%1$sThe most likely reason for this is that a plugin or theme was de-activated or uninstalled and didn\'t clean up after itself.%1$sHowever, a number of plugins also use the best practice of lean loading and only hook in conditionally, so check carefully if you intend to remove this event.', 'zt-debug-bar-cron' ), "\n" ) . '"'; |
|
365 | + $attributes .= ' title="'.sprintf(esc_attr__('No actions are hooked into this event at this time.%1$sThe most likely reason for this is that a plugin or theme was de-activated or uninstalled and didn\'t clean up after itself.%1$sHowever, a number of plugins also use the best practice of lean loading and only hook in conditionally, so check carefully if you intend to remove this event.', 'zt-debug-bar-cron'), "\n").'"'; |
|
366 | 366 | $classes[] = 'empty-event'; |
367 | 367 | } |
368 | 368 | |
369 | - if ( ! empty( $classes ) ) { |
|
370 | - $attributes .= ' class="' . implode( ' ', $classes ) . '"'; |
|
369 | + if ( ! empty($classes)) { |
|
370 | + $attributes .= ' class="'.implode(' ', $classes).'"'; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $attributes; |
@@ -380,15 +380,15 @@ discard block |
||
380 | 380 | * @param int $time Timestamp. |
381 | 381 | * @param int $event_count Number of events running at this time. |
382 | 382 | */ |
383 | - private function display_event_time( $time, $event_count ) { |
|
384 | - $row_span = ( $event_count > 1 ) ? ' rowspan="' . $event_count . '"' : ''; |
|
383 | + private function display_event_time($time, $event_count) { |
|
384 | + $row_span = ($event_count > 1) ? ' rowspan="'.$event_count.'"' : ''; |
|
385 | 385 | |
386 | 386 | echo // WPCS: xss ok. |
387 | 387 | ' |
388 | - <td' . $row_span . '> |
|
389 | - ', date( 'Y-m-d H:i:s', $time ), '<br /> |
|
388 | + <td' . $row_span.'> |
|
389 | + ', date('Y-m-d H:i:s', $time), '<br /> |
|
390 | 390 | ', $time, '<br /> |
391 | - ', esc_html( $this->display_past_time( human_time_diff( $time ), $time ) ), ' |
|
391 | + ', esc_html($this->display_past_time(human_time_diff($time), $time)), ' |
|
392 | 392 | </td>'; |
393 | 393 | } |
394 | 394 | |
@@ -399,12 +399,12 @@ discard block |
||
399 | 399 | * @param string $hook Hook name. |
400 | 400 | * @param int $arg_set_count Number of events running at this time and on this hook. |
401 | 401 | */ |
402 | - private function display_event_hook( $hook, $arg_set_count ) { |
|
403 | - $row_span = ( $arg_set_count > 1 ) ? ' rowspan="' . $arg_set_count . '"' : ''; |
|
402 | + private function display_event_hook($hook, $arg_set_count) { |
|
403 | + $row_span = ($arg_set_count > 1) ? ' rowspan="'.$arg_set_count.'"' : ''; |
|
404 | 404 | |
405 | 405 | echo // WPCS: xss ok. |
406 | 406 | ' |
407 | - <td' . $row_span . '>', esc_html( $hook ), '</td>'; |
|
407 | + <td' . $row_span.'>', esc_html($hook), '</td>'; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @param array $info Event info array. |
415 | 415 | */ |
416 | - private function display_event_schedule( $info ) { |
|
417 | - if ( ! empty( $info['schedule'] ) ) { |
|
418 | - echo esc_html( $info['schedule'] ); |
|
416 | + private function display_event_schedule($info) { |
|
417 | + if ( ! empty($info['schedule'])) { |
|
418 | + echo esc_html($info['schedule']); |
|
419 | 419 | } else { |
420 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
420 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
@@ -427,18 +427,18 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @param array $info Event info array. |
429 | 429 | */ |
430 | - private function display_event_intervals( $info ) { |
|
431 | - if ( ! empty( $info['interval'] ) ) { |
|
430 | + private function display_event_intervals($info) { |
|
431 | + if ( ! empty($info['interval'])) { |
|
432 | 432 | $interval = (int) $info['interval']; |
433 | 433 | /* TRANSLATORS: %s is number of seconds. */ |
434 | - printf( esc_html__( '%ss', 'zt-debug-bar-cron' ) . '<br />', $interval ); // WPCS: XSS ok. |
|
434 | + printf(esc_html__('%ss', 'zt-debug-bar-cron').'<br />', $interval); // WPCS: XSS ok. |
|
435 | 435 | /* TRANSLATORS: %s is number of minutes. */ |
436 | - printf( esc_html__( '%sm', 'zt-debug-bar-cron' ) . '<br />', $this->get_minutes( $interval ) ); // WPCS: XSS ok. |
|
436 | + printf(esc_html__('%sm', 'zt-debug-bar-cron').'<br />', $this->get_minutes($interval)); // WPCS: XSS ok. |
|
437 | 437 | /* TRANSLATORS: %s is number of hours. */ |
438 | - printf( esc_html__( '%sh', 'zt-debug-bar-cron' ), $this->get_hours( $interval ) ); // WPCS: XSS ok. |
|
439 | - unset( $interval ); |
|
438 | + printf(esc_html__('%sh', 'zt-debug-bar-cron'), $this->get_hours($interval)); // WPCS: XSS ok. |
|
439 | + unset($interval); |
|
440 | 440 | } else { |
441 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
441 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
@@ -450,15 +450,15 @@ discard block |
||
450 | 450 | * |
451 | 451 | * @return void |
452 | 452 | */ |
453 | - private function display_event_cron_arguments( $args ) { |
|
453 | + private function display_event_cron_arguments($args) { |
|
454 | 454 | // Arguments defaults to an empty array if no arguments are given. |
455 | - if ( is_array( $args ) && array() === $args ) { |
|
456 | - echo esc_html__( 'No Args', 'zt-debug-bar-cron' ); |
|
455 | + if (is_array($args) && array() === $args) { |
|
456 | + echo esc_html__('No Args', 'zt-debug-bar-cron'); |
|
457 | 457 | return; |
458 | 458 | } |
459 | 459 | |
460 | 460 | // Ok, we have an argument, let's pretty print it. |
461 | - $this->print_pretty_output( $args ); |
|
461 | + $this->print_pretty_output($args); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -471,28 +471,28 @@ discard block |
||
471 | 471 | echo ' |
472 | 472 | <table class="zt-debug-bar-cron-table zt-debug-bar-cron-schedule-table"> |
473 | 473 | <thead><tr> |
474 | - <th class="col1">', esc_html__( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
475 | - <th class="col2">', esc_html__( 'Interval (S)', 'zt-debug-bar-cron' ), '</th> |
|
476 | - <th class="col3">', esc_html__( 'Interval (M)', 'zt-debug-bar-cron' ), '</th> |
|
477 | - <th class="col4">', esc_html__( 'Interval (H)', 'zt-debug-bar-cron' ), '</th> |
|
478 | - <th class="col5">', esc_html__( 'Display Name', 'zt-debug-bar-cron' ), '</th> |
|
474 | + <th class="col1">', esc_html__('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
475 | + <th class="col2">', esc_html__('Interval (S)', 'zt-debug-bar-cron'), '</th> |
|
476 | + <th class="col3">', esc_html__('Interval (M)', 'zt-debug-bar-cron'), '</th> |
|
477 | + <th class="col4">', esc_html__('Interval (H)', 'zt-debug-bar-cron'), '</th> |
|
478 | + <th class="col5">', esc_html__('Display Name', 'zt-debug-bar-cron'), '</th> |
|
479 | 479 | </tr></thead> |
480 | 480 | <tbody>'; |
481 | 481 | |
482 | 482 | |
483 | 483 | $schedules = wp_get_schedules(); |
484 | - ksort( $schedules ); |
|
485 | - uasort( $schedules, array( $this, 'schedules_sorting' ) ); |
|
486 | - foreach ( $schedules as $interval_hook => $data ) { |
|
484 | + ksort($schedules); |
|
485 | + uasort($schedules, array($this, 'schedules_sorting')); |
|
486 | + foreach ($schedules as $interval_hook => $data) { |
|
487 | 487 | $interval = (int) $data['interval']; |
488 | 488 | echo // WPCS: XSS ok. |
489 | 489 | ' |
490 | 490 | <tr> |
491 | - <td>', esc_html( $interval_hook ), '</td> |
|
491 | + <td>', esc_html($interval_hook), '</td> |
|
492 | 492 | <td>', $interval, '</td> |
493 | - <td>', $this->get_minutes( $interval ), '</td> |
|
494 | - <td>', $this->get_hours( $interval ), '</td> |
|
495 | - <td>', esc_html( $data['display'] ) . '</td> |
|
493 | + <td>', $this->get_minutes($interval), '</td> |
|
494 | + <td>', $this->get_hours($interval), '</td> |
|
495 | + <td>', esc_html($data['display']).'</td> |
|
496 | 496 | </tr>'; |
497 | 497 | } |
498 | 498 | |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @return int Return 1 if $a argument 'interval' greater then $b argument 'interval', 0 if both intervals equivalent and -1 otherwise. |
511 | 511 | */ |
512 | - private function schedules_sorting( $a, $b ) { |
|
513 | - if ( (int) $a['interval'] === (int) $b['interval'] ) { |
|
512 | + private function schedules_sorting($a, $b) { |
|
513 | + if ((int) $a['interval'] === (int) $b['interval']) { |
|
514 | 514 | return 0; |
515 | 515 | } else { |
516 | - return ( ( (int) $a['interval'] > (int) $b['interval'] ) ? 1 : -1 ); |
|
516 | + return (((int) $a['interval'] > (int) $b['interval']) ? 1 : -1); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * |
525 | 525 | * @return bool True if the time has passed, false otherwise. |
526 | 526 | */ |
527 | - private function is_time_in_past( $time ) { |
|
528 | - return ( time() > $time && 'No' === $this->_doing_cron ); |
|
527 | + private function is_time_in_past($time) { |
|
528 | + return (time() > $time && 'No' === $this->_doing_cron); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | * |
537 | 537 | * @return int|float |
538 | 538 | */ |
539 | - private function get_minutes( $time ) { |
|
540 | - return round( ( (int) $time / 60 ), 2 ); |
|
539 | + private function get_minutes($time) { |
|
540 | + return round(((int) $time / 60), 2); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @return int|float |
550 | 550 | */ |
551 | - private function get_hours( $time ) { |
|
552 | - return round( ( (int) $time / 3600 ), 2 ); |
|
551 | + private function get_hours($time) { |
|
552 | + return round(((int) $time / 3600), 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | * |
562 | 562 | * @return string |
563 | 563 | */ |
564 | - private function display_past_time( $human_time, $time ) { |
|
565 | - if ( time() > $time ) { |
|
564 | + private function display_past_time($human_time, $time) { |
|
565 | + if (time() > $time) { |
|
566 | 566 | /* TRANSLATORS: %s is a human readable time difference. */ |
567 | - return sprintf( __( '%s ago', 'zt-debug-bar-cron' ), $human_time ); |
|
567 | + return sprintf(__('%s ago', 'zt-debug-bar-cron'), $human_time); |
|
568 | 568 | } else { |
569 | 569 | return $human_time; |
570 | 570 | } |
@@ -575,13 +575,13 @@ discard block |
||
575 | 575 | * Load the pretty output class & set the recursion limit. |
576 | 576 | */ |
577 | 577 | private function load_debug_bar_pretty_output() { |
578 | - if ( ! class_exists( 'Debug_Bar_Pretty_Output' ) ) { |
|
579 | - require_once plugin_dir_path( __FILE__ ) . 'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php'; |
|
578 | + if ( ! class_exists('Debug_Bar_Pretty_Output')) { |
|
579 | + require_once plugin_dir_path(__FILE__).'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php'; |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | // Limit recursion depth if possible - method available since DBPO v1.4. |
583 | - if ( method_exists( 'Debug_Bar_Pretty_Output', 'limit_recursion' ) ) { |
|
584 | - Debug_Bar_Pretty_Output::limit_recursion( 2 ); |
|
583 | + if (method_exists('Debug_Bar_Pretty_Output', 'limit_recursion')) { |
|
584 | + Debug_Bar_Pretty_Output::limit_recursion(2); |
|
585 | 585 | } |
586 | 586 | } |
587 | 587 | |
@@ -591,13 +591,13 @@ discard block |
||
591 | 591 | * |
592 | 592 | * @param mixed $variable The variable to print. |
593 | 593 | */ |
594 | - private function print_pretty_output( $variable ) { |
|
595 | - if ( defined( 'Debug_Bar_Pretty_Output::VERSION' ) ) { |
|
596 | - echo Debug_Bar_Pretty_Output::get_output( $variable, '', true ); // WPCS: XSS ok. |
|
594 | + private function print_pretty_output($variable) { |
|
595 | + if (defined('Debug_Bar_Pretty_Output::VERSION')) { |
|
596 | + echo Debug_Bar_Pretty_Output::get_output($variable, '', true); // WPCS: XSS ok. |
|
597 | 597 | } else { |
598 | 598 | // An old version of the pretty output class was loaded. |
599 | 599 | // Real possibility as there are several DB plugins using the pretty print class. |
600 | - Debug_Bar_Pretty_Output::output( $variable, '', true ); |
|
600 | + Debug_Bar_Pretty_Output::output($variable, '', true); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @internal Method available since DBPO v1.4. |
609 | 609 | */ |
610 | 610 | private function reset_debug_bar_pretty_output() { |
611 | - if ( method_exists( 'Debug_Bar_Pretty_Output', 'unset_recursion_limit' ) ) { |
|
611 | + if (method_exists('Debug_Bar_Pretty_Output', 'unset_recursion_limit')) { |
|
612 | 612 | Debug_Bar_Pretty_Output::unset_recursion_limit(); |
613 | 613 | } |
614 | 614 | } |