@@ -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. |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | 74 | public function init() { |
| 75 | - load_plugin_textdomain( 'zt-debug-bar-cron', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
| 76 | - $this->title( __( 'Cron', 'zt-debug-bar-cron' ) ); |
|
| 77 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
| 78 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
| 75 | + load_plugin_textdomain('zt-debug-bar-cron', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
| 76 | + $this->title(__('Cron', 'zt-debug-bar-cron')); |
|
| 77 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
| 78 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | * @return void |
| 86 | 86 | */ |
| 87 | 87 | public function enqueue_scripts_styles() { |
| 88 | - $suffix = ( ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ); |
|
| 88 | + $suffix = ((defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'); |
|
| 89 | 89 | |
| 90 | 90 | wp_enqueue_style( |
| 91 | 91 | self::DBCRON_NAME, |
| 92 | - plugins_url( 'css/' . self::DBCRON_NAME . $suffix . '.css', __FILE__ ), |
|
| 93 | - array( 'debug-bar' ), |
|
| 92 | + plugins_url('css/'.self::DBCRON_NAME.$suffix.'.css', __FILE__), |
|
| 93 | + array('debug-bar'), |
|
| 94 | 94 | self::DBCRON_STYLES_VERSION |
| 95 | 95 | ); |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | 104 | public function prerender() { |
| 105 | - $this->set_visible( true ); |
|
| 105 | + $this->set_visible(true); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,53 +114,53 @@ discard block |
||
| 114 | 114 | public function render() { |
| 115 | 115 | $this->get_crons(); |
| 116 | 116 | |
| 117 | - $this->_doing_cron = get_transient( 'doing_cron' ) ? __( 'Yes', 'zt-debug-bar-cron' ) : __( 'No', 'zt-debug-bar-cron' ); |
|
| 117 | + $this->_doing_cron = get_transient('doing_cron') ? __('Yes', 'zt-debug-bar-cron') : __('No', 'zt-debug-bar-cron'); |
|
| 118 | 118 | |
| 119 | 119 | // Get the time of the next event. |
| 120 | - $cron_times = ( is_array( $this->_crons ) ? array_keys( $this->_crons ) : array() ); |
|
| 120 | + $cron_times = (is_array($this->_crons) ? array_keys($this->_crons) : array()); |
|
| 121 | 121 | $unix_time_next_cron = $cron_times[0]; |
| 122 | - $time_next_cron = date( 'Y-m-d H:i:s', $unix_time_next_cron ); |
|
| 122 | + $time_next_cron = date('Y-m-d H:i:s', $unix_time_next_cron); |
|
| 123 | 123 | |
| 124 | - $human_time_next_cron = human_time_diff( $unix_time_next_cron ); |
|
| 124 | + $human_time_next_cron = human_time_diff($unix_time_next_cron); |
|
| 125 | 125 | |
| 126 | 126 | // Add a class if past current time and doing cron is not running. |
| 127 | - $times_class = ( time() > $unix_time_next_cron && 'No' === $this->_doing_cron ) ? ' past' : ''; |
|
| 127 | + $times_class = (time() > $unix_time_next_cron && 'No' === $this->_doing_cron) ? ' past' : ''; |
|
| 128 | 128 | |
| 129 | 129 | echo ' |
| 130 | 130 | <div class="debug-bar-cron"> |
| 131 | - <h2><span>', __( 'Total Events', 'zt-debug-bar-cron' ), ':</span>', (int) $this->_total_crons, '</h2> |
|
| 132 | - <h2><span>', __( 'Doing Cron', 'zt-debug-bar-cron' ), ':</span>', $this->_doing_cron, '</h2> |
|
| 133 | - <h2 class="times', esc_attr( $times_class ), '"><span>', __( 'Next Event', 'zt-debug-bar-cron' ), ':</span> |
|
| 131 | + <h2><span>', __('Total Events', 'zt-debug-bar-cron'), ':</span>', (int) $this->_total_crons, '</h2> |
|
| 132 | + <h2><span>', __('Doing Cron', 'zt-debug-bar-cron'), ':</span>', $this->_doing_cron, '</h2> |
|
| 133 | + <h2 class="times', esc_attr($times_class), '"><span>', __('Next Event', 'zt-debug-bar-cron'), ':</span> |
|
| 134 | 134 | ', $time_next_cron, '<br /> |
| 135 | 135 | ', $unix_time_next_cron, '<br /> |
| 136 | - ', $this->display_past_time( $human_time_next_cron, $unix_time_next_cron ), ' |
|
| 136 | + ', $this->display_past_time($human_time_next_cron, $unix_time_next_cron), ' |
|
| 137 | 137 | </h2> |
| 138 | - <h2><span>', __( 'Current Time', 'zt-debug-bar-cron' ), ':</span>', date( 'H:i:s' ), '</h2> |
|
| 138 | + <h2><span>', __('Current Time', 'zt-debug-bar-cron'), ':</span>', date('H:i:s'), '</h2> |
|
| 139 | 139 | |
| 140 | 140 | <div class="clear"></div> |
| 141 | 141 | |
| 142 | - <h3>', __( 'Custom Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
| 142 | + <h3>', __('Custom Events', 'zt-debug-bar-cron'), '</h3>'; |
|
| 143 | 143 | |
| 144 | - if ( ! is_null( $this->_user_crons ) ) { |
|
| 145 | - $this->display_events( $this->_user_crons ); |
|
| 144 | + if ( ! is_null($this->_user_crons)) { |
|
| 145 | + $this->display_events($this->_user_crons); |
|
| 146 | 146 | } else { |
| 147 | 147 | echo ' |
| 148 | - <p>', __( 'No Custom Events scheduled.', 'zt-debug-bar-cron' ), '</p>'; |
|
| 148 | + <p>', __('No Custom Events scheduled.', 'zt-debug-bar-cron'), '</p>'; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | echo ' |
| 152 | - <h3>', __( 'Schedules', 'zt-debug-bar-cron' ), '</h3>'; |
|
| 152 | + <h3>', __('Schedules', 'zt-debug-bar-cron'), '</h3>'; |
|
| 153 | 153 | |
| 154 | 154 | $this->display_schedules(); |
| 155 | 155 | |
| 156 | 156 | echo ' |
| 157 | - <h3>', __( 'Core Events', 'zt-debug-bar-cron' ), '</h3>'; |
|
| 157 | + <h3>', __('Core Events', 'zt-debug-bar-cron'), '</h3>'; |
|
| 158 | 158 | |
| 159 | - if ( ! is_null( $this->_core_crons ) ) { |
|
| 160 | - $this->display_events( $this->_core_crons ); |
|
| 159 | + if ( ! is_null($this->_core_crons)) { |
|
| 160 | + $this->display_events($this->_core_crons); |
|
| 161 | 161 | } else { |
| 162 | 162 | echo ' |
| 163 | - <p>', __( 'No Core Events scheduled.', 'zt-debug-bar-cron' ), '</p>'; |
|
| 163 | + <p>', __('No Core Events scheduled.', 'zt-debug-bar-cron'), '</p>'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | echo ' |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | * @return array Array of crons. |
| 178 | 178 | */ |
| 179 | 179 | private function get_crons() { |
| 180 | - if ( ! is_null( $this->_crons ) ) { |
|
| 180 | + if ( ! is_null($this->_crons)) { |
|
| 181 | 181 | return $this->_crons; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ( ! $crons = _get_cron_array() ) { |
|
| 184 | + if ( ! $crons = _get_cron_array()) { |
|
| 185 | 185 | return $this->_crons; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,28 +191,28 @@ discard block |
||
| 191 | 191 | // @internal To find all, search WP trunk for `wp_schedule_(single_)?event`. |
| 192 | 192 | $core_cron_hooks = array( |
| 193 | 193 | 'do_pings', |
| 194 | - 'importer_scheduled_cleanup', // WP 3.1+. |
|
| 194 | + 'importer_scheduled_cleanup', // WP 3.1+. |
|
| 195 | 195 | 'publish_future_post', |
| 196 | - 'update_network_counts', // WP 3.1+. |
|
| 197 | - 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
| 198 | - 'wp_maybe_auto_update', // WP 3.7+. |
|
| 196 | + 'update_network_counts', // WP 3.1+. |
|
| 197 | + 'upgrader_scheduled_cleanup', // WP 3.3+. |
|
| 198 | + 'wp_maybe_auto_update', // WP 3.7+. |
|
| 199 | 199 | 'wp_scheduled_auto_draft_delete', // WP 3.4+. |
| 200 | - 'wp_scheduled_delete', // WP 2.9+. |
|
| 201 | - 'wp_split_shared_term_batch', // WP 4.3+. |
|
| 200 | + 'wp_scheduled_delete', // WP 2.9+. |
|
| 201 | + 'wp_split_shared_term_batch', // WP 4.3+. |
|
| 202 | 202 | 'wp_update_plugins', |
| 203 | 203 | 'wp_update_themes', |
| 204 | 204 | 'wp_version_check', |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | 207 | // Sort and count crons. |
| 208 | - foreach ( $this->_crons as $time => $time_cron_array ) { |
|
| 209 | - foreach ( $time_cron_array as $hook => $data ) { |
|
| 208 | + foreach ($this->_crons as $time => $time_cron_array) { |
|
| 209 | + foreach ($time_cron_array as $hook => $data) { |
|
| 210 | 210 | $this->_total_crons++; |
| 211 | 211 | |
| 212 | - if ( in_array( $hook, $core_cron_hooks, true ) ) { |
|
| 213 | - $this->_core_crons[ $time ][ $hook ] = $data; |
|
| 212 | + if (in_array($hook, $core_cron_hooks, true)) { |
|
| 213 | + $this->_core_crons[$time][$hook] = $data; |
|
| 214 | 214 | } else { |
| 215 | - $this->_user_crons[ $time ][ $hook ] = $data; |
|
| 215 | + $this->_user_crons[$time][$hook] = $data; |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -228,73 +228,73 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @return void|string Void on failure; table display of events on success. |
| 230 | 230 | */ |
| 231 | - private function display_events( $events ) { |
|
| 232 | - if ( is_null( $events ) || empty( $events ) ) { |
|
| 231 | + private function display_events($events) { |
|
| 232 | + if (is_null($events) || empty($events)) { |
|
| 233 | 233 | return; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | echo ' |
| 237 | 237 | <table class="zt-debug-bar-cron-event-table" cellspacing="0"> |
| 238 | 238 | <thead><tr> |
| 239 | - <th class="col1">', __( 'Next Execution', 'zt-debug-bar-cron' ), '</th> |
|
| 240 | - <th class="col2">', __( 'Hook', 'zt-debug-bar-cron' ), '</th> |
|
| 241 | - <th class="col3">', __( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
| 242 | - <th class="col4">', __( 'Interval Value', 'zt-debug-bar-cron' ), '</th> |
|
| 243 | - <th class="col5">', __( 'Args', 'zt-debug-bar-cron' ), '</th> |
|
| 239 | + <th class="col1">', __('Next Execution', 'zt-debug-bar-cron'), '</th> |
|
| 240 | + <th class="col2">', __('Hook', 'zt-debug-bar-cron'), '</th> |
|
| 241 | + <th class="col3">', __('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
| 242 | + <th class="col4">', __('Interval Value', 'zt-debug-bar-cron'), '</th> |
|
| 243 | + <th class="col5">', __('Args', 'zt-debug-bar-cron'), '</th> |
|
| 244 | 244 | </tr></thead> |
| 245 | 245 | <tbody>'; |
| 246 | 246 | |
| 247 | - foreach ( $events as $time => $time_cron_array ) { |
|
| 248 | - foreach ( $time_cron_array as $hook => $data ) { |
|
| 247 | + foreach ($events as $time => $time_cron_array) { |
|
| 248 | + foreach ($time_cron_array as $hook => $data) { |
|
| 249 | 249 | // Add a class if past current time. |
| 250 | - $times_class = ( time() > $time && 'No' === $this->_doing_cron ) ? ' class="past"' : ''; |
|
| 250 | + $times_class = (time() > $time && 'No' === $this->_doing_cron) ? ' class="past"' : ''; |
|
| 251 | 251 | |
| 252 | 252 | echo ' |
| 253 | 253 | <tr> |
| 254 | 254 | <td', $times_class, '> |
| 255 | - ', date( 'Y-m-d H:i:s', $time ), '<br /> |
|
| 255 | + ', date('Y-m-d H:i:s', $time), '<br /> |
|
| 256 | 256 | ', $time, '<br /> |
| 257 | - ', $this->display_past_time( human_time_diff( $time ), $time ), ' |
|
| 257 | + ', $this->display_past_time(human_time_diff($time), $time), ' |
|
| 258 | 258 | </td> |
| 259 | - <td>', wp_strip_all_tags( $hook ), '</td>'; |
|
| 259 | + <td>', wp_strip_all_tags($hook), '</td>'; |
|
| 260 | 260 | |
| 261 | - foreach ( $data as $hash => $info ) { |
|
| 261 | + foreach ($data as $hash => $info) { |
|
| 262 | 262 | // Report the schedule. |
| 263 | 263 | echo ' |
| 264 | 264 | <td>'; |
| 265 | - if ( $info['schedule'] ) { |
|
| 266 | - echo wp_strip_all_tags( $info['schedule'] ); |
|
| 265 | + if ($info['schedule']) { |
|
| 266 | + echo wp_strip_all_tags($info['schedule']); |
|
| 267 | 267 | } else { |
| 268 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
| 268 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
| 269 | 269 | } |
| 270 | 270 | echo '</td>'; |
| 271 | 271 | |
| 272 | 272 | // Report the interval. |
| 273 | 273 | echo ' |
| 274 | 274 | <td>'; |
| 275 | - if ( isset( $info['interval'] ) ) { |
|
| 275 | + if (isset($info['interval'])) { |
|
| 276 | 276 | /* TRANSLATORS: %s is number of seconds. */ |
| 277 | - printf( esc_html__( '%ss', 'zt-debug-bar-cron' ) . '<br />', wp_strip_all_tags( $info['interval'] ) ); |
|
| 277 | + printf(esc_html__('%ss', 'zt-debug-bar-cron').'<br />', wp_strip_all_tags($info['interval'])); |
|
| 278 | 278 | /* TRANSLATORS: %s is number of minutes. */ |
| 279 | - printf( esc_html__( '%sm', 'zt-debug-bar-cron' ) . '<br />', ( wp_strip_all_tags( $info['interval'] ) / 60 ) ); |
|
| 279 | + printf(esc_html__('%sm', 'zt-debug-bar-cron').'<br />', (wp_strip_all_tags($info['interval']) / 60)); |
|
| 280 | 280 | /* TRANSLATORS: %s is number of hours. */ |
| 281 | - printf( esc_html__( '%sh', 'zt-debug-bar-cron' ), ( wp_strip_all_tags( $info['interval'] ) / ( 60 * 60 ) ) ); |
|
| 281 | + printf(esc_html__('%sh', 'zt-debug-bar-cron'), (wp_strip_all_tags($info['interval']) / (60 * 60))); |
|
| 282 | 282 | } else { |
| 283 | - echo esc_html__( 'Single Event', 'zt-debug-bar-cron' ); |
|
| 283 | + echo esc_html__('Single Event', 'zt-debug-bar-cron'); |
|
| 284 | 284 | } |
| 285 | 285 | echo '</td>'; |
| 286 | 286 | |
| 287 | 287 | // Report the args. |
| 288 | 288 | echo ' |
| 289 | 289 | <td>'; |
| 290 | - if ( is_array( $info['args'] ) && ! empty( $info['args'] ) ) { |
|
| 291 | - foreach ( $info['args'] as $key => $value ) { |
|
| 292 | - $this->display_cron_arguments( $key, $value ); |
|
| 290 | + if (is_array($info['args']) && ! empty($info['args'])) { |
|
| 291 | + foreach ($info['args'] as $key => $value) { |
|
| 292 | + $this->display_cron_arguments($key, $value); |
|
| 293 | 293 | } |
| 294 | - } else if ( is_string( $info['args'] ) && '' !== $info['args'] ) { |
|
| 295 | - echo esc_html( $info['args'] ); |
|
| 294 | + } else if (is_string($info['args']) && '' !== $info['args']) { |
|
| 295 | + echo esc_html($info['args']); |
|
| 296 | 296 | } else { |
| 297 | - echo esc_html__( 'No Args', 'zt-debug-bar-cron' ); |
|
| 297 | + echo esc_html__('No Args', 'zt-debug-bar-cron'); |
|
| 298 | 298 | } |
| 299 | 299 | echo '</td>'; |
| 300 | 300 | } |
@@ -319,19 +319,19 @@ discard block |
||
| 319 | 319 | * |
| 320 | 320 | * @return void |
| 321 | 321 | */ |
| 322 | - function display_cron_arguments( $key, $value, $depth = 0 ) { |
|
| 323 | - if ( is_string( $value ) || is_int( $value ) ) { |
|
| 324 | - echo str_repeat( ' ', ( $depth * 2 ) ) . wp_strip_all_tags( $key ) . ' => ' . esc_html( $value ) . '<br />'; |
|
| 325 | - } else if ( is_array( $value ) ) { |
|
| 326 | - if ( count( $value ) > 0 ) { |
|
| 327 | - echo str_repeat( ' ', ( $depth * 2 ) ) . wp_strip_all_tags( $key ) . ' => array(<br />'; |
|
| 322 | + function display_cron_arguments($key, $value, $depth = 0) { |
|
| 323 | + if (is_string($value) || is_int($value)) { |
|
| 324 | + echo str_repeat(' ', ($depth * 2)).wp_strip_all_tags($key).' => '.esc_html($value).'<br />'; |
|
| 325 | + } else if (is_array($value)) { |
|
| 326 | + if (count($value) > 0) { |
|
| 327 | + echo str_repeat(' ', ($depth * 2)).wp_strip_all_tags($key).' => array(<br />'; |
|
| 328 | 328 | $depth++; |
| 329 | - foreach ( $value as $k => $v ) { |
|
| 330 | - $this->display_cron_arguments( $k, $v, $depth ); |
|
| 329 | + foreach ($value as $k => $v) { |
|
| 330 | + $this->display_cron_arguments($k, $v, $depth); |
|
| 331 | 331 | } |
| 332 | - echo str_repeat( ' ', ( ( $depth - 1 ) * 2 ) ) . ')'; |
|
| 332 | + echo str_repeat(' ', (($depth - 1) * 2)).')'; |
|
| 333 | 333 | } else { |
| 334 | - echo esc_html( 'Empty Array', 'zt-debug-bar-cron' ); |
|
| 334 | + echo esc_html('Empty Array', 'zt-debug-bar-cron'); |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -346,22 +346,22 @@ discard block |
||
| 346 | 346 | echo ' |
| 347 | 347 | <table class="zt-debug-bar-cron-event-table" cellspacing="0"> |
| 348 | 348 | <thead><tr> |
| 349 | - <th class="col1">', __( 'Interval Hook', 'zt-debug-bar-cron' ), '</th> |
|
| 350 | - <th class="col2">', __( 'Interval (S)', 'zt-debug-bar-cron' ), '</th> |
|
| 351 | - <th class="col3">', __( 'Interval (M)', 'zt-debug-bar-cron' ), '</th> |
|
| 352 | - <th class="col4">', __( 'Interval (H)', 'zt-debug-bar-cron' ), '</th> |
|
| 353 | - <th class="col5">', __( 'Display Name', 'zt-debug-bar-cron' ), '</th> |
|
| 349 | + <th class="col1">', __('Interval Hook', 'zt-debug-bar-cron'), '</th> |
|
| 350 | + <th class="col2">', __('Interval (S)', 'zt-debug-bar-cron'), '</th> |
|
| 351 | + <th class="col3">', __('Interval (M)', 'zt-debug-bar-cron'), '</th> |
|
| 352 | + <th class="col4">', __('Interval (H)', 'zt-debug-bar-cron'), '</th> |
|
| 353 | + <th class="col5">', __('Display Name', 'zt-debug-bar-cron'), '</th> |
|
| 354 | 354 | </tr></thead> |
| 355 | 355 | <tbody>'; |
| 356 | 356 | |
| 357 | - foreach ( wp_get_schedules() as $interval_hook => $data ) { |
|
| 357 | + foreach (wp_get_schedules() as $interval_hook => $data) { |
|
| 358 | 358 | echo ' |
| 359 | 359 | <tr> |
| 360 | - <td>', esc_html( $interval_hook ), '</td> |
|
| 361 | - <td>', wp_strip_all_tags( $data['interval'] ), '</td> |
|
| 362 | - <td>', ( wp_strip_all_tags( $data['interval'] ) / 60 ), '</td> |
|
| 363 | - <td>', ( wp_strip_all_tags( $data['interval'] ) / ( 60 * 60 ) ), '</td> |
|
| 364 | - <td>', esc_html( $data['display'] ) . '</td> |
|
| 360 | + <td>', esc_html($interval_hook), '</td> |
|
| 361 | + <td>', wp_strip_all_tags($data['interval']), '</td> |
|
| 362 | + <td>', (wp_strip_all_tags($data['interval']) / 60), '</td> |
|
| 363 | + <td>', (wp_strip_all_tags($data['interval']) / (60 * 60)), '</td> |
|
| 364 | + <td>', esc_html($data['display']).'</td> |
|
| 365 | 365 | </tr>'; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -379,10 +379,10 @@ discard block |
||
| 379 | 379 | * |
| 380 | 380 | * @return string |
| 381 | 381 | */ |
| 382 | - private function display_past_time( $human_time, $time ) { |
|
| 383 | - if ( time() > $time ) { |
|
| 382 | + private function display_past_time($human_time, $time) { |
|
| 383 | + if (time() > $time) { |
|
| 384 | 384 | /* TRANSLATORS: %s is a human readable time difference. */ |
| 385 | - return sprintf( esc_html__( '%s ago', 'zt-debug-bar-cron' ), $human_time ); |
|
| 385 | + return sprintf(esc_html__('%s ago', 'zt-debug-bar-cron'), $human_time); |
|
| 386 | 386 | } else { |
| 387 | 387 | return $human_time; |
| 388 | 388 | } |
@@ -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 | } |