Completed
Branch feature/reduce-code-complexity (2a6dde)
by Juliette
02:17
created
class-debug-bar-cron.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,90 +251,90 @@  discard block
 block discarded – undo
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
-				$hook_count = $this->get_arg_set_count( $time_cron_array );
275
+				$hook_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
-							$row_span = ( $hook_count > 1 ) ? ' rowspan="' . $hook_count . '"' : '';
288
+						if (true === $show_time) {
289
+							$row_span = ($hook_count > 1) ? ' rowspan="'.$hook_count.'"' : '';
290 290
 
291 291
 							echo // WPCS: xss ok.
292 292
 							'
293
-							<td' . $row_span . '>
294
-								', date( 'Y-m-d H:i:s', $time ), '<br />
293
+							<td' . $row_span.'>
294
+								', date('Y-m-d H:i:s', $time), '<br />
295 295
 								', $time, '<br />
296
-								', esc_html( $this->display_past_time( human_time_diff( $time ), $time ) ), '
296
+								', esc_html($this->display_past_time(human_time_diff($time), $time)), '
297 297
 							</td>';
298 298
 
299 299
 							$show_time = false;
300
-							unset( $row_span );
300
+							unset($row_span);
301 301
 						}
302
-						if ( true === $show_hook ) {
303
-							$row_span = ( $arg_set_count > 1 ) ? ' rowspan="' . $arg_set_count . '"' : '';
302
+						if (true === $show_hook) {
303
+							$row_span = ($arg_set_count > 1) ? ' rowspan="'.$arg_set_count.'"' : '';
304 304
 
305 305
 							echo // WPCS: xss ok.
306 306
 							'
307
-							<td' . $row_span . '>', esc_html( $hook ), '</td>';
307
+							<td' . $row_span.'>', esc_html($hook), '</td>';
308 308
 
309 309
 							$show_hook = false;
310
-							unset( $row_span );
310
+							unset($row_span);
311 311
 						}
312 312
 
313 313
 
314 314
 						// Report the schedule.
315 315
 						echo '
316 316
 							<td>';
317
-						$this->display_event_schedule( $info );
317
+						$this->display_event_schedule($info);
318 318
 						echo '</td>';
319 319
 
320 320
 						// Report the interval.
321 321
 						echo '
322 322
 							<td class="intervals">';
323
-						$this->display_event_intervals( $info );
323
+						$this->display_event_intervals($info);
324 324
 						echo '</td>';
325 325
 
326 326
 						// Report the args.
327 327
 						echo '
328 328
 							<td>';
329
-						$this->display_event_cron_arguments( $info['args'] );
329
+						$this->display_event_cron_arguments($info['args']);
330 330
 						echo '</td>
331 331
 						</tr>';
332 332
 					}
333
-					unset( $hash, $info );
333
+					unset($hash, $info);
334 334
 				}
335
-				unset( $hook, $data, $row_attributes, $arg_set_count, $show_hook );
335
+				unset($hook, $data, $row_attributes, $arg_set_count, $show_hook);
336 336
 			}
337
-			unset( $time, $time_cron_array, $hook_count, $show_time );
337
+			unset($time, $time_cron_array, $hook_count, $show_time);
338 338
 
339 339
 			echo '
340 340
 					</tbody>
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 		 *
350 350
 		 * @return int
351 351
 		 */
