WP Crontrol - Version 1.8.5

Version Description

Download this release

Release Info

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

Code changes from version 1.8.4 to 1.8.5

Files changed (2) hide show
  1. readme.md +12 -8
  2. wp-crontrol.php +10 -6
readme.md CHANGED
@@ -4,7 +4,7 @@ Contributors: johnbillion, scompt
4
  Tags: cron, wp-cron, crontrol, debug
5
  Requires at least: 4.1
6
  Tested up to: 5.4
7
- Stable tag: 1.8.4
8
  Requires PHP: 5.3
9
 
10
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
@@ -32,17 +32,13 @@ The admin screen will show you a warning message if your cron system doesn't app
32
 
33
  Cron schedules are used by WordPress and plugins for scheduling events to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. As an example, many backup plugins provide support for periodic backups. In order to do a weekly backup, a weekly cron schedule must be entered into WP Crontrol first and then a backup plugin can take advantage of it as an interval.
34
 
35
- ### How do I create a new PHP cron event? ###
36
-
37
- In the Tools → Cron Events admin panel, click on the "Add PHP Cron Event" tab underneath the cron event table. In the form that appears, enter the schedule and next run time in the boxes. The event schedule is how often your event will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel. In the "Hook code" area, enter the PHP code that should be run when your cron event is executed. You don't need to provide the PHP opening tag (`<?php`).
38
-
39
- ### How do I create a new regular cron event? ###
40
 
41
  There are two steps to getting a functioning cron event that executes regularly. The first step is telling WordPress about the hook. This is the part that WP Crontrol was created to provide. The second step is calling a function when your hook is executed.
42
 
43
  *Step One: Adding the hook*
44
 
45
- In the Tools → Cron Events admin panel, enter the details of the hook. You're best off having a hookname that conforms to normal PHP variable naming conventions. The event schedule is how often your hook will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel.
46
 
47
  *Step Two: Writing the function*
48
 
@@ -56,6 +52,10 @@ The next step is to write your function. Here's a simple example:
56
  wp_mail( 'hello@example.com', 'WP Crontrol', 'WP Crontrol rocks!' );
57
  }
58
 
 
 
 
 
59
  ### Which users can manage cron events and schedules? ###
60
 
61
  Only users with the `manage_options` capability can manage cron events and schedules. By default, only Administrators have this capability.
@@ -80,9 +80,13 @@ The cron commands which were previously included in WP Crontrol are now part of
80
 
81
  ## Changelog ##
82
 
 
 
 
 
83
  ### 1.8.4 ###
84
 
85
- * Add a warning message if the default timezone has been changed. More information: https://github.com/johnbillion/wp-crontrol/wiki/PHP-default-timezone-is-not-set-to-UTC
86
  * Fixed string being passed to `strtotime()` function when the `Now` option is chosen when adding or editing an event.
87
 
88
  ### 1.8.3 ###
4
  Tags: cron, wp-cron, crontrol, debug
5
  Requires at least: 4.1
6
  Tested up to: 5.4
7
+ Stable tag: 1.8.5
8
  Requires PHP: 5.3
9
 
10
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
32
 
33
  Cron schedules are used by WordPress and plugins for scheduling events to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. As an example, many backup plugins provide support for periodic backups. In order to do a weekly backup, a weekly cron schedule must be entered into WP Crontrol first and then a backup plugin can take advantage of it as an interval.
34
 
35
+ ### How do I create a new cron event? ###
 
 
 
 
36
 
37
  There are two steps to getting a functioning cron event that executes regularly. The first step is telling WordPress about the hook. This is the part that WP Crontrol was created to provide. The second step is calling a function when your hook is executed.
38
 
39
  *Step One: Adding the hook*
40
 
41
+ In the Tools → Cron Events admin panel, click on the "Add Cron Event" tab and enter the details of the hook. You're best off having a hookname that conforms to normal PHP variable naming conventions. The event schedule is how often your hook will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel.
42
 
43
  *Step Two: Writing the function*
44
 
52
  wp_mail( 'hello@example.com', 'WP Crontrol', 'WP Crontrol rocks!' );
53
  }
54
 
55
+ ### How do I create a new PHP cron event? ###
56
+
57
+ In the Tools → Cron Events admin panel, click on the "Add PHP Cron Event" tab. In the form that appears, enter the schedule and next run time in the boxes. The event schedule is how often your event will be executed. If you don't see a good interval, then add one in the Settings → Cron Schedules admin panel. In the "Hook code" area, enter the PHP code that should be run when your cron event is executed. You don't need to provide the PHP opening tag (`<?php`).
58
+
59
  ### Which users can manage cron events and schedules? ###
60
 
