Drafts Scheduler - Version 1.9.2

Version Description

  • Version bump to make sure the most recent code is downloading
Download this release

Release Info

Developer talus
Plugin Icon wp plugin Drafts Scheduler
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.2

Files changed (2) hide show
  1. draft-scheduler.php +23 -19
  2. readme.txt +11 -2
draft-scheduler.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.installedforyou.com/draftscheduler
5
  Contributors: talus
6
  Description: Allows WordPress admins to bulk schedule posts currently saved as drafts
7
  Author: Jeff Rose
8
- Version: 1.9
9
  Author URI: http://www.installedforyou.com
10
  Tags: drafts, schedule, posts
11
  License: GPL2
@@ -30,7 +30,7 @@ License: GPL2
30
 
31
  if ( ! class_exists( 'DraftScheduler' ) ) {
32
 
33
- define ( 'IFDS_VERSION', '1.9' );
34
  define( 'DraftScheduler_root', WP_PLUGIN_URL . '/drafts-scheduler/' );
35
 
36
  class DraftScheduler{
@@ -228,6 +228,8 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
228
  }
229
  $draftCount = $this->draftScheduler_check_for_drafts();
230
  if ( 0 != $draftCount ) {
 
 
231
  ?>
232
  <form method="post">
233
  <?php wp_nonce_field( 'do-schedule-drafts' ); ?>
@@ -242,7 +244,7 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
242
  <th scope="row">Schedule Start Date</th>
243
  <td>
244
  <div id="datepicker"></div>
245
- <input type="text" name="startDate" id="startDate" size="31" value="<?php echo $_POST['startDate']; ?>"/>
246
  <br/>
247
  Note: if your schedule starts "Today" then posting will start from midnight, including before "now."<br/>You may wish to start tomorrow.
248
  </td>
@@ -250,17 +252,17 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
250
  <tr valign="top">
251
  <th scope="row">Posting order</th>
252
  <td>
253
- <input type="radio" name="randomness" value="random" <?php checked( $_POST['randomness'], 'random', true );
254
- checked( $_POST['randomness'], '', true ); ?>> Randomly grab any draft in any order<br/>
255
- <input type="radio" name="randomness" value="sequential" <?php checked( $_POST['randomness'], 'sequential', true ); ?>> Sequentially schedule drafts from oldest to
256
  newest in order
257
  </td>
258
  </tr>
259
  <tr valign="top">
260
  <th scope="row">Post interval</th>
261
  <td>
262
- <input type="text" name="intHours" id="intHours" size="4" maxlength="2" value="<?php echo $_POST['intHours']; ?>"/><strong>hrs</strong>
263
- <input type="text" name="intMins" id="intMins" size="4" maxlength="2" value="<?php echo $_POST['intMins']; ?>"/><strong>mins</strong>
264
  </td>
265
  </tr>
266
 
@@ -273,25 +275,25 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
273
  <tr valign="top">
274
  <th scope="row">Post Randomly</th>
275
  <td>
276
- <input type="radio" name="randomness" value="fullrandom" <?php if ( $_POST['randomness'] == "fullrandom" ) {
277
  echo " checked ";
278
  } ?>> Surprise me <em>(posts entirely randomly after the date above, but within the times below)</em><br/>
279
- Post up to <input type="text" name="postsperday" id="postsperda" value="<?php echo $_POST['postsperday']; ?>" size="3" maxlength="3"/> posts per
280
  <select name="dayweekmonth">
281
  <option value="day">day</option>
282
  <option value="week">week</option>
283
  <option value="month">month</option>
284
  </select> <strong>OR</strong>
285
- Post exactly <input type="text" name="exactPosts" id="exactPosts" value="<?php echo $_POST['exactPosts']; ?>" size="3" maxlength="3"/> posts per day<br/>
286
  Randomly after:
287
  <select name="startTime" id="startTime">
288
  <option value="">Choose a time</option>
289
- <?php echo self::createDateTimeDropDowns( $_POST['startTime'] ); ?>
290
  </select><br/>
291
  And before:
292
  <select name="endTime" id="endTime">
293
  <option value="">Choose a time</option>
294
- <?php echo self::createDateTimeDropDowns( $_POST['endTime'] ); ?>
295
  </select><br/>
296
  </td>
297
  </tr>
@@ -322,6 +324,8 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
322
  $postsToday = $exactPosts;
323
  }
324
 
 
 
325
  $startPosts = date_i18n( 'Y-n-j g:i:s', strtotime( $startDate . ' ' . $startTime ) );
326
 
327
  $randInterval = ( strtotime( $endTime ) - strtotime( $startTime ) );
@@ -371,7 +375,7 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
371
  $thisDraft = array_pop( $draftList );
372
 
373
  $postRandom = rand( 0, $randInterval );
374
- $postTime = date_i18n( 'Y-n-j G:i:s', strtotime( "+" . $postRandom . " seconds", strtotime( $startPosts ) ) );
375
 
376
  $this->update_post_details( strtotime( $postTime ), $thisDraft->ID );
377
  $whole_post = get_post( $thisDraft->ID );
@@ -472,11 +476,11 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
472
  } // End Function draftScheduler_sequential_post_by_interval
