Postie - Version 1.9.20

Version Description

(2018-04-11) = * Fix: Don't emit attachment div if there is no content after template generation

Download this release

Release Info

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

Code changes from version 1.9.19 to 1.9.20

Files changed (6) hide show
  1. docs/Changes.txt +3 -0
  2. docs/Postie.txt +1 -1
  3. postie-filters.php +7 -2
  4. postie.class.php +4 -2
  5. postie.php +3 -3
  6. readme.txt +4 -1
docs/Changes.txt CHANGED
@@ -35,6 +35,9 @@ 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.19 (2018-03-21) =
39
  * Fix: Recognize paragraph line ending in text mode for both styles
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.20 (2018-04-11) =
39
+ * Fix: Don't emit attachment div if there is no content after template generation
40
+
41
  = 1.9.19 (2018-03-21) =
42
  * Fix: Recognize paragraph line ending in text mode for both styles
43
 
docs/Postie.txt CHANGED
@@ -7,7 +7,7 @@ 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.19
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.9
10
+ Stable tag: 1.9.20
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
postie-filters.php CHANGED
@@ -26,6 +26,7 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
26
  DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['wp_filename']);
27
  } else {
28
  $template = $attachment['template'];
 
29
  if ($config['images_append']) {
30
  DebugEcho("filter_AttachmentTemplates: pre postie_place_media_after");
31
  $template = apply_filters('postie_place_media_after', $template, $attachment['wp_id']);
@@ -33,8 +34,9 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
33
  DebugEcho("filter_AttachmentTemplates: pre postie_place_media_before");
34
  $template = apply_filters('postie_place_media_before', $template, $attachment['wp_id']);
35
  }
36
- $template = mb_str_replace('{CAPTION}', '', $template);
37
  DebugEcho("filter_AttachmentTemplates: post filter '$template'");
 
 
38
  $html .= $template;
39
  }
40
  } else {
@@ -68,12 +70,15 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
68
  }
69
  }
70
 
71
- if (!empty($html)) {
 
72
  if ($config['images_append']) {
73
  $content = $content . '<div class="postie-attachments">' . $html . '</div>';
74
  } else {
75
  $content = '<div class="postie-attachments">' . $html . '</div>' . $content;
76
  }
 
 
77
  }
78
 
79
 
26
  DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['wp_filename']);
27
  } else {
28
  $template = $attachment['template'];
29
+ DebugEcho("filter_AttachmentTemplates: pre filter '$template'");
30
  if ($config['images_append']) {
31
  DebugEcho("filter_AttachmentTemplates: pre postie_place_media_after");
32
  $template = apply_filters('postie_place_media_after', $template, $attachment['wp_id']);
34
  DebugEcho("filter_AttachmentTemplates: pre postie_place_media_before");
35
  $template = apply_filters('postie_place_media_before', $template, $attachment['wp_id']);
36
  }
 
37
  DebugEcho("filter_AttachmentTemplates: post filter '$template'");
38
+ $template = mb_str_replace('{CAPTION}', '', $template);
39
+ DebugEcho("filter_AttachmentTemplates: post caption '$template'");
40
  $html .= $template;
41
  }
42
  } else {
70
  }
71
  }
72
 
73
+ if (!empty(trim($html))) {
74
+ DebugEcho("filter_AttachmentTemplates: attachments generated: $html");
75
  if ($config['images_append']) {
76
  $content = $content . '<div class="postie-attachments">' . $html . '</div>';
77
  } else {
78
  $content = '<div class="postie-attachments">' . $html . '</div>' . $content;
79
  }
80
+ } else {
81
+ DebugEcho("filter_AttachmentTemplates: no attachments generated");
82
  }
83
 
84
 
postie.class.php CHANGED
@@ -263,6 +263,7 @@ class Postie {
263
  }
264
 
265
  function parse_template($fileid, $type, $template, $orig_filename, $icon = "") {
 
266
  DebugEcho("parseTemplate: before '$template'");
267
 
268
  $attachment = get_post($fileid);
@@ -325,8 +326,9 @@ class Postie {
325
  $template = str_replace('{ICON}', $icon, $template);
326
  $template = str_replace('{FILEID}', $fileid, $template);
327
 
328
- DebugEcho("parseTemplate: after: '$template<br />'");
329
- return $template . '<br />';
 
330
  } else {
331
  EchoError("parseTemplate: couldn't get attachment $fileid");
332
  return '';
263
  }
264
 
265
  function parse_template($fileid, $type, $template, $orig_filename, $icon = "") {
266
+ $template = trim($template);
267
  DebugEcho("parseTemplate: before '$template'");
268
 
269
  $attachment = get_post($fileid);
326
  $template = str_replace('{ICON}', $icon, $template);
327
  $template = str_replace('{FILEID}', $fileid, $template);
328
 
329
+ $template = $template . (empty($template) ? '' : '<br />');
330
+ DebugEcho("parseTemplate: after: '$template'");
331
+ return $template;
332
  } else {
333
  EchoError("parseTemplate: couldn't get attachment $fileid");
334
  return '';
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.19
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1844621 2018-03-22 02:48:40Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.19');
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.20
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1856562 2018-04-11 15:21:57Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.20');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ 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.19
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -107,6 +107,9 @@ 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.19 (2018-03-21) =
111
  * Fix: Recognize paragraph line ending in text mode for both styles
112
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.9
10
+ Stable tag: 1.9.20
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.20 (2018-04-11) =
111
+ * Fix: Don't emit attachment div if there is no content after template generation
112
+
113
  = 1.9.19 (2018-03-21) =
114
  * Fix: Recognize paragraph line ending in text mode for both styles
115