Postie - Version 1.9.27

Version Description

(2018-12-20) = * Add new filter postie_parent_post to allow custom parent post detection * Existing parent post detection now only looks at the configured post type and uses the most recent if multiple are found

Download this release

Release Info

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

Code changes from version 1.9.26 to 1.9.27

config_form_message.php CHANGED
@@ -112,7 +112,7 @@
112
  </tr>
113
 
114
  <?php echo PostieAdmin::boolean_select_html(__("Treat Replies As", 'postie'), "postie-settings[reply_as_comment]", $reply_as_comment, "", array("comments", "new posts")); ?>
115
- <?php echo PostieAdmin::boolean_select_html(__("Strip Original Content from Replies", 'postie'), "postie-settings[strip_reply]", $strip_reply, "Only applicable if replies are trated as comments"); ?>
116
 
117
  <?php echo PostieAdmin::boolean_select_html(__("Forward Rejected Mail", 'postie'), "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
118
  <?php echo PostieAdmin::boolean_select_html(__("Allow Subject In Mail", 'postie'), "postie-settings[allow_subject_in_mail]", $allow_subject_in_mail, "Enclose the subject between '#' on the very first line. E.g. #this is my subject#"); ?>
112
  </tr>
113
 
114
  <?php echo PostieAdmin::boolean_select_html(__("Treat Replies As", 'postie'), "postie-settings[reply_as_comment]", $reply_as_comment, "", array("comments", "new posts")); ?>
115
+ <?php echo PostieAdmin::boolean_select_html(__("Strip Original Content from Replies", 'postie'), "postie-settings[strip_reply]", $strip_reply, "Only applicable if replies are treated as comments"); ?>
116
 
117
  <?php echo PostieAdmin::boolean_select_html(__("Forward Rejected Mail", 'postie'), "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
118
  <?php echo PostieAdmin::boolean_select_html(__("Allow Subject In Mail", 'postie'), "postie-settings[allow_subject_in_mail]", $allow_subject_in_mail, "Enclose the subject between '#' on the very first line. E.g. #this is my subject#"); ?>
config_form_server.php CHANGED
@@ -46,7 +46,10 @@
46
  </tr>
47
  <tr valign="top">
48
  <th scope="row"><?php _e('Mail Userid', 'postie') ?></th>
49
- <td><input name='postie-settings[mail_userid]' type="text" id='postie-settings-mail_userid' autocomplete='new-password' value="<?php echo esc_attr($mail_userid); ?>" size="40" /></td>
 
 
 
50
  </tr>
51
  <tr valign="top">
52
  <th scope="row"><?php _e('Mail Password', 'postie') ?></th>
@@ -86,8 +89,8 @@
86
  }
87
  ?>><?php _e('daily', 'postie') ?>
88
  </option>
89
-
90
- <option value="twohours"<?php
91
  if ($interval == "twohours") {
92
  echo "selected='selected'";
93
  }
46
  </tr>
47
  <tr valign="top">
48
  <th scope="row"><?php _e('Mail Userid', 'postie') ?></th>
49
+ <td>
50
+ <input name='postie-settings[mail_userid]' type="text" id='postie-settings-mail_userid' autocomplete='new-password' value="<?php echo esc_attr($mail_userid); ?>" size="40" />
51
+ <p class='description'><?php _e("Typically your full email address.", 'postie'); ?><br />
52
+ </td>
53
  </tr>
54
  <tr valign="top">
55
  <th scope="row"><?php _e('Mail Password', 'postie') ?></th>
89
  }
90
  ?>><?php _e('daily', 'postie') ?>
91
  </option>
92
+
93
+ <option value="twohours"<?php
94
  if ($interval == "twohours") {
95
  echo "selected='selected'";
96
  }
docs/Changes.txt CHANGED
@@ -35,6 +35,10 @@ All script, style and body tags are stripped from html emails.
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
 
 
 
 
38
  = 1.9.26 (2018-11-23) =
39
  * If no category is specified and the post type is "page" then the default category is not added
40
  * Additional CID changes
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.27 (2018-12-20) =
39
+ * Add new filter postie_parent_post to allow custom parent post detection
40
+ * Existing parent post detection now only looks at the configured post type and uses the most recent if multiple are found
41
+
42
  = 1.9.26 (2018-11-23) =
43
  * If no category is specified and the post type is "page" then the default category is not added
44
  * Additional CID changes