473
 
474
  function update_post_details( $ds_postDate, $draftID ) {
475
- $ds_gmt = get_gmt_from_date( date( 'Y-n-j G:i:s', $ds_postDate ) );
476
 
477
  $update_date = array(
478
  'ID' => $draftID,
479
- 'post_date' => date_i18n( 'Y-n-j G:i:s', $ds_postDate ),
480
  'post_date_gmt' => $ds_gmt,
481
  'post_status' => 'future',
482
  'edit_date' => true
@@ -557,9 +561,9 @@ if ( ! class_exists( 'DraftScheduler' ) ) {
557
  $draftScheduler = new DraftScheduler();
558
 
559
  add_action( 'admin_enqueue_scripts', 'theme_admin_js' );
560
- function theme_admin_js(){
561
- wp_enqueue_script('jquery-ui-core');
562
- wp_enqueue_script('jquery-ui-datepicker');
563
  }
564
 
565
  function j_is_date( $str ) {
5
  Contributors: talus
6
  Description: Allows WordPress admins to bulk schedule posts currently saved as drafts
7
  Author: Jeff Rose
8
+ Version: 1.9.2
9
  Author URI: http://www.installedforyou.com
10
  Tags: drafts, schedule, posts
11
  License: GPL2
30
 
31
  if ( ! class_exists( 'DraftScheduler' ) ) {
32
 
33
+ define ( 'IFDS_VERSION', '1.9.2' );
34
  define( 'DraftScheduler_root', WP_PLUGIN_URL . '/drafts-scheduler/' );
35
 
36
  class DraftScheduler{
228
  }
229
  $draftCount = $this->draftScheduler_check_for_drafts();
230
  if ( 0 != $draftCount ) {
231
+ $start_date = isset( $_POST['startDate'] ) ? $_POST['startDate'] : '';
232
+ $randomness = isset( $_POST['randomness'] ) ? $_POST['randomness'] : 'random';
233
  ?>
234
  <form method="post">
235
  <?php wp_nonce_field( 'do-schedule-drafts' ); ?>
244
  <th scope="row">Schedule Start Date</th>
245
  <td>
246
  <div id="datepicker"></div>
247
+ <input type="text" name="startDate" id="startDate" size="31" value="<?php echo esc_attr( $start_date ); ?>"/>
248
  <br/>
249
  Note: if your schedule starts "Today" then posting will start from midnight, including before "now."<br/>You may wish to start tomorrow.
250
  </td>
252
  <tr valign="top">
253
  <th scope="row">Posting order</th>
254
  <td>
255
+ <input type="radio" name="randomness" value="random" <?php checked( $randomness, 'random', true );
256
+ checked( $randomness, '', true ); ?>> Randomly grab any draft in any order<br/>
257
+ <input type="radio" name="randomness" value="sequential" <?php checked( $randomness, 'sequential', true ); ?>> Sequentially schedule drafts from oldest to
258
  newest in order
259
  </td>
260
  </tr>
261
  <tr valign="top">
262
  <th scope="row">Post interval</th>
263
  <td>
264
+ <input type="text" name="intHours" id="intHours" size="4" maxlength="2" value="<?php echo isset( $_POST['intHours'] ) ? absint( $_POST['intHours'] ) : ''; ?>"/><strong>hrs</strong>
265
+ <input type="text" name="intMins" id="intMins" size="4" maxlength="2" value="<?php echo isset( $_POST['intMins'] ) ? absint( $_POST['intMins'] ) : ''; ?>"/><strong>mins</strong>
266
  </td>
267
  </tr>
268
 
275
  <tr valign="top">
276
  <th scope="row">Post Randomly</th>
277
  <td>
278
+ <input type="radio" name="randomness" value="fullrandom" <?php if ( $randomness == "fullrandom" ) {
279
  echo " checked ";
280
  } ?>> Surprise me <em>(posts entirely randomly after the date above, but within the times below)</em><br/>
281
+ Post up to <input type="text" name="postsperday" id="postsperday" value="<?php echo isset( $_POST['postsperday'] ) ? absint( $_POST['postsperday'] ) : ''; ?>" size="3" maxlength="3"/> posts per
282
  <select name="dayweekmonth">
283
  <option value="day">day</option>
284
  <option value="week">week</option>
285
  <option value="month">month</option>
286
  </select> <strong>OR</strong>
287
+ Post exactly <input type="text" name="exactPosts" id="exactPosts" value="<?php echo isset( $_POST['exactPosts'] ) ? absint( $_POST['exactPosts'] ) : ''; ?>" size="3" maxlength="3"/> posts per day<br/>
288
  Randomly after:
289
  <select name="startTime" id="startTime">
290
  <option value="">Choose a time</option>
291
+ <?php echo self::createDateTimeDropDowns( isset( $_POST['startTime'] ) ? $_POST['startTime'] : '' ); ?>
292
  </select><br/>
293
  And before:
294
  <select name="endTime" id="endTime">
295
  <option value="">Choose a time</option>
296
+ <?php echo self::createDateTimeDropDowns( isset( $_POST['endTime'] ) ? $_POST['endTime'] : '' ); ?>
297
  </select><br/>
298
  </td>
299
  </tr>
324
  $postsToday = $exactPosts;
325
  }
326
 
327
+
328
+
329
  $startPosts = date_i18n( 'Y-n-j g:i:s', strtotime( $startDate . ' ' . $startTime ) );
330
 
331
  $randInterval = ( strtotime( $endTime ) - strtotime( $startTime ) );
375
  $thisDraft = array_pop( $draftList );
376
 
377
  $postRandom = rand( 0, $randInterval );
378
+ $postTime = date_i18n( 'Y-m-d G:i:s', strtotime( "+" . $postRandom . " seconds", strtotime( $startPosts ) ) );
379
 
380
  $this->update_post_details( strtotime( $postTime ), $thisDraft->ID );
381
  $whole_post = get_post( $thisDraft->ID );
476
  } // End Function draftScheduler_sequential_post_by_interval
477
 
478
  function update_post_details( $ds_postDate, $draftID ) {
479
+ $ds_gmt = get_gmt_from_date( date( 'Y-m-d G:i:s', $ds_postDate ) );
480
 
481
  $update_date = array(
482
  'ID' => $draftID,
483
+ 'post_date' => date_i18n( 'Y-m-d G:i:s', $ds_postDate ),
484
  'post_date_gmt' => $ds_gmt,
485
  'post_status' => 'future',
486
  'edit_date' => true
561
  $draftScheduler = new DraftScheduler();
562
 
563
  add_action( 'admin_enqueue_scripts', 'theme_admin_js' );
564
+ function theme_admin_js() {
565
+ wp_enqueue_script( 'jquery-ui-core' );
566
+ wp_enqueue_script( 'jquery-ui-datepicker' );
567
  }
568
 
569
  function j_is_date( $str ) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: talus
3
  Donate link: http://www.installedforyou.com/wordpress/drafts-scheduler-plugin/
4
  Tags: drafts, scheduling, posts, schedule
5
  Requires at least: 2.8
6
- Tested up to: 4.0
7
- Stable tag: 1.9
8
 
9
  Sequentially or randomly schedule ALL draft posts for posting.
10
 
@@ -58,6 +58,12 @@ Again, sorry, not in this version. In the future, it would be easy to add.
58
 
59
 
60
  == Changelog ==
 
 
 
 
 
 
61
  = 1.9 =
62
  - Fixed a problem with Datepicker not enqueing properly
63
 
@@ -99,3 +105,6 @@ Bug fixes:
99
 
100
  = 1.0 =
101
  * First version released.
 
 
 
3
  Donate link: http://www.installedforyou.com/wordpress/drafts-scheduler-plugin/
4
  Tags: drafts, scheduling, posts, schedule
5
  Requires at least: 2.8
6
+ Tested up to: 4.1.1
7
+ Stable tag: 1.9.2
8
 
9
  Sequentially or randomly schedule ALL draft posts for posting.
10
 
58
 
59
 
60
  == Changelog ==
61
+ = 1.9.2 =
62
+ - Version bump to make sure the most recent code is downloading
63
+
64
+ = 1.9.1 =
65
+ - Fixed a problem with date formats causing days to be skipped and other errors (hidden error).
66
+
67
  = 1.9 =
68
  - Fixed a problem with Datepicker not enqueing properly
69
 
105
 
106
  = 1.0 =
107
  * First version released.
108
+
109
+ == Upgrade Notice ==
110
+ Fixes issues where posts are not scheduled on some days, and other hidden errors causing unscheduled posts.