Postie - Version 1.8.21

Version Description

(2016-12-07) = * Clarified the behavior of the "Use custom image field for images" setting and moved it to the Image tab. * Clarified text on some settings. * Fix bug which prevented captions from working correctly * Fix bug which prevented more than 9 #img# references from working. * Account for unicode non-breaking spaces in regular expressions.

Download this release

Release Info

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

Code changes from version 1.8.20 to 1.8.21

config_form_attachments.php CHANGED
@@ -84,7 +84,7 @@
84
  ?>
85
  </select>
86
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
87
- <p class='description'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></p>
88
 
89
  <div style="margin-top: 10px; font-weight: bold;">
90
  <?php _e('Preview', 'postie'); ?>
@@ -96,6 +96,5 @@
96
  name='postie-settings[generaltemplate]'><?php echo esc_attr($generaltemplate) ?></textarea>
97
  </td>
98
  </tr>
99
- <?php echo BuildBooleanSelect(__("Use custom image field for attachments", 'postie'), "postie-settings[custom_image_field]", $custom_image_field, __("When set to 'Yes' no attachments will appear in the post (including images, video &amp; sound files). Instead the url to the attachment will be put into a custom field named 'image'. Your theme will need logic to display these attachments", 'postie')); ?>
100
  </table>
101
  </div>
84
  ?>
85
  </select>
86
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
87
+ <p class='description'><?php _e('Note that this template are only used if the attachment is not "inline" or if the email type is "plain"', 'postie'); ?></p>
88
 
89
  <div style="margin-top: 10px; font-weight: bold;">
90
  <?php _e('Preview', 'postie'); ?>
96
  name='postie-settings[generaltemplate]'><?php echo esc_attr($generaltemplate) ?></textarea>
97
  </td>
98
  </tr>
 
99
  </table>
100
  </div>
config_form_image.php CHANGED
@@ -9,6 +9,7 @@
9
  echo BuildBooleanSelect(__("Image Location", 'postie'), "postie-settings[images_append]", $images_append, __("Location of attachments if using 'plain' format. Before or After content. For 'html' content this will only affect attachments that are not inline.", 'postie'), array('After', 'Before'));
10
  echo BuildBooleanSelect(__("Generate Thumbnails", 'postie'), "postie-settings[generate_thumbnails]", $generate_thumbnails, __("Some hosts crash during thumbnail generation. Set this to 'No' if you have this issue", 'postie'));
11
  echo BuildBooleanSelect(__("Start Image Count At", 'postie'), "postie-settings[start_image_count_at_zero]", $start_image_count_at_zero, __('For use if using "Image Place Holder Tag" below.', 'postie'), array('Start at 0', 'Start at 1'));
 
12
  ?>
13
  <tr>
14
  <th scope="row"><?php _e('Image Place Holder Tag', 'postie') ?></th>
@@ -24,7 +25,7 @@
24
  value="<?php echo esc_attr($selected_imagetemplate) ?>" />
25
  <select name='imagetemplateselect' id='imagetemplateselect'
26
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
27
- 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
28
  <?php
29
  include(POSTIE_ROOT . '/templates/image_templates.php');
30
  $styleOptions = $imageTemplates;
@@ -50,8 +51,8 @@
50
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
51
  <div id='imageTemplatePreview'></div>
52
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
53
- "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
54
- <?php echo esc_attr($imagetemplate) ?>
55
  </textarea>
56
  <div class='recommendation'>
57
  <ul>
9
  echo BuildBooleanSelect(__("Image Location", 'postie'), "postie-settings[images_append]", $images_append, __("Location of attachments if using 'plain' format. Before or After content. For 'html' content this will only affect attachments that are not inline.", 'postie'), array('After', 'Before'));
10
  echo BuildBooleanSelect(__("Generate Thumbnails", 'postie'), "postie-settings[generate_thumbnails]", $generate_thumbnails, __("Some hosts crash during thumbnail generation. Set this to 'No' if you have this issue", 'postie'));
