Postie - Version 1.4.39

Version Description

(future) = * Fixed bug where Postie supplied schedules were not always being correctly added to the cron

Download this release

Release Info

Developer WayneAllen
Plugin Icon 128x128 Postie
Version 1.4.39
Comparing to
See all releases

Code changes from version 1.4.38 to 1.4.39

Files changed (7) hide show
  1. Revision +2 -0
  2. docs/Changes.txt +3 -0
  3. docs/Postie.txt +1 -1
  4. postie-functions.php +10 -7
  5. postie.php +29 -20
  6. postie_test.php +1 -2
  7. readme.txt +4 -1
Revision CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ Revision: 681890
2
+ Last Changed Date: 2013-03-13 09:55:52 -0700 (Wed, 13 Mar 2013)
docs/Changes.txt CHANGED
@@ -10,6 +10,9 @@ All script, style and body tags are stripped from html emails.
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
 
 
 
13
  = 1.4.38 (2013.03.12) =
14
  * Improved POP3 configuration test
15
  * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
13
+ = 1.4.39 (future) =
14
+ * Fixed bug where Postie supplied schedules were not always being correctly added to the cron
15
+
16
  = 1.4.38 (2013.03.12) =
17
  * Improved POP3 configuration test
18
  * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
- Stable tag: 1.4.38
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.4.39
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 680972 2013-03-13 04:33:01Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -2128,15 +2128,16 @@ function filter_ReplaceImagePlaceHolders(&$content, $attachments, $config) {
2128
  $content = html_entity_decode($content, ENT_QUOTES);
2129
  }
2130
 
2131
- $startIndex = $config ['start_image_count_at_zero'] ? 0 : 1;
2132
- if (!empty($attachments) && $config ['auto_gallery']) {
2133
  $imageTemplate = '[gallery]';
2134
- if ($config ['images_append']) {
2135
- $content .= $imageTemplate;
 
2136
  } else {
2137
  $content = "$imageTemplate\n" . $content;
 
2138
  }
2139
- DebugEcho("Auto gallery");
2140
  return;
2141
  }
2142
 
@@ -2185,6 +2186,8 @@ function filter_ReplaceImagePlaceHolders(&$content, $attachments, $config) {
2185
  /* if using the gallery shortcode, don't add pictures at all */
2186
  if (!preg_match("/\[gallery[^\[]*\]/", $content, $matches)) {
2187
  $pics .= $imageTemplate;
 
 
2188
  }
2189
  }
2190
  $i++;
@@ -2442,7 +2445,7 @@ function config_Update($data) {
2442
  if ($data['interval'] != '') {
2443
  postie_decron();
2444
  if ($data['interval'] != 'manual') {
2445
- postie_cron($interval = $data['interval']);
2446
  }
2447
  }
2448
  }
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 682015 2013-03-14 23:11:34Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
2128
  $content = html_entity_decode($content, ENT_QUOTES);
2129
  }
2130
 
2131
+ $startIndex = $config['start_image_count_at_zero'] ? 0 : 1;
2132
+ if (!empty($attachments) && $config['auto_gallery']) {
2133
  $imageTemplate = '[gallery]';
2134
+ if ($config['images_append']) {
2135
+ $content .= "\n$imageTemplate";
2136
+ DebugEcho("Auto gallery: append");
2137
  } else {
2138
  $content = "$imageTemplate\n" . $content;
2139
+ DebugEcho("Auto gallery: prepend");
2140
  }
 
2141
  return;
2142
  }
2143
 
2186
  /* if using the gallery shortcode, don't add pictures at all */
2187
  if (!preg_match("/\[gallery[^\[]*\]/", $content, $matches)) {
2188
  $pics .= $imageTemplate;
2189
+ } else {
2190
+ DebugEcho("gallery detected, not inserting images");
2191
  }
2192
  }
2193
  $i++;
2445
  if ($data['interval'] != '') {
2446
  postie_decron();
2447
  if ($data['interval'] != 'manual') {
2448
+ postie_cron($data['interval']);
2449
  }
2450
  }
