Postie - Version 1.7.16

Version Description

(2015-10-08) = * Ensure comments are valid html after striping if preferred text type is html * Add setting to control comment content (strip_reply)

Download this release

Release Info

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

Code changes from version 1.7.15 to 1.7.16

Files changed (6) hide show
  1. config_form.php +2 -0
  2. docs/Changes.txt +4 -0
  3. docs/Postie.txt +1 -1
  4. postie-functions.php +21 -16
  5. postie.php +3 -3
  6. readme.txt +5 -1
config_form.php CHANGED
@@ -449,6 +449,8 @@
449
  </tr>
450
 
451
  <?php echo BuildBooleanSelect(__("Treat Replies As", 'postie'), "postie-settings[reply_as_comment]", $reply_as_comment, "", array("comments", "new posts")); ?>
 
 
452
  <?php echo BuildBooleanSelect(__("Forward Rejected Mail", 'postie'), "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
453
  <?php echo BuildBooleanSelect(__("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#"); ?>
454
  <?php echo BuildBooleanSelect(__("Allow HTML In Mail Subject", 'postie'), "postie-settings[allow_html_in_subject]", $allow_html_in_subject); ?>
449
  </tr>
450
 
451
  <?php echo BuildBooleanSelect(__("Treat Replies As", 'postie'), "postie-settings[reply_as_comment]", $reply_as_comment, "", array("comments", "new posts")); ?>
452
+ <?php echo BuildBooleanSelect(__("Strip Original Content from Replies", 'postie'), "postie-settings[strip_reply]", $strip_reply, "Only applicable if replies are trated as comments"); ?>
453
+
454
  <?php echo BuildBooleanSelect(__("Forward Rejected Mail", 'postie'), "postie-settings[forward_rejected_mail]", $forward_rejected_mail); ?>
455
  <?php echo BuildBooleanSelect(__("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#"); ?>
456
  <?php echo BuildBooleanSelect(__("Allow HTML In Mail Subject", 'postie'), "postie-settings[allow_html_in_subject]", $allow_html_in_subject); ?>
docs/Changes.txt CHANGED
@@ -27,6 +27,10 @@ All script, style and body tags are stripped from html emails.
27
  Attachments are now processed in the order they were attached.
28
 
29
  == CHANGELOG ==
 
 
 
 
30
  = 1.7.15 (2015-10-02) =
31
  * Completely replace linkify logic
32
  * Support youtu.be links
27
  Attachments are now processed in the order they were attached.
28
 
29
  == CHANGELOG ==
30
+ = 1.7.16 (2015-10-08) =
31
+ * Ensure comments are valid html after striping if preferred text type is html
32
+ * Add setting to control comment content (strip_reply)
33
+
34
  = 1.7.15 (2015-10-02) =
35
  * Completely replace linkify logic
36
  * Support youtu.be links
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.3.1
9
- Stable tag: 1.7.15
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.3.1
9
+ Stable tag: 1.7.16
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,11 +1,8 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1258511 2015-10-02 22:00:08Z WayneAllen $
4
  */
5
 
6
- //to turn on debug output add the following line to wp-config.php
7
- //define('POSTIE_DEBUG', true);
8
-
9
  class PostiePostModifiers {
10
 
11
  var $PostFormat = 'standard';
@@ -335,19 +332,26 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
335
  } else {
336
  DebugEcho("Reply detected");
337
  $is_reply = true;
338
- // strip out quoted content
339
- $lines = explode("\n", $content);
340
- $newContents = '';
341
- foreach ($lines as $line) {
342
- if (preg_match("/^>.*/i", $line) == 0 &&
343
- preg_match("/^(from|subject|to|date):.*?/i", $line) == 0 &&
344
- preg_match("/^-+.*?(from|subject|to|date).*?/i", $line) == 0 &&
345
- preg_match("/^on.*?wrote:$/i", $line) == 0 &&
346
- preg_match("/^-+\s*forwarded\s*message\s*-+/i", $line) == 0) {
347
- $newContents.="$line\n";
 
 
 
 
 
 
 
348
  }
 
349
  }
350
- $content = $newContents;
351
  wp_delete_post($post_id);
352
  }
353
  } else {
@@ -2985,7 +2989,8 @@ function config_GetDefaults() {
2985
  'reply_as_comment' => true,
2986
  'force_user_login' => false,
2987
  'auto_gallery_link' => 'default',
2988
- 'ignore_mail_state' => false
 
2989
  );
2990
  }
2991
 
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1260699 2015-10-06 22:30:27Z WayneAllen $
4
  */
5
 
 
 
 
6
  class PostiePostModifiers {
7
 
8
  var $PostFormat = 'standard';
332
  } else {
333
  DebugEcho("Reply detected");
334
  $is_reply = true;
335
+ if (true == $config['strip_reply']) {
336
+ // strip out quoted content
337
+ $lines = explode("\n", $content);
338
+ $newContents = '';
339
+ foreach ($lines as $line) {
340
+ if (preg_match("/^>.*/i", $line) == 0 &&
341
+ preg_match("/^(from|subject|to|date):.*?/i", $line) == 0 &&
342
+ preg_match("/^-+.*?(from|subject|to|date).*?/i", $line) == 0 &&
343
+ preg_match("/^on.*?wrote:$/i", $line) == 0 &&
344
+ preg_match("/^-+\s*forwarded\s*message\s*-+/i", $line) == 0) {
345
+ $newContents.="$line\n";
346
+ }
347
+ }
348
+ if ((strlen($newContents) <> strlen($content)) && ('html' == $config['prefer_text_type'])) {
349
+ DebugEcho("Attempting to fix reply html (before): $newContents");
350
+ $newContents = LoadDOM($newContents)->__toString();
351
+ DebugEcho("Attempting to fix reply html (after): $newContents");
352
  }
353
+ $content = $newContents;
354
  }
 
355
  wp_delete_post($post_id);
356
  }
357
  } else {
2989
  'reply_as_comment' => true,
2990
  'force_user_login' => false,
2991
  'auto_gallery_link' => 'default',
2992
+ 'ignore_mail_state' => false,
2993
+ 'strip_reply' => true
2994
  );
2995
  }
2996
 
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
7
- Version: 1.7.15
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,12 +28,12 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1258512 2015-10-02 22:02:03Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
35
 
36
- define('POSTIE_VERSION', '1.7.15');
37
  define("POSTIE_ROOT", dirname(__FILE__));
38
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
39
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
7
+ Version: 1.7.16
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1261949 2015-10-08 20:05:58Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
35
 
36
+ define('POSTIE_VERSION', '1.7.16');
37
  define("POSTIE_ROOT", dirname(__FILE__));
38
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
39
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.3.1
9
- Stable tag: 1.7.15
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -235,6 +235,10 @@ All script, style and body tags are stripped from html emails.
235
  Attachments are now processed in the order they were attached.
236
 
237
  == CHANGELOG ==
 
 
 
 
238
  = 1.7.15 (2015-10-02) =
239
  * Completely replace linkify logic
240
  * Support youtu.be links
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.3.1
9
+ Stable tag: 1.7.16
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
235
  Attachments are now processed in the order they were attached.
236
 
237
  == CHANGELOG ==
238
+ = 1.7.16 (2015-10-08) =
239
+ * Ensure comments are valid html after striping if preferred text type is html
240
+ * Add setting to control comment content (strip_reply)
241
+
242
  = 1.7.15 (2015-10-02) =
243
  * Completely replace linkify logic
244
  * Support youtu.be links