61
  Only users with the `manage_options` capability can manage cron events and schedules. By default, only Administrators have this capability.
80
 
81
  ## Changelog ##
82
 
83
+ ### 1.8.5 ###
84
+
85
+ * Fix an issue with the tabs in 1.8.4.
86
+
87
  ### 1.8.4 ###
88
 
89
+ * Add a warning message if the default timezone has been changed. <a href="https://github.com/johnbillion/wp-crontrol/wiki/PHP-default-timezone-is-not-set-to-UTC">More information</a>.
90
  * Fixed string being passed to `strtotime()` function when the `Now` option is chosen when adding or editing an event.
91
 
92
  ### 1.8.3 ###
wp-crontrol.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
6
  * Author: John Blackbourn & crontributors
7
  * Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
8
- * Version: 1.8.4
9
  * Text Domain: wp-crontrol
10
  * Domain Path: /languages/
11
  * Requires PHP: 5.3.6
@@ -61,6 +61,7 @@ function init_hooks() {
61
  add_filter( 'cron_schedules', __NAMESPACE__ . '\filter_cron_schedules' );
62
  add_action( 'crontrol_cron_job', __NAMESPACE__ . '\action_php_cron_event' );
63
  add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' );
 
64
  }
65
 
66
  /**
@@ -1162,12 +1163,15 @@ function get_tab_states() {
1162
  * Output the cron-related tabs if we're on a cron-related admin screen.
1163
  */
1164
  function do_tabs() {
1165
- $tab = get_tab_states();
 
1166
 
1167
- if ( ! array_filter( $tab ) ) {
1168
  return;
1169
  }
1170
 
 
 
1171
  $links = array(
1172
  'events' => array(
1173
  'tools.php?page=crontrol_admin_manage_page',
@@ -1192,7 +1196,7 @@ function do_tabs() {
1192
  <nav class="nav-tab-wrapper">
1193
  <?php
1194
  foreach ( $links as $id => $link ) {
1195
- if ( $tab[ $id ] ) {
1196
  printf(
1197
  '<a href="%s" class="nav-tab nav-tab-active">%s</a>',
1198
  esc_url( $link[0] ),
@@ -1207,7 +1211,7 @@ function do_tabs() {
1207
  }
1208
  }
1209
 
1210
- if ( $tab['edit-event'] ) {
1211
  printf(
1212
  '<span class="nav-tab nav-tab-active">%s</span>',
1213
  esc_html__( 'Edit Cron Event', 'wp-crontrol' )
@@ -1216,7 +1220,7 @@ function do_tabs() {
1216
  ?>
1217
  </nav>
1218
  <?php
1219
- show_cron_status();
1220
  ?>
1221
  </div>
1222
  <?php
5
  * Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
6
  * Author: John Blackbourn & crontributors
7
  * Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
8
+ * Version: 1.8.5
9
  * Text Domain: wp-crontrol
10
  * Domain Path: /languages/
11
  * Requires PHP: 5.3.6
61
  add_filter( 'cron_schedules', __NAMESPACE__ . '\filter_cron_schedules' );
62
  add_action( 'crontrol_cron_job', __NAMESPACE__ . '\action_php_cron_event' );
63
  add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' );
64
+ add_action( 'crontrol/tab-header', __NAMESPACE__ . '\show_cron_status', 20 );
65
  }
66
 
67
  /**
1163
  * Output the cron-related tabs if we're on a cron-related admin screen.
1164
  */
1165
  function do_tabs() {
1166
+ $tabs = get_tab_states();
1167
+ $tab = array_filter( $tabs );
1168
 
1169
+ if ( ! $tab ) {
1170
  return;
1171
  }
1172
 
1173
+ $tab = array_keys( $tab );
1174
+ $tab = reset( $tab );
1175
  $links = array(
1176
  'events' => array(
1177
  'tools.php?page=crontrol_admin_manage_page',
1196
  <nav class="nav-tab-wrapper">
1197
  <?php
1198
  foreach ( $links as $id => $link ) {
1199
+ if ( $tabs[ $id ] ) {
1200
  printf(
1201
  '<a href="%s" class="nav-tab nav-tab-active">%s</a>',
1202
  esc_url( $link[0] ),
1211
  }
1212
  }
1213
 
1214
+ if ( $tabs['edit-event'] ) {
1215
  printf(
1216
  '<span class="nav-tab nav-tab-active">%s</span>',
1217
  esc_html__( 'Edit Cron Event', 'wp-crontrol' )
1220
  ?>
1221
  </nav>
1222
  <?php
1223
+ do_action( 'crontrol/tab-header', $tab, $tabs );
1224
  ?>
1225
  </div>
1226
  <?php