11
  echo BuildBooleanSelect(__("Start Image Count At", 'postie'), "postie-settings[start_image_count_at_zero]", $start_image_count_at_zero, __('For use if using "Image Place Holder Tag" below.', 'postie'), array('Start at 0', 'Start at 1'));
12
+ echo BuildBooleanSelect(__("Use custom image field for images", 'postie'), "postie-settings[custom_image_field]", $custom_image_field, __("When set to 'Yes' no images will appear in the post (other attachment types will be processed normally). Instead the url to the attachment will be put into a custom field named 'image'. Your theme will need logic to display these attachments", 'postie'));
13
  ?>
14
  <tr>
15
  <th scope="row"><?php _e('Image Place Holder Tag', 'postie') ?></th>
25
  value="<?php echo esc_attr($selected_imagetemplate) ?>" />
26
  <select name='imagetemplateselect' id='imagetemplateselect'
27
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
28
+ 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
29
  <?php
30
  include(POSTIE_ROOT . '/templates/image_templates.php');
31
  $styleOptions = $imageTemplates;
51
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
52
  <div id='imageTemplatePreview'></div>
53
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
54
+ "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
55
+ <?php echo esc_attr($imagetemplate) ?>
56
  </textarea>
57
  <div class='recommendation'>
58
  <ul>
config_form_server.php CHANGED
@@ -10,7 +10,7 @@
10
  <option value="curl" <?php echo ($input_connection == "curl") ? "selected='selected' " : "" ?>>cURL</option>
11
  <?php } ?>
12
  </select>
13
- <p class='description'><?php _e("Sockets is prefered, but doesn't work with some hosts.", 'postie'); ?></p>
14
  </td>
15
  </tr>
16
 
10
  <option value="curl" <?php echo ($input_connection == "curl") ? "selected='selected' " : "" ?>>cURL</option>
11
  <?php } ?>
12
  </select>
13
+ <p class='description'><?php _e("Sockets is preferred, but doesn't work with some hosts.", 'postie'); ?></p>
14
  </td>
15
  </tr>
16
 
config_form_video.php CHANGED
@@ -1,8 +1,5 @@
1
  <div id="simpleTabs-content-5" class="simpleTabs-content">
2
  <table class='form-table'>
3
- <?php
4
- //echo BuildBooleanSelect(__("Use shortcode for embedding video (youtube or vimeo)", 'postie'), "postie-settings[shortcode]", $shortcode, "Only change this value to 'Yes' if you have another plugin that will process the shortcode.");
5
- ?>
6
  <tr>
7
  <th scope='row'><?php _e('Video template 1', 'postie') ?></th>
8
  <?php $templateDir = esc_url(plugins_url() . '/postie/templates'); ?>
@@ -32,7 +29,7 @@
32
  ?>
33
  </select>
34
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
35
- <p class='description'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></p>
36
 
37
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
38
  <div id='video1TemplatePreview'></div>
@@ -57,8 +54,7 @@
57
  <input type='hidden' id='postie-settings-selected_video2template' name='postie-settings[selected_video2template]'
58
  value="<?php echo esc_attr($selected_video2template) ?>" />
59
  <select name='video2templateselect' id='video2templateselect'
60
- onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
61
- 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
62
  <?php
63
  include(POSTIE_ROOT . '/templates/video2_templates.php');
64
  $styleOptions = $video2Templates;
@@ -79,7 +75,7 @@
79
  ?>
80
  </select>
81
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
82
- <p class='description'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></p>
83
 
84
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
85
  <div id='video2TemplatePreview'></div>
@@ -106,8 +102,7 @@
106
  <input type='hidden' id='postie-settings-selected_audiotemplate' name='postie-settings[selected_audiotemplate]'
107
  value="<?php echo esc_attr($selected_audiotemplate) ?>" />
108
  <select name='audiotemplateselect' id='audiotemplateselect'
109
- onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
110
- 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
111
  <?php