docs/Postie.txt CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
- Tested up to: 4.9
10
- Stable tag: 1.9.26
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
6
  Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
+ Tested up to: 5.0
10
+ Stable tag: 1.9.27
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
postie.class.php CHANGED
@@ -539,7 +539,7 @@ class Postie {
539
  DebugEcho("doing postie_file_added_pre");
540
  do_action('postie_file_added_pre', $post_id, $file_array);
541
 
542
- DebugEcho("media_handle_upload: adding " . $file_array['name']);
543
 
544
  $id = media_handle_sideload($file_array, $post_id);
545
 
@@ -728,7 +728,7 @@ class Postie {
728
  }
729
 
730
  if ($config['reply_as_comment'] == true) {
731
- $id = $this->parent_post($subject);
732
  if (empty($id)) {
733
  DebugEcho("Not a reply");
734
  $id = $post_id;
@@ -902,7 +902,7 @@ class Postie {
902
  * generated
903
  */
904
 
905
- function parent_post(&$subject) {
906
  global $wpdb;
907
 
908
  $id = NULL;
@@ -926,8 +926,8 @@ class Postie {
926
  $tmpSubject = trim($tmpSubject_matches[1]);
927
  }
928
  DebugEcho("GetParentPostForReply: tmpSubject: $tmpSubject");
929
- $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_status = 'publish' AND comment_status = 'open'";
930
- if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject))) {
931
  if (!empty($id)) {
932
  DebugEcho("GetParentPostForReply: id: $id");
933
  } else {
@@ -937,6 +937,10 @@ class Postie {
937
  } else {
938
  DebugEcho("GetParentPostForReply: No parent found");
939
  }
 
 
 
 
940
  return $id;
941
  }
942
 
539
  DebugEcho("doing postie_file_added_pre");
540
  do_action('postie_file_added_pre', $post_id, $file_array);
541
 
542
+ DebugEcho("media_handle_sideload: adding " . $file_array['name']);
543
 
544
  $id = media_handle_sideload($file_array, $post_id);
545
 
728
  }
729
 
730
  if ($config['reply_as_comment'] == true) {
731
+ $id = $this->parent_post($subject, $mimeDecodedEmail, $config);
732
  if (empty($id)) {
733
  DebugEcho("Not a reply");
734
  $id = $post_id;
902
  * generated
903
  */
904
 
905
+ function parent_post(&$subject, $email, $config) {
906
  global $wpdb;
907
 
908
  $id = NULL;
926
  $tmpSubject = trim($tmpSubject_matches[1]);
927
  }
928
  DebugEcho("GetParentPostForReply: tmpSubject: $tmpSubject");
929
+ $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title LIKE %s AND post_status = 'publish' AND comment_status = 'open' AND post_type=%s ORDER BY post_date DESC";
930
+ if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject, $config[PostieConfigOptions::PostType]))) {
931
  if (!empty($id)) {
932
  DebugEcho("GetParentPostForReply: id: $id");
933
  } else {
937
  } else {
938
  DebugEcho("GetParentPostForReply: No parent found");
939
  }
940
+
941
+ $id = apply_filters('postie_parent_post', $id, $email);
942
+ DebugEcho("GetParentPostForReply: After postie_parent_post: $id");
943
+
944
  return $id;
945
  }
946
 
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
- Version: 1.9.26
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1979823 2018-11-24 04:57:25Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.26');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
+ Version: 1.9.27
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1999411 2018-12-21 05:36:23Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.27');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
readme.txt CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
- Tested up to: 4.9
10
- Stable tag: 1.9.26
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -107,6 +107,10 @@ All script, style and body tags are stripped from html emails.
107
  Attachments are now processed in the order they were attached.
108
 
109
  == CHANGELOG ==
 
 
 
 
110
  = 1.9.26 (2018-11-23) =
111
  * If no category is specified and the post type is "page" then the default category is not added
112
  * Additional CID changes
6
  Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
+ Tested up to: 5.0
10
+ Stable tag: 1.9.27
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
107
  Attachments are now processed in the order they were attached.
108
 
109
  == CHANGELOG ==
110
+ = 1.9.27 (2018-12-20) =
111
+ * Add new filter postie_parent_post to allow custom parent post detection
112
+ * Existing parent post detection now only looks at the configured post type and uses the most recent if multiple are found
113
+
114
  = 1.9.26 (2018-11-23) =
115
  * If no category is specified and the post type is "page" then the default category is not added
116
  * Additional CID changes