WP Crontrol - Version 1.2.1

Version Description

  • Correctly display the local time when listing cron entries

=

Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 WP Crontrol
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2 to 1.2.1

Files changed (3) hide show
  1. class-wp-cli.php +7 -7
  2. readme.txt +10 -5
  3. wp-crontrol.php +47 -51
class-wp-cli.php CHANGED
@@ -33,7 +33,7 @@ class Crontrol_Command extends WP_CLI_Command {
33
  die();
34
  }
35
 
36
- $events = array_map( array( $this, '_map_event' ), $events );
37
 
38
  $fields = array(
39
  'hook',
@@ -56,7 +56,7 @@ class Crontrol_Command extends WP_CLI_Command {
56
 
57
  $schedules = $this->crontrol->get_schedules();
58
 
59
- $schedules = array_map( array( $this, '_map_schedule' ), $schedules );
60
 
61
  $fields = array(
62
  'display',
@@ -79,17 +79,17 @@ class Crontrol_Command extends WP_CLI_Command {
79
  if ( is_wp_error( $status ) )
80
  WP_CLI::error( $status );
81
  else
82
- WP_CLI::success( __( 'WP-Cron working as expected.', 'control' ) );
83
 
84
  }
85
 
86
- protected function _map_event( $event ) {
87
- $event->next_run = strftime("%Y/%m/%d %H:%M:%S", $event->time) . " (".$this->crontrol->time_since(time(), $event->time).")";
88
- $event->recurrence = ($event->schedule ? $event->interval.' ('.$this->crontrol->interval($event->interval).')' : __('Non-repeating', 'crontrol'));
89
  return $event;
90
  }
91
 
92
- protected function _map_schedule( $schedule ) {
93
  return (object) $schedule;
94
  }
95
 
33
  die();
34
  }
35
 
36
+ $events = array_map( 'self::_map_event', $events );
37
 
38
  $fields = array(
39
  'hook',
56
 
57
  $schedules = $this->crontrol->get_schedules();
58
 
59
+ $schedules = array_map( 'self::_map_schedule', $schedules );
60
 
61
  $fields = array(
62
  'display',
79
  if ( is_wp_error( $status ) )
80
  WP_CLI::error( $status );
81
  else
82
+ WP_CLI::success( __( 'WP-Cron is working as expected.', 'crontrol' ) );
83
 
84
  }
85
 
86
+ protected static function _map_event( $event ) {
87
+ $event->next_run = get_date_from_gmt(date('Y-m-d H:i:s',$event->time),$time_format) . " (".$this->crontrol->time_since(time(), $event->time).")";
88
+ $event->recurrence = ($event->schedule ? $this->crontrol->interval($event->interval) : __('Non-repeating', 'crontrol'));
89
  return $event;
90
  }
91
 
92
+ protected static function _map_schedule( $schedule ) {
93
  return (object) $schedule;
94
  }
95
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: scompt, johnbillion
3
  Tags: admin, cron, plugin, control, wp-cron, crontrol, wp-cli
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
- Stable tag: 1.2
7
 
8
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
9
 
@@ -34,8 +34,8 @@ Alternatively, see the guide to [Manually Installing Plugins](http://codex.wordp
34
 
35
  = Usage =
36
 
37
- 1. Go to the Settings -> Crontrol menu to add some new cron schedules.
38
- 2. Go to the Tools -> Crontrol menu to see what cron entries are scheduled and to add some new ones.
39
 
40
  == Frequently Asked Questions ==
41
 
@@ -86,11 +86,16 @@ Note that wp-cli support was only recently added. This will be improved over tim
86
 
87
  == Upgrade Notice ==
88
 
89
- = 1.2 =
90
- * Added support for [wp-cli](http://wp-cli.org/)
91
 
92
  == Changelog ==
93
 
 
 
 
 
 
94
  = 1.2 =
95
  * Added support for [wp-cli](http://wp-cli.org/)
96
  * Removed some PHP4 code that's no longer relevant
3
  Tags: admin, cron, plugin, control, wp-cron, crontrol, wp-cli
4
  Requires at least: 3.0
5
  Tested up to: 3.6
6
+ Stable tag: 1.2.1
7
 
8
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
9
 
34
 
35
  = Usage =
36
 
37
+ 1. Go to the Tools -> Crontrol menu to see what cron entries are scheduled and to add some new ones.
38
+ 2. Go to the Settings -> Cron Schedules menu to add new cron schedules.
39
 
40
  == Frequently Asked Questions ==
41
 
86
 
87
  == Upgrade Notice ==
88
 
89
+ = 1.2.1 =
90
+ * Correctly display the local time when listing cron entries
91
 
92
  == Changelog ==
93
 
94
+ = 1.2.1 =
95
+ * Correctly display the local time when listing cron entries
96
+ * Remove a PHP notice
97
+ * Pass the WP-Cron spawn check through the same filter as the actual spawner.
98
+
99
  = 1.2 =
100
  * Added support for [wp-cli](http://wp-cli.org/)
101
  * Removed some PHP4 code that's no longer relevant
wp-crontrol.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://wordpress.org/plugins/wp-crontrol/
5
  * Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
6
  * Author: <a href="http://www.scompt.com/">Edward Dale</a> & <a href="http://lud.icro.us/">John Blackbourn</a>
7
- * Version: 1.2
8
  * Text Domain: crontrol
9
  * Domain Path: /gettext/
10
  */
@@ -31,7 +31,7 @@
31
  *
32
  * @package WP Crontrol
33
  * @author Edward Dale <scompt@scompt.com> & John Blackbourn <john@johnblackbourn.com>
34
- * @copyright Copyright 2012 Edward Dale & John Blackbourn
35
  * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
36
  * @link http://wordpress.org/plugins/wp-crontrol/
37
  * @since 0.2
@@ -40,27 +40,22 @@
40
  defined( 'ABSPATH' ) or die();
41
 
42
  class Crontrol {
43
- var $json;
44
 
45
  /**
46
  * Hook onto all of the actions and filters needed by the plugin.
47
  */
48
  protected function __construct() {
49
- define( 'CRONTROL_CRON_JOB', 'crontrol_cron_job');
50
- $this->json = new Crontrol_JSON();
51
- if( function_exists('add_action') ) {
52
- add_action('init', array(&$this, 'action_init'));
53
- add_action('init', array(&$this, 'action_handle_posts'));
54
- add_action('admin_menu', array(&$this, 'action_admin_menu'));
55
-
56
- // Make sure the activation works from subdirectories as well as
57
- // directly in the plugin directory.
58
- $activate_action = str_replace(ABSPATH.PLUGINDIR.'/', 'activate_', __FILE__);
59
- add_action($activate_action, array(&$this, 'action_activate'));
60
-
61
- add_filter('cron_schedules', array(&$this, 'filter_cron_schedules'));
62
- add_action(CRONTROL_CRON_JOB, array(&$this, 'action_php_cron_entry'));
63
- }
64
  }
65
 
66
  /**
@@ -85,7 +80,7 @@ class Crontrol {
85
  if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
86
  check_admin_referer("new-cron");
87
  extract($_POST, EXTR_PREFIX_ALL, 'in');
88
- $in_args = $this->json->decode(stripslashes($in_args));
89
  $this->add_cron($in_next_run, $in_schedule, $in_hookname, $in_args);
90
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name={$in_hookname}");
91
 
@@ -94,8 +89,7 @@ class Crontrol {
94
  check_admin_referer("new-cron");
95
  extract($_POST, EXTR_PREFIX_ALL, 'in');
96
  $args = array('code'=>stripslashes($in_hookcode));
97
- $hookname = CRONTROL_CRON_JOB;
98
- $this->add_cron($in_next_run, $in_schedule, $hookname, $args);
99
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name={$in_hookname}");
100
 
101
  } else if( isset($_POST['edit_cron']) ) {
@@ -103,7 +97,7 @@ class Crontrol {
103
 
104
  extract($_POST, EXTR_PREFIX_ALL, 'in');
105
  check_admin_referer("edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}");
106
- $in_args = $this->json->decode(stripslashes($in_args));
107
  $i=$this->delete_cron($in_original_hookname, $in_original_sig, $in_original_next_run);
108
  $i=$this->add_cron($in_next_run, $in_schedule, $in_hookname, $in_args);
109
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name={$in_hookname}");
@@ -114,10 +108,9 @@ class Crontrol {
114
  extract($_POST, EXTR_PREFIX_ALL, 'in');
115
  check_admin_referer("edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}");
116
  $args['code'] = stripslashes($in_hookcode);
117
- $hookname = CRONTROL_CRON_JOB;
118
  $args = array('code'=>stripslashes($in_hookcode));
119
  $i=$this->delete_cron($in_original_hookname, $in_original_sig, $in_original_next_run);
120
- $i=$this->add_cron($in_next_run, $in_schedule, $hookname, $args);
121
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name={$in_hookname}");
122
 
123
  } else if( isset($_POST['new_schedule']) ) {
@@ -277,7 +270,7 @@ class Crontrol {
277
  * Run using the 'admin_menu' action.
278
  */
279
  function action_admin_menu() {
280
- $page = add_options_page('Crontrol', 'Crontrol', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') );
281
  $page = add_management_page('Crontrol', "Crontrol", 'manage_options', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') );
282
  }
283
 
@@ -421,14 +414,21 @@ class Crontrol {
421
  return true;
422
 
423
  $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
424
- $cron_url = site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron );
425
 
426
- $result = wp_remote_post( $cron_url, array(
427
- 'timeout' => 3,
428
- 'blocking' => true,
429
- 'sslverify' => apply_filters( 'https_local_ssl_verify', true )
 
 
 
 
430
  ) );
431
 
 
 
 
 
432
  if ( is_wp_error( $result ) ) {
433
  return $result;
434
  } else {
@@ -475,7 +475,7 @@ class Crontrol {
475
  $other_fields .= '<input name="original_hookname" type="hidden" value="'. $existing['hookname'] .'" />';
476
  $other_fields .= '<input name="original_sig" type="hidden" value="'. $existing['sig'] .'" />';
477
  $other_fields .= '<input name="original_next_run" type="hidden" value="'. $existing['next_run'] .'" />';
478
- $existing['args'] = $is_php ? htmlentities($existing['args']['code']) : htmlentities($this->json->encode($existing['args']));
479
  $existing['next_run'] = strftime("%D %T", $existing['next_run']);
480
  $action = $is_php ? 'edit_php_cron' : 'edit_cron';
481
  $button = $is_php ? __('Modify PHP Cron Entry', 'crontrol') : __('Modify Cron Entry', 'crontrol');
@@ -497,21 +497,21 @@ class Crontrol {
497
  <?php if( $is_php ): ?>
498
  <tr>
499
  <th width="33%" valign="top" scope="row"><label for="hookcode"><?php _e('Hook code', 'crontrol'); ?>:</label></th>
500
- <td width="67%"><textarea style="width:95%" name="hookcode"><?php echo $existing['args'] ?></textarea></td>
501
  </tr>
502
  <?php else: ?>
503
  <tr>
504
  <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
505
- <td width="67%"><input type="text" size="40" id="hookname" name="hookname" value="<?php echo $existing['hookname'] ?>"/></td>
506
  </tr>
507
  <tr>
508
  <th width="33%" valign="top" scope="row"><label for="args"><?php _e('Arguments', 'crontrol'); ?>:</label><br /><span style="font-size:xx-small"><?php _e('e.g., [], [25], ["asdf"], or ["i","want",25,"cakes"]', 'crontrol') ?></span></th>
509
- <td width="67%"><input type="text" size="40" id="args" name="args" value="<?php echo $existing['args'] ?>"/></td>
510
  </tr>
511
  <?php endif; ?>
512
  <tr>
513
  <th width="33%" valign="top" scope="row"><label for="next_run"><?php _e('Next run', 'crontrol'); ?>:</label><br /><span style="font-size:xx-small"><?php _e('e.g., "now", "tomorrow", "+2 days", or "06/04/08 15:27:09"', 'crontrol') ?></th>
514
- <td width="67%"><input type="text" size="40" id="next_run" name="next_run" value="<?php echo $existing['next_run'] ?>"/></td>
515
  </tr><tr>
516
  <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
517
  <td>
@@ -548,7 +548,7 @@ class Crontrol {
548
  'sig' => $sig,
549
  'args' => $data['args'],
550
  'schedule' => $data['schedule'],
551
- 'interval' => $data['interval'],
552
  );
553
 
554
  }
@@ -577,6 +577,7 @@ class Crontrol {
577
  }
578
  $events = $this->get_cron_events();
579
  $doing_edit = (isset( $_GET['action']) && $_GET['action']=='edit-cron') ? $_GET['id'] : false ;
 
580
  $this->show_cron_status();
581
  ?>
582
  <div class="wrap">
@@ -614,10 +615,10 @@ class Crontrol {
614
  }
615
 
616
  echo "<tr id=\"cron-{$id}\" class=\"{$class}\">";
617
- echo "<td>".($event->hook==CRONTROL_CRON_JOB ? __('<i>PHP Cron</i>', 'crontrol') : $event->hook)."</td>";
618
- echo "<td>".($event->hook==CRONTROL_CRON_JOB ? __('<i>PHP Code</i>', 'crontrol') : $this->json->encode($event->args))."</td>";
619
- echo "<td>".strftime("%Y/%m/%d %H:%M:%S", $event->time)." (".$this->time_since(time(), $event->time).")</td>";
620
- echo "<td>".($event->schedule ? $event->interval.' ('.$this->interval($event->interval).')' : __('Non-repeating', 'crontrol'))."</td>";
621
  echo "<td><a class='view' href='tools.php?page=crontrol_admin_manage_page&amp;action=edit-cron&amp;id={$event->hook}&amp;sig={$event->sig}&amp;next_run={$event->time}#crontrol_form'>Edit</a></td>";
622
  echo "<td><a class='view' href='".wp_nonce_url("tools.php?page=crontrol_admin_manage_page&amp;action=run-cron&amp;id={$event->hook}&amp;sig={$event->sig}", "run-cron_{$event->hook}_{$event->sig}")."'>Run Now</a></td>";
623
  echo "<td><a class='delete' href='".wp_nonce_url("tools.php?page=crontrol_admin_manage_page&amp;action=delete-cron&amp;id={$event->hook}&amp;sig={$event->sig}&amp;next_run={$event->time}", "delete-cron_{$event->hook}_{$event->sig}_{$event->time}")."'>Delete</a></td>";
@@ -629,10 +630,14 @@ class Crontrol {
629
  ?>
630
  </tbody>
631
  </table>
 
 
 
 
632
  </div>
633
  <?php
634
  if( is_array( $doing_edit ) ) {
635
- $this->show_cron_form($doing_edit['hookname']==CRONTROL_CRON_JOB, $doing_edit);
636
  } else {
637
  $this->show_cron_form((isset($_GET['action']) and $_GET['action']=='new-php-cron'), false);
638
  }
@@ -704,7 +709,7 @@ class Crontrol {
704
  return $output;
705
  }
706
 
707
- public function init() {
708
 
709
  static $instance = null;
710
 
@@ -717,15 +722,6 @@ class Crontrol {
717
 
718
  }
719
 
720
- class Crontrol_JSON {
721
- function encode($in) {
722
- return json_encode($in);
723
- }
724
- function decode($in) {
725
- return json_decode($in, true);
726
- }
727
- }
728
-
729
  if ( defined( 'WP_CLI' ) and WP_CLI and is_readable( $wp_cli = dirname( __FILE__ ) . '/class-wp-cli.php' ) )
730
  include_once $wp_cli;
731
 
4
  * Plugin URI: http://wordpress.org/plugins/wp-crontrol/
5
  * Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
6
  * Author: <a href="http://www.scompt.com/">Edward Dale</a> & <a href="http://lud.icro.us/">John Blackbourn</a>
7
+ * Version: 1.2.1
8
  * Text Domain: crontrol
9
  * Domain Path: /gettext/
10
  */
31
  *
32
  * @package WP Crontrol
33
  * @author Edward Dale <scompt@scompt.com> & John Blackbourn <john@johnblackbourn.com>
34
+ * @copyright Copyright 2013 Edward Dale & John Blackbourn
35
  * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
36
  * @link http://wordpress.org/plugins/wp-crontrol/
37
  * @since 0.2
40
  defined( 'ABSPATH' ) or die();
41
 
42
  class Crontrol {
 
43
 
44
  /**
45
  * Hook onto all of the actions and filters needed by the plugin.
46
  */
47
  protected function __construct() {
48
+ add_action('init', array(&$this, 'action_init'));
49
+ add_action('init', array(&$this, 'action_handle_posts'));
50
+ add_action('admin_menu', array(&$this, 'action_admin_menu'));
51
+
52
+ // Make sure the activation works from subdirectories as well as
53
+ // directly in the plugin directory.
54
+ $activate_action = str_replace(ABSPATH.PLUGINDIR.'/', 'activate_', __FILE__);
55
+ add_action($activate_action, array(&$this, 'action_activate'));
56
+
57
+ add_filter('cron_schedules', array(&$this, 'filter_cron_schedules'));
58
+ add_action('crontrol_cron_job', array(&$this, 'action_php_cron_entry'));
 
 
 
 
59
  }
60
 
61
  /**
80
  if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
81
  check_admin_referer("new-cron");
82
  extract($_POST, EXTR_PREFIX_ALL, 'in');
83
+ $in_args = json_decode(stripslashes($in_args),true);
84
  $this->add_cron($in_next_run, $in_schedule, $in_hookname, $in_args);
85
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name={$in_hookname}");
86
 
89
  check_admin_referer("new-cron");
90
  extract($_POST, EXTR_PREFIX_ALL, 'in');
91
  $args = array('code'=>stripslashes($in_hookcode));
92
+ $this->add_cron($in_next_run, $in_schedule, 'crontrol_cron_job', $args);
 
93
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name={$in_hookname}");
94
 
95
  } else if( isset($_POST['edit_cron']) ) {
97
 
98
  extract($_POST, EXTR_PREFIX_ALL, 'in');
99
  check_admin_referer("edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}");
100
+ $in_args = json_decode(stripslashes($in_args),true);
101
  $i=$this->delete_cron($in_original_hookname, $in_original_sig, $in_original_next_run);
102
  $i=$this->add_cron($in_next_run, $in_schedule, $in_hookname, $in_args);
103
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name={$in_hookname}");
108
  extract($_POST, EXTR_PREFIX_ALL, 'in');
109
  check_admin_referer("edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}");
110
  $args['code'] = stripslashes($in_hookcode);
 
111
  $args = array('code'=>stripslashes($in_hookcode));
112
  $i=$this->delete_cron($in_original_hookname, $in_original_sig, $in_original_next_run);
113
+ $i=$this->add_cron($in_next_run, $in_schedule, 'crontrol_cron_job', $args);
114
  wp_redirect("tools.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name={$in_hookname}");
115
 
116
  } else if( isset($_POST['new_schedule']) ) {
270
  * Run using the 'admin_menu' action.
271
  */
272
  function action_admin_menu() {
273
+ $page = add_options_page('Cron Schedules', 'Cron Schedules', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') );
274
  $page = add_management_page('Crontrol', "Crontrol", 'manage_options', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') );
275
  }
276
 
414
  return true;
415
 
416
  $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
 
417
 
418
+ $cron_request = apply_filters( 'cron_request', array(
419
+ 'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
420
+ 'key' => $doing_wp_cron,
421
+ 'args' => array(
422
+ 'timeout' => 3,
423
+ 'blocking' => true,
424
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', true )
425
+ )
426
  ) );
427
 
428
+ $cron_request['args']['blocking'] = true;
429
+
430
+ $result = wp_remote_post( $cron_request['url'], $cron_request['args'] );
431
+
432
  if ( is_wp_error( $result ) ) {
433
  return $result;
434
  } else {
475
  $other_fields .= '<input name="original_hookname" type="hidden" value="'. $existing['hookname'] .'" />';
476
  $other_fields .= '<input name="original_sig" type="hidden" value="'. $existing['sig'] .'" />';
477
  $other_fields .= '<input name="original_next_run" type="hidden" value="'. $existing['next_run'] .'" />';
478
+ $existing['args'] = $is_php ? $existing['args']['code'] : json_encode($existing['args']);
479
  $existing['next_run'] = strftime("%D %T", $existing['next_run']);
480
  $action = $is_php ? 'edit_php_cron' : 'edit_cron';
481
  $button = $is_php ? __('Modify PHP Cron Entry', 'crontrol') : __('Modify Cron Entry', 'crontrol');
497
  <?php if( $is_php ): ?>
498
  <tr>
499
  <th width="33%" valign="top" scope="row"><label for="hookcode"><?php _e('Hook code', 'crontrol'); ?>:</label></th>
500
+ <td width="67%"><textarea style="width:95%" name="hookcode"><?php echo esc_textarea( $existing['args'] ); ?></textarea></td>
501
  </tr>
502
  <?php else: ?>
503
  <tr>
504
  <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
505
+ <td width="67%"><input type="text" size="40" id="hookname" name="hookname" value="<?php echo esc_attr( $existing['hookname'] ); ?>"/></td>
506
  </tr>
507
  <tr>
508
  <th width="33%" valign="top" scope="row"><label for="args"><?php _e('Arguments', 'crontrol'); ?>:</label><br /><span style="font-size:xx-small"><?php _e('e.g., [], [25], ["asdf"], or ["i","want",25,"cakes"]', 'crontrol') ?></span></th>
509
+ <td width="67%"><input type="text" size="40" id="args" name="args" value="<?php echo esc_textarea( $existing['args'] ); ?>"/></td>
510
  </tr>
511
  <?php endif; ?>
512
  <tr>
513
  <th width="33%" valign="top" scope="row"><label for="next_run"><?php _e('Next run', 'crontrol'); ?>:</label><br /><span style="font-size:xx-small"><?php _e('e.g., "now", "tomorrow", "+2 days", or "06/04/08 15:27:09"', 'crontrol') ?></th>
514
+ <td width="67%"><input type="text" size="40" id="next_run" name="next_run" value="<?php echo esc_attr( $existing['next_run'] ); ?>"/></td>
515
  </tr><tr>
516
  <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
517
  <td>
548
  'sig' => $sig,
549
  'args' => $data['args'],
550
  'schedule' => $data['schedule'],
551
+ 'interval' => isset( $data['interval'] ) ? $data['interval'] : null,
552
  );
553
 
554
  }
577
  }
578
  $events = $this->get_cron_events();
579
  $doing_edit = (isset( $_GET['action']) && $_GET['action']=='edit-cron') ? $_GET['id'] : false ;
580
+ $time_format = 'Y/m/d H:i:s';
581
  $this->show_cron_status();
582
  ?>
583
  <div class="wrap">
615
  }
616
 
617
  echo "<tr id=\"cron-{$id}\" class=\"{$class}\">";
618
+ echo "<td>".($event->hook=='crontrol_cron_job' ? __('<i>PHP Cron</i>', 'crontrol') : $event->hook)."</td>";
619
+ echo "<td>".($event->hook=='crontrol_cron_job' ? __('<i>PHP Code</i>', 'crontrol') : json_encode($event->args))."</td>";
620
+ echo "<td>".get_date_from_gmt(date('Y-m-d H:i:s',$event->time),$time_format)." (".$this->time_since(time(), $event->time).")</td>";
621
+ echo "<td>".($event->schedule ? $this->interval($event->interval) : __('Non-repeating', 'crontrol'))."</td>";
622
  echo "<td><a class='view' href='tools.php?page=crontrol_admin_manage_page&amp;action=edit-cron&amp;id={$event->hook}&amp;sig={$event->sig}&amp;next_run={$event->time}#crontrol_form'>Edit</a></td>";
623
  echo "<td><a class='view' href='".wp_nonce_url("tools.php?page=crontrol_admin_manage_page&amp;action=run-cron&amp;id={$event->hook}&amp;sig={$event->sig}", "run-cron_{$event->hook}_{$event->sig}")."'>Run Now</a></td>";
624
  echo "<td><a class='delete' href='".wp_nonce_url("tools.php?page=crontrol_admin_manage_page&amp;action=delete-cron&amp;id={$event->hook}&amp;sig={$event->sig}&amp;next_run={$event->time}", "delete-cron_{$event->hook}_{$event->sig}_{$event->time}")."'>Delete</a></td>";
630
  ?>
631
  </tbody>
632
  </table>
633
+
634
+ <p class="description"><?php printf(__('UTC time is <code>%s</code>', 'crontrol'), date_i18n($time_format, false, true)); ?></p>
635
+ <p class="description"><?php printf(__('Local time is <code>%s</code>', 'crontrol'), date_i18n($time_format)); ?></p>
636
+
637
  </div>
638
  <?php
639
  if( is_array( $doing_edit ) ) {
640
+ $this->show_cron_form($doing_edit['hookname']=='crontrol_cron_job', $doing_edit);
641
  } else {
642
  $this->show_cron_form((isset($_GET['action']) and $_GET['action']=='new-php-cron'), false);
643
  }
709
  return $output;
710
  }
711
 
712
+ public static function init() {
713
 
714
  static $instance = null;
715
 
722
 
723
  }
724
 
 
 
 
 
 
 
 
 
 
725
  if ( defined( 'WP_CLI' ) and WP_CLI and is_readable( $wp_cli = dirname( __FILE__ ) . '/class-wp-cli.php' ) )
726
  include_once $wp_cli;
727