112
  include(POSTIE_ROOT . '/templates/audio_templates.php');
113
  $styleOptions = $audioTemplates;
@@ -133,9 +128,8 @@
133
 
134
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
135
  <div id='audioTemplatePreview'></div>
136
- <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
137
- 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
138
- name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
139
  </td>
140
  </tr>
141
  <tr>
1
  <div id="simpleTabs-content-5" class="simpleTabs-content">
2
  <table class='form-table'>
 
 
 
3
  <tr>
4
  <th scope='row'><?php _e('Video template 1', 'postie') ?></th>
5
  <?php $templateDir = esc_url(plugins_url() . '/postie/templates'); ?>
29
  ?>
30
  </select>
31
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
32
+ <p class='description'><?php _e('Note that this template are only used if the video is not "inline" or the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></p>
33
 
34
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
35
  <div id='video1TemplatePreview'></div>
54
  <input type='hidden' id='postie-settings-selected_video2template' name='postie-settings[selected_video2template]'
55
  value="<?php echo esc_attr($selected_video2template) ?>" />
56
  <select name='video2templateselect' id='video2templateselect'
57
+ onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template','video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
 
58
  <?php
59
  include(POSTIE_ROOT . '/templates/video2_templates.php');
60
  $styleOptions = $video2Templates;
75
  ?>
76
  </select>
77
  <p class='description'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></p>
78
+ <p class='description'><?php _e('Note that this template are only used if the video is not "inline" or the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></p>
79
 
80
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
81
  <div id='video2TemplatePreview'></div>
102
  <input type='hidden' id='postie-settings-selected_audiotemplate' name='postie-settings[selected_audiotemplate]'
103
  value="<?php echo esc_attr($selected_audiotemplate) ?>" />
104
  <select name='audiotemplateselect' id='audiotemplateselect'
105
+ onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
 
106
  <?php
107
  include(POSTIE_ROOT . '/templates/audio_templates.php');
108
  $styleOptions = $audioTemplates;
128
 
129
  <div style="margin-top: 10px; font-weight: bold;"><?php _e('Preview', 'postie'); ?></div>
130
  <div id='audioTemplatePreview'></div>
131
+ <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);"
132
+ cols='70' rows='7' id='postie-settings-audiotemplate' name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
 
133
  </td>
134
  </tr>
135
  <tr>
docs/Changes.txt CHANGED
@@ -32,6 +32,13 @@ All script, style and body tags are stripped from html emails.
32
  Attachments are now processed in the order they were attached.
33
 
34
  == CHANGELOG ==
 
 
 
 
 
 
 
35
  = 1.8.20 (2016-11-21) =
36
  * Fix issue where attachment with Content-ID doesn't have a reference in the html not being added to the post.
37
 
32
  Attachments are now processed in the order they were attached.
33
 
34
  == CHANGELOG ==
35
+ = 1.8.21 (2016-12-07) =
36
+ * Clarified the behavior of the "Use custom image field for images" setting and moved it to the Image tab.
37
+ * Clarified text on some settings.
38
+ * Fix bug which prevented captions from working correctly
39
+ * Fix bug which prevented more than 9 #img# references from working.
40
+ * Account for unicode non-breaking spaces in regular expressions.
41
+
42
  = 1.8.20 (2016-11-21) =
43
  * Fix issue where attachment with Content-ID doesn't have a reference in the html not being added to the post.
44
 
docs/Postie.txt CHANGED
@@ -5,19 +5,18 @@ Author URI: http://allens-home.com/
5
  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.6.1
9
- Stable tag: 1.8.20
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  Postie allows you to create posts via email, including many advanced features not found in WordPress's default Post by Email feature.
14
 
15
  == Description ==
16
- Postie offers many advanced features for creating posts by email,
17
- including the ability to assign categories by name, included pictures and
18
- videos, and automatically strip off signatures. It also has support for both
19
- IMAP and POP3, with the option for ssl with both. For usage notes, see the
20
- [other notes](other_notes) page
21
 
22
  More info at http://PostiePlugin.com/
23
 
5
  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.7
9
+ Stable tag: 1.8.21
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  Postie allows you to create posts via email, including many advanced features not found in WordPress's default Post by Email feature.
14
 
15
  == Description ==
16
+ Postie offers many advanced features for creating posts by email, including the ability to assign categories by name, included pictures and videos, and automatically strip off signatures.
17
+ Postie supports both IMAP and POP including SSL/TLS.
18
+ There is also an extensive set of filters/actions for developers to extend Postie's functionality.
19
+ For usage notes, see the [other notes](other_notes) page.
 
20
 
21
  More info at http://PostiePlugin.com/
22
 
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1537852 2016-11-21 20:20:38Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -163,7 +163,7 @@ function tag_Date(&$content, $message_date) {
163
  foreach ($es as $e) {
164
  //DebugEcho("tag_Date: " . trim($e->plaintext));
165
  $matches = array();
166
- if (1 === preg_match("/^date:\s?(.*)$/im", trim($e->plaintext), $matches)) {
167
  $possibledate = trim($matches[1]);
168
  DebugEcho("tag_Date: found date tag $matches[1]");
169
  $newdate = strtotime($possibledate);
@@ -203,7 +203,7 @@ function tag_CustomImageField($post_ID, $email, $config) {
203
  function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config) {
204
 
205
  $matches = array();
206
- $addimages = !($config['custom_image_field'] || $config['auto_gallery'] || preg_match("/\[gallery[^\[]*\]/", $content, $matches));
207
  $fiid = -1;
208
 
209
  DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
@@ -434,10 +434,10 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
434
  $newContents = '';
435
  foreach ($lines as $line) {
436
  if (preg_match("/^>.*/i", $line) == 0 &&
437
- preg_match("/^(from|subject|to|date):.*?/i", $line) == 0 &&
438
- preg_match("/^-+.*?(from|subject|to|date).*?/i", $line) == 0 &&
439
- preg_match("/^on.*?wrote:$/i", $line) == 0 &&
440
- preg_match("/^-+\s*forwarded\s*message\s*-+/i", $line) == 0) {
441
  $newContents .= "$line\n";
442
  }
443
  }
@@ -517,7 +517,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
517
  'post_category' => $post_categories,
518
  'tags_input' => $post_tags,
519
  'comment_status' => $comment_status,
520
- 'post_name' => sanitize_title($subject),
521
  'post_excerpt' => $post_excerpt,
522
  'ID' => $id,
523
  'post_status' => $post_status
@@ -552,7 +552,6 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
552
  DebugEcho(("Post postie_post filter"));
553
  DebugDump($details);
554
 
555
-
556
  if (empty($details)) {
557
  // It is possible that the filter has removed the post, in which case, it should not be posted.
558
  // And if we created a placeholder post (because this was not a reply to an existing post),
@@ -686,12 +685,12 @@ function postie_get_parent_post(&$subject) {
686
  DebugEcho("GetParentPostForReply: Looking for parent '$subject'");
687
  // see if subject starts with Re:
688
  $matches = array();
689
- if (preg_match("/(^Re:)(.*)/i", $subject, $matches)) {
690
  DebugEcho("GetParentPostForReply: Re: detected");
691
  $subject = trim($matches[2]);
692
  // strip out category info into temporary variable
693
  $tmpSubject = $subject;
694
- if (preg_match('/(.+): (.*)/', $tmpSubject, $matches)) {
695
  $tmpSubject = trim($matches[2]);
696
  $matches[1] = array($matches[1]);
697
  } else if (preg_match_all('/\[(.[^\[]*)\]/', $tmpSubject, $matches)) {
@@ -1268,7 +1267,7 @@ function filter_RemoveSignature($content, $config) {
1268
  }
1269
  //DebugEcho("looking for signature in: $content");
1270
 
1271
- $pattern = '/^(' . implode('|', $config['sig_pattern_list']) . ')\s?$/mi';
1272
  DebugEcho("filter_RemoveSignature: pattern: $pattern");
1273
 
1274
  $html = LoadDOM($content);
@@ -1403,7 +1402,7 @@ function tag_AllowCommentsOnPost(&$content) {
1403
  $comments_allowed = get_option('default_comment_status'); // 'open' or 'closed'
1404
 
1405
  $matches = array();
1406
- if (preg_match("/comments:([0|1|2])/i", $content, $matches)) {
1407
  $content = preg_replace("/comments:$matches[1]/i", "", $content);
1408
  if ($matches[1] == "1") {
1409
  $comments_allowed = "open";
@@ -1419,7 +1418,7 @@ function tag_AllowCommentsOnPost(&$content) {
1419
  function tag_Status(&$content, $currentstatus) {
1420
  $poststatus = $currentstatus;
1421
  $matches = array();
1422
- if (preg_match("/status:\s*(draft|publish|pending|private|future)/i", $content, $matches)) {
1423
  DebugEcho("tag_Status: found status $matches[1]");
1424
  DebugDump($matches);
1425
  $content = preg_replace("/$matches[0]/i", "", $content);
@@ -1432,21 +1431,21 @@ function tag_Delay(&$content, $message_date = NULL, $offset = 0) {
1432
  DebugEcho("tag_Delay: $content");
1433
  $delay = 0;
1434
  $matches = array();
1435
- if (preg_match("/delay:(-?[0-9dhm]+)/i", $content, $matches) && trim($matches[1])) {
1436
  DebugEcho("tag_Delay: found delay: " . $matches[1]);
1437
  $days = 0;
1438
  $hours = 0;
1439
  $minutes = 0;
1440
  $dayMatches = array();
1441
- if (preg_match("/(-?[0-9]+)d/i", $matches[1], $dayMatches)) {
1442
  $days = $dayMatches[1];
1443
  }
1444
  $hourMatches = array();
1445
- if (preg_match("/(-?[0-9]+)h/i", $matches[1], $hourMatches)) {
1446
  $hours = $hourMatches[1];
1447
  }
1448
  $minuteMatches = array();
1449
- if (preg_match("/(-?[0-9]+)m/i", $matches[1], $minuteMatches)) {
1450
  $minutes = $minuteMatches[1];
1451
  }
1452
  $delay = (($days * 24 + $hours) * 60 + $minutes) * 60;
@@ -2021,7 +2020,6 @@ function parseTemplate($fileid, $type, $template, $orig_filename, $icon = "") {
2021
  $template = str_replace('{RELFILENAME}', $relFileName, $template);
2022
  $template = str_replace('{ICON}', $icon, $template);
2023
  $template = str_replace('{FILEID}', $fileid, $template);
2024
- //$template = str_replace('{CAPTION}', '', $template);
2025
 
2026
  DebugEcho("parseTemplate: after: '$template<br />'");
2027
  return $template . '<br />';
@@ -2121,50 +2119,31 @@ function filter_ReplaceImagePlaceHolders_worker($content, &$attachment, $imagePa
2121
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: no template");
2122
  return;
2123
  }
2124
- $imageTemplate = $attachment['template'];
2125
-
2126
- // looks for ' #img1# ' etc... and replaces with image
2127
- $img_placeholder_temp0 = rtrim(str_replace("%", intval($startIndex + $currentIndex), $imagePattern), '#');
2128
 
2129
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: img_placeholder_temp0: $img_placeholder_temp0");
2130
- if (stristr($content, $img_placeholder_temp0)) {
 
 
 
 
 
2131
  $attachment['exclude'] = true;
2132
- while (stristr($content, $img_placeholder_temp0)) {
2133
- // look for caption
2134
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: Found $img_placeholder_temp0");
2135
- $caption = '';
2136
- $img_placeholder_temp = $img_placeholder_temp0;
2137
- $matches = array();
2138
- if (preg_match("/$img_placeholder_temp caption=(.*?)#/i", $content, $matches)) {
2139
- //DebugDump($matches);
2140
- $caption = trim($matches[1]);
2141
- if (strlen($caption) > 2 && ($caption[0] == "'" || $caption[0] == '"')) {
2142
- $caption = substr($caption, 1, strlen($caption) - 2);
2143
- }
2144
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: caption: $caption");
2145
-
2146
- // if (count($images) > $i) {
2147
- // DebugEcho("filter_ReplaceImagePlaceHolders_worker: Adding alt text to image {$images[$i]->ID}");
2148
- // update_post_meta($images[$i]->ID, '_wp_attachment_image_alt', $caption);
2149
- // }
2150
 
2151
- $img_placeholder_temp = substr($matches[0], 0, -1);
2152
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: $img_placeholder_temp");
2153
- } else {
2154
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: No caption found");
2155
- }
2156
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: parameterize templete: $imageTemplate");
2157
- $imageTemplate = mb_str_replace('{CAPTION}', htmlspecialchars($caption, ENT_QUOTES), $imageTemplate);
2158
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: captioned template: $imageTemplate");
2159
-
2160
- $img_placeholder_temp .= '#';
2161
 
2162
- $imageTemplate = apply_filters('postie_place_media', $imageTemplate, $attachment['wp_id']);
2163
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: post filter: '$imageTemplate'");
2164
 
2165
- $content = str_ireplace($img_placeholder_temp, $imageTemplate, $content);
2166
- DebugEcho("filter_ReplaceImagePlaceHolders_worker: post replace: $content");
2167
- }
2168
  }
2169
  return $content;
2170
  }
@@ -2213,9 +2192,9 @@ function tag_Tags(&$content, $defaultTags, $isHtml) {
2213
  $post_tags = array();
2214
 
2215
  $matches = array();
2216
- $rx = '/>\s*tags:\s?(.*?)</is';
2217
  if (!$isHtml) {
2218
- $rx = '/tags:\s?(.*)/i';
2219
  }
2220
  if (preg_match($rx, $content, $matches)) {
2221
  if (!empty($matches[1])) {
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1547970 2016-12-07 19:11:20Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
163
  foreach ($es as $e) {
164
  //DebugEcho("tag_Date: " . trim($e->plaintext));
165
  $matches = array();
166
+ if (1 === preg_match("/^date:\s?(.*)$/imu", trim($e->plaintext), $matches)) {
167
  $possibledate = trim($matches[1]);
168
  DebugEcho("tag_Date: found date tag $matches[1]");
169
  $newdate = strtotime($possibledate);
203
  function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config) {
204
 
205
  $matches = array();
206
+ $addimages = !($config['custom_image_field'] || $config['auto_gallery'] || preg_match("/\[gallery[^\[]*\]/u", $content, $matches));
207
  $fiid = -1;
208
 
209
  DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
434
  $newContents = '';
435
  foreach ($lines as $line) {
436
  if (preg_match("/^>.*/i", $line) == 0 &&
437
+ preg_match("/^(from|subject|to|date):.*?/iu", $line) == 0 &&
438
+ preg_match("/^-+.*?(from|subject|to|date).*?/iu", $line) == 0 &&
439
+ preg_match("/^on.*?wrote:$/iu", $line) == 0 &&
440
+ preg_match("/^-+\s*forwarded\s*message\s*-+/iu", $line) == 0) {
441
  $newContents .= "$line\n";
442
  }
443
  }
517
  'post_category' => $post_categories,
518
  'tags_input' => $post_tags,
519
  'comment_status' => $comment_status,
520
+ 'post_name' => $subject,
521
  'post_excerpt' => $post_excerpt,
522
  'ID' => $id,
523
  'post_status' => $post_status
552
  DebugEcho(("Post postie_post filter"));
553
  DebugDump($details);
554
 
 
555
  if (empty($details)) {
556
  // It is possible that the filter has removed the post, in which case, it should not be posted.
557
  // And if we created a placeholder post (because this was not a reply to an existing post),
685
  DebugEcho("GetParentPostForReply: Looking for parent '$subject'");
686
  // see if subject starts with Re:
687
  $matches = array();
688
+ if (preg_match("/(^Re:)(.*)/iu", $subject, $matches)) {
689
  DebugEcho("GetParentPostForReply: Re: detected");
690
  $subject = trim($matches[2]);
691
  // strip out category info into temporary variable
692
  $tmpSubject = $subject;
693
+ if (preg_match('/(.+): (.*)/u', $tmpSubject, $matches)) {
694
  $tmpSubject = trim($matches[2]);
695
  $matches[1] = array($matches[1]);
696
  } else if (preg_match_all('/\[(.[^\[]*)\]/', $tmpSubject, $matches)) {
1267
  }
1268
  //DebugEcho("looking for signature in: $content");
1269
 
1270
+ $pattern = '/^(' . implode('|', $config['sig_pattern_list']) . ')\s?$/miu';
1271
  DebugEcho("filter_RemoveSignature: pattern: $pattern");
1272
 
1273
  $html = LoadDOM($content);
1402
  $comments_allowed = get_option('default_comment_status'); // 'open' or 'closed'
1403
 
1404
  $matches = array();
1405
+ if (preg_match("/comments:([0|1|2])/iu", $content, $matches)) {
1406
  $content = preg_replace("/comments:$matches[1]/i", "", $content);
1407
  if ($matches[1] == "1") {
1408
  $comments_allowed = "open";
1418
  function tag_Status(&$content, $currentstatus) {
1419
  $poststatus = $currentstatus;
1420
  $matches = array();
1421
+ if (preg_match("/status:\s*(draft|publish|pending|private|future)/iu", $content, $matches)) {
1422
  DebugEcho("tag_Status: found status $matches[1]");
1423
  DebugDump($matches);
1424
  $content = preg_replace("/$matches[0]/i", "", $content);
1431
  DebugEcho("tag_Delay: $content");
1432
  $delay = 0;
1433
  $matches = array();
1434
+ if (preg_match("/delay:(-?[0-9dhm]+)/iu", $content, $matches) && trim($matches[1])) {
1435
  DebugEcho("tag_Delay: found delay: " . $matches[1]);
1436
  $days = 0;
1437
  $hours = 0;
1438
  $minutes = 0;
1439
  $dayMatches = array();
1440
+ if (preg_match("/(-?[0-9]+)d/iu", $matches[1], $dayMatches)) {
1441
  $days = $dayMatches[1];
1442
  }
1443
  $hourMatches = array();
1444
+ if (preg_match("/(-?[0-9]+)h/iu", $matches[1], $hourMatches)) {
1445
  $hours = $hourMatches[1];
1446
  }
1447
  $minuteMatches = array();
1448
+ if (preg_match("/(-?[0-9]+)m/iu", $matches[1], $minuteMatches)) {
1449
  $minutes = $minuteMatches[1];
1450
  }
1451
  $delay = (($days * 24 + $hours) * 60 + $minutes) * 60;
2020
  $template = str_replace('{RELFILENAME}', $relFileName, $template);
2021
  $template = str_replace('{ICON}', $icon, $template);
2022
  $template = str_replace('{FILEID}', $fileid, $template);
 
2023
 
2024
  DebugEcho("parseTemplate: after: '$template<br />'");
2025
  return $template . '<br />';
2119
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: no template");
2120
  return;
2121
  }
 
 
 
 
2122
 
2123
+ $matches = array();
2124
+ $pattern = '/#img' . (string) ($startIndex + $currentIndex) . '\s?(caption=[\'"]?(.*?)[\'"]?)?#/iu';
2125
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: pattern: $pattern");
2126
+ preg_match_all($pattern, $content, $matches, PREG_SET_ORDER);
2127
+ //DebugEcho($content);
2128
+ DebugDump($matches);
2129
+ foreach ($matches as $match) {
2130
  $attachment['exclude'] = true;
2131
+ $imageTemplate = $attachment['template'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2132
 
2133
+ $caption = '';
2134
+ if (count($match) > 2) {
2135
+ $caption = trim($match[2]);
2136
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: caption: '$caption'");
2137
+ }
2138
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: parameterize templete: $imageTemplate");
2139
+ $imageTemplate = mb_str_replace('{CAPTION}', htmlspecialchars($caption, ENT_QUOTES), $imageTemplate);
2140
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: captioned template: $imageTemplate");
 
 
2141
 
2142
+ $imageTemplate = apply_filters('postie_place_media', $imageTemplate, $attachment['wp_id']);
2143
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: post filter: '$imageTemplate'");
2144
 
2145
+ $content = str_ireplace($match[0], $imageTemplate, $content);
2146
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: post replace: $content");
 
2147
  }
2148
  return $content;
2149
  }
2192
  $post_tags = array();
2193
 
2194
  $matches = array();
2195
+ $rx = '/>\s*tags:\s?(.*?)</isu';
2196
  if (!$isHtml) {
2197
+ $rx = '/tags:\s?(.*)/iu';
2198
  }
2199
  if (preg_match($rx, $content, $matches)) {
2200
  if (!empty($matches[1])) {
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.8.20
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1537856 2016-11-21 20:24:30Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
@@ -49,7 +49,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/pPop3MailServer.php"
49
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
 
52
- define('POSTIE_VERSION', '1.8.20');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
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.8.21
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1547974 2016-12-07 19:12:46Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
49
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
50
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
51
 
52
+ define('POSTIE_VERSION', '1.8.21');
53
  define("POSTIE_ROOT", dirname(__FILE__));
54
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
55
 
readme.txt CHANGED
@@ -5,19 +5,18 @@ Author URI: http://allens-home.com/
5
  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.6.1
9
- Stable tag: 1.8.20
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  Postie allows you to create posts via email, including many advanced features not found in WordPress's default Post by Email feature.
14
 
15
  == Description ==
16
- Postie offers many advanced features for creating posts by email,
17
- including the ability to assign categories by name, included pictures and
18
- videos, and automatically strip off signatures. It also has support for both
19
- IMAP and POP3, with the option for ssl with both. For usage notes, see the
20
- [other notes](other_notes) page
21
 
22
  More info at http://PostiePlugin.com/
23
 
@@ -240,6 +239,13 @@ All script, style and body tags are stripped from html emails.
240
  Attachments are now processed in the order they were attached.
241
 
242
  == CHANGELOG ==
 
 
 
 
 
 
 
243
  = 1.8.20 (2016-11-21) =
244
  * Fix issue where attachment with Content-ID doesn't have a reference in the html not being added to the post.
245
 
5
  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.7
9
+ Stable tag: 1.8.21
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
  Postie allows you to create posts via email, including many advanced features not found in WordPress's default Post by Email feature.
14
 
15
  == Description ==
16
+ Postie offers many advanced features for creating posts by email, including the ability to assign categories by name, included pictures and videos, and automatically strip off signatures.
17
+ Postie supports both IMAP and POP including SSL/TLS.
18
+ There is also an extensive set of filters/actions for developers to extend Postie's functionality.
19
+ For usage notes, see the [other notes](other_notes) page.
 
20
 
21
  More info at http://PostiePlugin.com/
22
 
239
  Attachments are now processed in the order they were attached.
240
 
241
  == CHANGELOG ==
242
+ = 1.8.21 (2016-12-07) =
243
+ * Clarified the behavior of the "Use custom image field for images" setting and moved it to the Image tab.
244
+ * Clarified text on some settings.
245
+ * Fix bug which prevented captions from working correctly
246
+ * Fix bug which prevented more than 9 #img# references from working.
247
+ * Account for unicode non-breaking spaces in regular expressions.
248
+
249
  = 1.8.20 (2016-11-21) =
250
  * Fix issue where attachment with Content-ID doesn't have a reference in the html not being added to the post.
251