352
-		private function get_arg_set_count( $hook_array ) {
352
+		private function get_arg_set_count($hook_array) {
353 353
 			$count = 0;
354
-			foreach ( $hook_array as $set ) {
355
-				$count += count( $set );
354
+			foreach ($hook_array as $set) {
355
+				$count += count($set);
356 356
 			}
357 357
 			return $count;
358 358
 		}
@@ -366,24 +366,24 @@  discard block
 block discarded – undo
366 366
 		 *
367 367
 		 * @return string
368 368
 		 */
369
-		private function get_event_row_attributes( $time, $hook ) {
369
+		private function get_event_row_attributes($time, $hook) {
370 370
 			$attributes = '';
371 371
 			$classes    = array();
372 372
 
373 373
 			// Add a class if past current time.
374
-			if ( $this->is_time_in_past( $time ) ) {
374
+			if ($this->is_time_in_past($time)) {
375 375
 				$classes[] = 'past';
376 376
 			}
377 377
 
378 378
 			// Verify if any events are hooked in.
379
-			if ( false === has_action( $hook ) ) {
379
+			if (false === has_action($hook)) {
380 380
 				/* TRANSLATORS: This text will display as a tooltip. %1$s will be replaced by a line break. */
381
-				$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" ) . '"';
381
+				$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").'"';
382 382
 				$classes[]   = 'empty-event';
383 383
 			}
384 384
 
385
-			if ( ! empty( $classes ) ) {
386
-				$attributes .= ' class="' . implode( ' ', $classes ) . '"';
385
+			if ( ! empty($classes)) {
386
+				$attributes .= ' class="'.implode(' ', $classes).'"';
387 387
 			}
388 388
 
389 389
 			return $attributes;
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 		 *
396 396
 		 * @param array $info Event info array.
397 397
 		 */
398
-		private function display_event_schedule( $info ) {
399
-			if ( ! empty( $info['schedule'] ) ) {
400
-				echo esc_html( $info['schedule'] );
398
+		private function display_event_schedule($info) {
399
+			if ( ! empty($info['schedule'])) {
400
+				echo esc_html($info['schedule']);
401 401
 			} else {
402
-				echo esc_html__( 'Single Event', 'zt-debug-bar-cron' );
402
+				echo esc_html__('Single Event', 'zt-debug-bar-cron');
403 403
 			}
404 404
 		}
405 405
 
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
 		 *
410 410
 		 * @param array $info Event info array.
411 411
 		 */
412
-		private function display_event_intervals( $info ) {
413
-			if ( ! empty( $info['interval'] ) ) {
412
+		private function display_event_intervals($info) {
413
+			if ( ! empty($info['interval'])) {
414 414
 				$interval = (int) $info['interval'];
415 415
 				/* TRANSLATORS: %s is number of seconds. */
416
-				printf( esc_html__( '%ss', 'zt-debug-bar-cron' ) . '<br />', $interval ); // WPCS: XSS ok.
416
+				printf(esc_html__('%ss', 'zt-debug-bar-cron').'<br />', $interval); // WPCS: XSS ok.
417 417
 				/* TRANSLATORS: %s is number of minutes. */
418
-				printf( esc_html__( '%sm', 'zt-debug-bar-cron' ) . '<br />', $this->get_minutes( $interval ) ); // WPCS: XSS ok.
418
+				printf(esc_html__('%sm', 'zt-debug-bar-cron').'<br />', $this->get_minutes($interval)); // WPCS: XSS ok.
419 419
 				/* TRANSLATORS: %s is number of hours. */
420
-				printf( esc_html__( '%sh', 'zt-debug-bar-cron' ), $this->get_hours( $interval ) ); // WPCS: XSS ok.
421
-				unset( $interval );
420
+				printf(esc_html__('%sh', 'zt-debug-bar-cron'), $this->get_hours($interval)); // WPCS: XSS ok.
421
+				unset($interval);
422 422
 			} else {
423
-				echo esc_html__( 'Single Event', 'zt-debug-bar-cron' );
423
+				echo esc_html__('Single Event', 'zt-debug-bar-cron');
424 424
 			}
425 425
 		}
426 426
 
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
 		 *
433 433
 		 * @return void
434 434
 		 */
435
-		private function display_event_cron_arguments( $args ) {
435
+		private function display_event_cron_arguments($args) {
436 436
 			// Arguments defaults to an empty array if no arguments are given.
437
-			if ( is_array( $args ) && array() === $args ) {
438
-				echo esc_html__( 'No Args', 'zt-debug-bar-cron' );
437
+			if (is_array($args) && array() === $args) {
438
+				echo esc_html__('No Args', 'zt-debug-bar-cron');
439 439
 				return;
440 440
 			}
441 441
 
442 442
 			// Ok, we have an argument, let's pretty print it.
443
-			$this->print_pretty_output( $args );
443
+			$this->print_pretty_output($args);
444 444
 		}
445 445
 
446 446
 
@@ -453,28 +453,28 @@  discard block
 block discarded – undo
453 453
 			echo '
454 454
 				<table class="zt-debug-bar-cron-table zt-debug-bar-cron-schedule-table">
455 455
 					<thead><tr>
456
-						<th class="col1">', esc_html__( 'Interval Hook', 'zt-debug-bar-cron' ), '</th>
457
-						<th class="col2">', esc_html__( 'Interval (S)', 'zt-debug-bar-cron' ), '</th>
458
-						<th class="col3">', esc_html__( 'Interval (M)', 'zt-debug-bar-cron' ), '</th>
459
-						<th class="col4">', esc_html__( 'Interval (H)', 'zt-debug-bar-cron' ), '</th>
460
-						<th class="col5">', esc_html__( 'Display Name', 'zt-debug-bar-cron' ), '</th>
456
+						<th class="col1">', esc_html__('Interval Hook', 'zt-debug-bar-cron'), '</th>
457
+						<th class="col2">', esc_html__('Interval (S)', 'zt-debug-bar-cron'), '</th>
458
+						<th class="col3">', esc_html__('Interval (M)', 'zt-debug-bar-cron'), '</th>
459
+						<th class="col4">', esc_html__('Interval (H)', 'zt-debug-bar-cron'), '</th>
460
+						<th class="col5">', esc_html__('Display Name', 'zt-debug-bar-cron'), '</th>
461 461
 					</tr></thead>
462 462
 					<tbody>';
463 463
 
464 464
 
465 465
 			$schedules = wp_get_schedules();
466
-			ksort( $schedules );
467
-			uasort( $schedules, array( $this, 'schedules_sorting' ) );
468
-			foreach ( $schedules as $interval_hook => $data ) {
466
+			ksort($schedules);
467
+			uasort($schedules, array($this, 'schedules_sorting'));
468
+			foreach ($schedules as $interval_hook => $data) {
469 469
 				$interval = (int) $data['interval'];
470 470
 				echo // WPCS: XSS ok.
471 471
 				'
472 472
 						<tr>
473
-							<td>', esc_html( $interval_hook ), '</td>
473
+							<td>', esc_html($interval_hook), '</td>
474 474
 							<td>', $interval, '</td>
475
-							<td>', $this->get_minutes( $interval ), '</td>
476
-							<td>', $this->get_hours( $interval ), '</td>
477
-							<td>', esc_html( $data['display'] ) . '</td>
475
+							<td>', $this->get_minutes($interval), '</td>
476
+							<td>', $this->get_hours($interval), '</td>
477
+							<td>', esc_html($data['display']).'</td>
478 478
 						</tr>';
479 479
 			}
480 480
 
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 		 *
492 492
 		 * @return int Return 1 if $a argument 'interval' greater then $b argument 'interval', 0 if both intervals equivalent and -1 otherwise.
493 493
 		 */
494
-		function schedules_sorting( $a, $b ) {
495
-			if ( (int) $a['interval'] === (int) $b['interval'] ) {
494
+		function schedules_sorting($a, $b) {
495
+			if ((int) $a['interval'] === (int) $b['interval']) {
496 496
 				return 0;
497 497
 			} else {
498
-				return ( ( (int) $a['interval'] > (int) $b['interval'] ) ? 1 : -1 );
498
+				return (((int) $a['interval'] > (int) $b['interval']) ? 1 : -1);
499 499
 			}
500 500
 		}
501 501
 
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 		 *
507 507
 		 * @return bool True if the time has passed, false otherwise.
508 508
 		 */
509
-		private function is_time_in_past( $time ) {
510
-			return ( time() > $time && 'No' === $this->_doing_cron );
509
+		private function is_time_in_past($time) {
510
+			return (time() > $time && 'No' === $this->_doing_cron);
511 511
 		}
512 512
 
513 513
 
@@ -518,8 +518,8 @@  discard block
 block discarded – undo
518 518
 		 *
519 519
 		 * @return int|float
520 520
 		 */
521
-		private function get_minutes( $time ) {
522
-			return round( ( (int) $time / 60 ), 2 );
521
+		private function get_minutes($time) {
522
+			return round(((int) $time / 60), 2);
523 523
 		}
524 524
 
525 525
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 		 *
531 531
 		 * @return int|float
532 532
 		 */
533
-		private function get_hours( $time ) {
534
-			return round( ( (int) $time / 3600 ), 2 );
533
+		private function get_hours($time) {
534
+			return round(((int) $time / 3600), 2);
535 535
 		}
536 536
 
537 537
 
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 		 *
544 544
 		 * @return string
545 545
 		 */
546
-		private function display_past_time( $human_time, $time ) {
547
-			if ( time() > $time ) {
546
+		private function display_past_time($human_time, $time) {
547
+			if (time() > $time) {
548 548
 				/* TRANSLATORS: %s is a human readable time difference. */
549
-				return sprintf( __( '%s ago', 'zt-debug-bar-cron' ), $human_time );
549
+				return sprintf(__('%s ago', 'zt-debug-bar-cron'), $human_time);
550 550
 			} else {
551 551
 				return $human_time;
552 552
 			}
@@ -557,13 +557,13 @@  discard block
 block discarded – undo
557 557
 		 * Load the pretty output class & set the recursion limit.
558 558
 		 */
559 559
 		private function load_debug_bar_pretty_output() {
560
-			if ( ! class_exists( 'Debug_Bar_Pretty_Output' ) ) {
561
-				require_once plugin_dir_path( __FILE__ ) . 'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php';
560
+			if ( ! class_exists('Debug_Bar_Pretty_Output')) {
561
+				require_once plugin_dir_path(__FILE__).'inc/debug-bar-pretty-output/class-debug-bar-pretty-output.php';
562 562
 			}
563 563
 
564 564
 			// Limit recursion depth if possible - method available since DBPO v1.4.
565
-			if ( method_exists( 'Debug_Bar_Pretty_Output', 'limit_recursion' ) ) {
566
-				Debug_Bar_Pretty_Output::limit_recursion( 2 );
565
+			if (method_exists('Debug_Bar_Pretty_Output', 'limit_recursion')) {
566
+				Debug_Bar_Pretty_Output::limit_recursion(2);
567 567
 			}
568 568
 		}
569 569
 
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 		 *
574 574
 		 * @param mixed $variable The variable to print.
575 575
 		 */
576
-		private function print_pretty_output( $variable ) {
577
-			if ( defined( 'Debug_Bar_Pretty_Output::VERSION' ) ) {
578
-				echo Debug_Bar_Pretty_Output::get_output( $variable, '', true ); // WPCS: XSS ok.
576
+		private function print_pretty_output($variable) {
577
+			if (defined('Debug_Bar_Pretty_Output::VERSION')) {
578
+				echo Debug_Bar_Pretty_Output::get_output($variable, '', true); // WPCS: XSS ok.
579 579
 			} else {
580 580
 				// An old version of the pretty output class was loaded.
581 581
 				// Real possibility as there are several DB plugins using the pretty print class.
582
-				Debug_Bar_Pretty_Output::output( $variable, '', true );
582
+				Debug_Bar_Pretty_Output::output($variable, '', true);
583 583
 			}
584 584
 		}
585 585
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 		 * @internal Method available since DBPO v1.4.
591 591
 		 */
592 592
 		private function reset_debug_bar_pretty_output() {
593
-			if ( method_exists( 'Debug_Bar_Pretty_Output', 'unset_recursion_limit' ) ) {
593
+			if (method_exists('Debug_Bar_Pretty_Output', 'unset_recursion_limit')) {
594 594
 				Debug_Bar_Pretty_Output::unset_recursion_limit();
595 595
 			}
596 596
 		}
Please login to merge, or discard this patch.