2451
  }
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
- Version: 1.4.38
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,12 +27,23 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 680972 2013-03-13 04:33:01Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
34
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
35
 
 
 
 
 
 
 
 
 
 
 
 
36
  function postie_loadjs_add_page() {
37
  $postiepage = add_options_page('Postie', 'Postie', 'manage_options', POSTIE_ROOT . '/postie.php', 'postie_loadjs_options_page');
38
  add_action("admin_print_scripts-$postiepage", 'postie_loadjs_admin_head');
@@ -109,8 +120,6 @@ function activate_postie() {
109
  $init = true;
110
  }
111
 
112
- register_activation_hook(__FILE__, 'activate_postie');
113
-
114
  /**
115
  * set up actions to show relevant warnings,
116
  * if mail server is not set, or if IMAP extension is not available
@@ -162,7 +171,6 @@ function disable_kses_content() {
162
  remove_filter('content_save_pre', 'wp_filter_post_kses');
163
  }
164
 
165
- add_action('init', 'disable_kses_content', 20);
166
 
167
  function postie_whitelist($options) {
168
  $added = array('postie-settings' => array('postie-settings'));
@@ -170,8 +178,6 @@ function postie_whitelist($options) {
170
  return $options;
171
  }
172
 
173
- add_filter('whitelist_options', 'postie_whitelist');
174
-
175
  function check_postie() {
176
  $host = get_option('siteurl');
177
  preg_match("/https?:\/\/(.[^\/]*)(.*)/i", $host, $matches);
@@ -199,45 +205,48 @@ function check_postie() {
199
  }
200
 
201
  function postie_cron($interval = false) {
202
- error_log("Postie: setting up cron task: $interval");
 
 
 
 
 
203
  if (!$interval) {
204
  $config = config_Read();
205
  $interval = $config['interval'];
206
- error_log("Postie: setting up cron task from config: $interval");
207
  }
208
- if (!$interval || $interval == ''){
209
  $interval = 'hourly';
210
  error_log("Postie: setting up cron task: defaulting to hourly");
211
  }
212
  if ($interval == 'manual') {
213
  postie_decron();
214
- error_log("Postie: clearing cron (manual)");
215
  } else {
216
  if (false === wp_schedule_event(time(), $interval, 'check_postie_hook')) {
217
- //Do not echo output in filters, it seems to break some installs
218
- error_log("Postie: Failed to set up cron task: $interval");
 
219
  }
220
  }
221
  }
222
 
223
  function postie_decron() {
224
- error_log("Postie: clearing cron");
225
  wp_clear_scheduled_hook('check_postie_hook');
226
  }
227
 
228
  /* here we add some more cron options for how often to check for e-mail */
229
-
230
  function postie_more_reccurences($schedules) {
 
 
231
  $schedules['weekly'] = array('interval' => (60 * 60 * 24 * 7), 'display' => __('Once Weekly'));
232
- $schedules['twiceperhour'] = array('interval' => 60 * 30, 'display' => __('Twice per hour '));
233
  $schedules['tenminutes'] = array('interval' => 60 * 10, 'display' => __('Every 10 minutes'));
234
  $schedules['fiveminutes'] = array('interval' => 60 * 5, 'display' => __('Every 5 minutes'));
235
 
236
  return $schedules;
237
  }
238
 
239
- add_filter('cron_schedules', 'postie_more_reccurences');
240
- register_activation_hook(__FILE__, 'postie_cron');
241
- register_deactivation_hook(__FILE__, 'postie_decron');
242
- add_action('check_postie_hook', 'check_postie');
243
  ?>
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
+ Version: 1.4.39
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 682015 2013-03-14 23:11:34Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
34
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
35
 
36
+ //register the hooks early in the page in case some method needs the result of one of them (i.e. cron_schedules)
37
+ add_action('init', 'disable_kses_content', 20);
38
+ add_action('check_postie_hook', 'check_postie');
39
+
40
+ add_filter('whitelist_options', 'postie_whitelist');
41
+ add_filter('cron_schedules', 'postie_more_reccurences');
42
+
43
+ register_activation_hook(__FILE__, 'activate_postie');
44
+ register_activation_hook(__FILE__, 'postie_cron');
45
+ register_deactivation_hook(__FILE__, 'postie_decron');
46
+
47
  function postie_loadjs_add_page() {
48
  $postiepage = add_options_page('Postie', 'Postie', 'manage_options', POSTIE_ROOT . '/postie.php', 'postie_loadjs_options_page');
49
  add_action("admin_print_scripts-$postiepage", 'postie_loadjs_admin_head');
120
  $init = true;
121
  }
122
 
 
 
123
  /**
124
  * set up actions to show relevant warnings,
125
  * if mail server is not set, or if IMAP extension is not available
171
  remove_filter('content_save_pre', 'wp_filter_post_kses');
172
  }
173
 
 
174
 
175
  function postie_whitelist($options) {
176
  $added = array('postie-settings' => array('postie-settings'));
178
  return $options;
179
  }
180
 
 
 
181
  function check_postie() {
182
  $host = get_option('siteurl');
183
  preg_match("/https?:\/\/(.[^\/]*)(.*)/i", $host, $matches);
205
  }
206
 
207
  function postie_cron($interval = false) {
208
+ //Do not echo output in filters, it seems to break some installs
209
+ error_log("postie_cron: setting up cron task: $interval");
210
+
211
+ $schedules = wp_get_schedules();
212
+ error_log("postie_cron\n".print_r($schedules, true));
213
+
214
  if (!$interval) {
215
  $config = config_Read();
216
  $interval = $config['interval'];
217
+ error_log("postie_cron: setting up cron task from config: $interval");
218
  }
219
+ if (!$interval || $interval == '') {
220
  $interval = 'hourly';
221
  error_log("Postie: setting up cron task: defaulting to hourly");
222
  }
223
  if ($interval == 'manual') {
224
  postie_decron();
225
+ error_log("postie_cron: clearing cron (manual)");
226
  } else {
227
  if (false === wp_schedule_event(time(), $interval, 'check_postie_hook')) {
228
+ error_log("postie_cron: Failed to set up cron task: $interval");
229
+ } else {
230
+ error_log("postie_cron: Set up cron task: $interval");
231
  }
232
  }
233
  }
234
 
235
  function postie_decron() {
236
+ error_log("postie_decron: clearing cron");
237
  wp_clear_scheduled_hook('check_postie_hook');
238
  }
239
 
240
  /* here we add some more cron options for how often to check for e-mail */
 
241
  function postie_more_reccurences($schedules) {
242
+ //Do not echo output in filters, it seems to break some installs
243
+ error_log("postie_more_reccurences: setting cron schedules");
244
  $schedules['weekly'] = array('interval' => (60 * 60 * 24 * 7), 'display' => __('Once Weekly'));
245
+ $schedules['twiceperhour'] = array('interval' => 60 * 30, 'display' => __('Twice per hour'));
246
  $schedules['tenminutes'] = array('interval' => 60 * 10, 'display' => __('Every 10 minutes'));
247
  $schedules['fiveminutes'] = array('interval' => 60 * 5, 'display' => __('Every 5 minutes'));
248
 
249
  return $schedules;
250
  }
251
 
 
 
 
 
252
  ?>
postie_test.php CHANGED
@@ -97,8 +97,7 @@ $images = array("Test.png", "Test.jpg", "Test.gif");
97
  case 'pop3':
98
  default:
99
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
100
- $pop3 = &new POP3();
101
- $pop3->DEBUG = true;
102
  if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
103
  EchoInfo("Unable to connect. The server said:");
104
  EchoInfo($pop3->ERROR);
97
  case 'pop3':
98
  default:
99
  require_once(ABSPATH . WPINC . DIRECTORY_SEPARATOR . 'class-pop3.php');
100
+ $pop3 = new POP3();
 
101
  if (!$pop3->connect($config["mail_server"], $config["mail_server_port"])) {
102
  EchoInfo("Unable to connect. The server said:");
103
  EchoInfo($pop3->ERROR);
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
- Stable tag: 1.4.38
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -426,6 +426,9 @@ All script, style and body tags are stripped from html emails.
426
  Attachments are now processed in the order they were attached.
427
 
428
  == CHANGELOG ==
 
 
 
429
  = 1.4.38 (2013.03.12) =
430
  * Improved POP3 configuration test
431
  * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.4.39
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
426
  Attachments are now processed in the order they were attached.
427
 
428
  == CHANGELOG ==
429
+ = 1.4.39 (future) =
430
+ * Fixed bug where Postie supplied schedules were not always being correctly added to the cron
431
+
432
  = 1.4.38 (2013.03.12) =
433
  * Improved POP3 configuration test
434
  * Fixed bug where :start and :end were removing commands like tags: and date: before they got a chance to be processed