Postie - Version 1.8.45

Version Description

(2017-06-21) = * Feature: If image placement directive has a caption, update the image metadata to include the caption. * Fix: Only process delay tag if date was found in header * Fix: Date tag overrides header and no offsets are applied * Fix: Check for term slug as well as name

Download this release

Release Info

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

Code changes from version 1.8.44 to 1.8.45

Files changed (5) hide show
  1. docs/Changes.txt +8 -2
  2. docs/Postie.txt +1 -1
  3. postie-functions.php +29 -20
  4. postie.php +3 -3
  5. readme.txt +9 -3
docs/Changes.txt CHANGED
@@ -35,10 +35,16 @@ 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.8.44 (2017-06-14) =
39
  * Ensure only users from current site are validated.
40
- * Process newlines earlier in process
41
- * WordPress 4.8 compatibility testing
42
 
43
  = 1.8.43 (2017-05-10) =
44
  * Fix "postie-attachments" div to wrap the right content
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.8.45 (2017-06-21) =
39
+ * Feature: If image placement directive has a caption, update the image metadata to include the caption.
40
+ * Fix: Only process delay tag if date was found in header
41
+ * Fix: Date tag overrides header and no offsets are applied
42
+ * Fix: Check for term slug as well as name
43
+
44
  = 1.8.44 (2017-06-14) =
45
  * Ensure only users from current site are validated.
46
+ * Process newlines earlier in process.
47
+ * WordPress 4.8 compatibility testing.
48
 
49
  = 1.8.43 (2017-05-10) =
50
  * Fix "postie-attachments" div to wrap the right content
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.8
9
- Stable tag: 1.8.44
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.8
9
+ Stable tag: 1.8.45
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- $Id: postie-functions.php 1678569 2017-06-14 16:42:23Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
@@ -393,22 +393,22 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
393
 
394
  $content = filter_Newlines($content, $config);
395
  if ($fulldebug) {
396
- DebugEcho("post newline: $content");
397
  }
398
 
399
  $content = filter_RemoveSignature($content, $config);
400
  if ($fulldebug) {
401
- DebugEcho("post sig: $content");
402
  }
403
 
404
  $post_excerpt = tag_Excerpt($content, $config);
405
  if ($fulldebug) {
406
- DebugEcho("post excerpt: $content");
407
  }
408
 
409
  $postAuthorDetails = postie_getPostAuthorDetails($mimeDecodedEmail);
410
  if ($fulldebug) {
411
- DebugEcho("post author: $content");
412
  }
413
 
414
  $message_date = NULL;
@@ -420,23 +420,26 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
420
  } else {
421
  $message_date = $mimeDecodedEmail['headers']['date'];
422
  DebugEcho("decoded date: $message_date");
 
 
 
 
423
  }
424
  } else {
425
  DebugEcho("date header missing");
426
  $message_date = current_time('mysql');
427
  }
428
 
429
- $message_date = tag_Date($content, $message_date);
430
-
431
- list($post_date, $delay) = tag_Delay($content, $message_date, $config);
432
  if ($fulldebug) {
433
- DebugEcho("post date: $content");
434
  }
435
 
 
436
  //do post type before category to keep the subject line correct
437
  $post_type = tag_PostType($subject, $postmodifiers, $config);
438
  if ($fulldebug) {
439
- DebugEcho("post type: $content");
440
  }
441
 
442
  $default_categoryid = $config['default_post_category'];
@@ -447,34 +450,34 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
447
 
448
  $post_categories = tag_Categories($subject, $default_categoryid, $config, $post_id);
449
  if ($fulldebug) {
450
- DebugEcho("post category: $content");
451
  }
452
 
453
  $post_tags = tag_Tags($content, $config['default_post_tags'], 'html' == $config['prefer_text_type']);
454
  if ($fulldebug) {
455
- DebugEcho("post tag: $content");
456
  }
457
 
458
  $comment_status = tag_AllowCommentsOnPost($content);
459
  if ($fulldebug) {
460
- DebugEcho("post comment: $content");
461
  }
462
 
463
  $post_status = tag_Status($content, $config['post_status']);
464
  if ($fulldebug) {
465
- DebugEcho("post status: $content");
466
  }
467
 
468
  //handle CID before linkify
469
  $content = filter_ReplaceImageCIDs($content, $mimeDecodedEmail);
470
  if ($fulldebug) {
471
- DebugEcho("post cid: $content");
472
  }
473
 
474
  if ($config['converturls']) {
475
  $content = filter_Linkify($content);
476
  if ($fulldebug) {
477
- DebugEcho("post linkify: $content");
478
  }
479
  }
480
 
@@ -521,17 +524,17 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
521
 
522
  $content = filter_Start($content, $config);
523
  if ($fulldebug) {
524
- DebugEcho("post start: $content");
525
  }
526
 
527
  $content = filter_End($content, $config);
528
  if ($fulldebug) {
529
- DebugEcho("post end: $content");
530
  }
531
 
532
  $content = filter_ReplaceImagePlaceHolders($content, $mimeDecodedEmail, $config, $id, $config['image_placeholder']);
533
  if ($fulldebug) {
534
- DebugEcho("post body ReplaceImagePlaceHolders: $content");
535
  }
536
 
537
  if ($post_excerpt) {
@@ -2134,6 +2137,12 @@ function filter_ReplaceImagePlaceHolders_worker($content, &$attachment, $imagePa
2134
  $imageTemplate = mb_str_replace('{CAPTION}', htmlspecialchars($caption, ENT_QUOTES), $imageTemplate);
2135
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: captioned template: $imageTemplate");
2136
 
 
 
 
 
 
 
2137
  $imageTemplate = apply_filters('postie_place_media', $imageTemplate, $attachment['wp_id']);
2138
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: post postie_place_media: '$imageTemplate'");
2139
 
@@ -2349,7 +2358,7 @@ function postie_lookup_category_id($trial_category, $category_match = true) {
2349
  $found_category = NULL;
2350
  if ($category_match) {
2351
  DebugEcho("category wildcard lookup: $trial_category");
2352
- $sql_sub_name = 'SELECT term_id FROM ' . $wpdb->terms . ' WHERE name LIKE \'' . addslashes(esc_attr($trial_category)) . '%\' limit 1';
2353
  $found_category = $wpdb->get_var($sql_sub_name);
2354
  DebugEcho("lookup_category: wildcard found: $found_category");
2355
  } else {
1
  <?php
2
  /*
3
+ $Id: postie-functions.php 1682900 2017-06-21 19:45:59Z WayneAllen $
4
  */
5
 
6
  class PostiePostModifiers {
393
 
394
  $content = filter_Newlines($content, $config);
395
  if ($fulldebug) {
396
+ DebugEcho("post filter_Newlines: $content");
397
  }
398
 
399
  $content = filter_RemoveSignature($content, $config);
400
  if ($fulldebug) {
401
+ DebugEcho("post filter_RemoveSignature: $content");
402
  }
403
 
404
  $post_excerpt = tag_Excerpt($content, $config);
405
  if ($fulldebug) {
406
+ DebugEcho("post tag_Excerpt: $content");
407
  }
408
 
409
  $postAuthorDetails = postie_getPostAuthorDetails($mimeDecodedEmail);
410
  if ($fulldebug) {
411
+ DebugEcho("post postie_getPostAuthorDetails: $content");
412
  }
413
 
414
  $message_date = NULL;
420
  } else {
421
  $message_date = $mimeDecodedEmail['headers']['date'];
422
  DebugEcho("decoded date: $message_date");
423
+ list($message_date, $delay) = tag_Delay($content, $message_date, $config);
424
+ if ($fulldebug) {
425
+ DebugEcho("post tag_Delay: $content");
426
+ }
427
  }
428
  } else {
429
  DebugEcho("date header missing");
430
  $message_date = current_time('mysql');
431
  }
432
 
433
+ $post_date = tag_Date($content, $message_date);
 
 
434
  if ($fulldebug) {
435
+ DebugEcho("post tag_Date: $content");
436
  }
437
 
438
+
439
  //do post type before category to keep the subject line correct
440
  $post_type = tag_PostType($subject, $postmodifiers, $config);
441
  if ($fulldebug) {
442
+ DebugEcho("post tag_PostType: $content");
443
  }
444
 
445
  $default_categoryid = $config['default_post_category'];
450
 
451
  $post_categories = tag_Categories($subject, $default_categoryid, $config, $post_id);
452
  if ($fulldebug) {
453
+ DebugEcho("post tag_Categories: $content");
454
  }
455
 
456
  $post_tags = tag_Tags($content, $config['default_post_tags'], 'html' == $config['prefer_text_type']);
457
  if ($fulldebug) {
458
+ DebugEcho("post tag_Tags: $content");
459
  }
460
 
461
  $comment_status = tag_AllowCommentsOnPost($content);
462
  if ($fulldebug) {
463
+ DebugEcho("post tag_AllowCommentsOnPost: $content");
464
  }
465
 
466
  $post_status = tag_Status($content, $config['post_status']);
467
  if ($fulldebug) {
468
+ DebugEcho("post tag_Status: $content");
469
  }
470
 
471
  //handle CID before linkify
472
  $content = filter_ReplaceImageCIDs($content, $mimeDecodedEmail);
473
  if ($fulldebug) {
474
+ DebugEcho("post filter_ReplaceImageCIDs: $content");
475
  }
476
 
477
  if ($config['converturls']) {
478
  $content = filter_Linkify($content);
479
  if ($fulldebug) {
480
+ DebugEcho("post filter_Linkify: $content");
481
  }
482
  }
483
 
524
 
525
  $content = filter_Start($content, $config);
526
  if ($fulldebug) {
527
+ DebugEcho("post filter_Start: $content");
528
  }
529
 
530
  $content = filter_End($content, $config);
531
  if ($fulldebug) {
532
+ DebugEcho("post filter_End: $content");
533
  }
534
 
535
  $content = filter_ReplaceImagePlaceHolders($content, $mimeDecodedEmail, $config, $id, $config['image_placeholder']);
536
  if ($fulldebug) {
537
+ DebugEcho("post filter_ReplaceImagePlaceHolders: $content");
538
  }
539
 
540
  if ($post_excerpt) {
2137
  $imageTemplate = mb_str_replace('{CAPTION}', htmlspecialchars($caption, ENT_QUOTES), $imageTemplate);
2138
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: captioned template: $imageTemplate");
2139
 
2140
+ if (!empty($caption)) {
2141
+ $img = get_post($attachment['wp_id']);
2142
+ $img->post_excerpt = $caption;
2143
+ wp_update_post($img);
2144
+ DebugEcho("filter_ReplaceImagePlaceHolders_worker: caption added to metadata");
2145
+ }
2146
  $imageTemplate = apply_filters('postie_place_media', $imageTemplate, $attachment['wp_id']);
2147
  DebugEcho("filter_ReplaceImagePlaceHolders_worker: post postie_place_media: '$imageTemplate'");
2148
 
2358
  $found_category = NULL;
2359
  if ($category_match) {
2360
  DebugEcho("category wildcard lookup: $trial_category");
2361
+ $sql_sub_name = 'SELECT term_id FROM ' . $wpdb->terms . ' WHERE name LIKE \'' . addslashes(esc_attr($trial_category)) . '%\' OR slug LIKE \'' . addslashes(esc_attr($trial_category)) . '%\' limit 1';
2362
  $found_category = $wpdb->get_var($sql_sub_name);
2363
  DebugEcho("lookup_category: wildcard found: $found_category");
2364
  } else {
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.44
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
@@ -28,7 +28,7 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1678570 2017-06-14 16:44:10Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
@@ -62,7 +62,7 @@ if (!function_exists('file_get_html')) {
62
  require_once (plugin_dir_path(__FILE__) . 'lib/simple_html_dom.php');
63
  }
64
 
65
- define('POSTIE_VERSION', '1.8.44');
66
  define("POSTIE_ROOT", dirname(__FILE__));
67
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
68
 
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.45
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL2
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1682901 2017-06-21 19:47:20Z WayneAllen $
32
  */
33
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
34
  require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
62
  require_once (plugin_dir_path(__FILE__) . 'lib/simple_html_dom.php');
63
  }
64
 
65
+ define('POSTIE_VERSION', '1.8.45');
66
  define("POSTIE_ROOT", dirname(__FILE__));
67
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
68
 
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.8
9
- Stable tag: 1.8.44
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -242,10 +242,16 @@ All script, style and body tags are stripped from html emails.
242
  Attachments are now processed in the order they were attached.
243
 
244
  == CHANGELOG ==
 
 
 
 
 
 
245
  = 1.8.44 (2017-06-14) =
246
  * Ensure only users from current site are validated.
247
- * Process newlines earlier in process
248
- * WordPress 4.8 compatibility testing
249
 
250
  = 1.8.43 (2017-05-10) =
251
  * Fix "postie-attachments" div to wrap the right content
6
  Tags: e-mail, email, post-by-email
7
  Requires at least: 3.3.0
8
  Tested up to: 4.8
9
+ Stable tag: 1.8.45
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
242
  Attachments are now processed in the order they were attached.
243
 
244
  == CHANGELOG ==
245
+ = 1.8.45 (2017-06-21) =
246
+ * Feature: If image placement directive has a caption, update the image metadata to include the caption.
247
+ * Fix: Only process delay tag if date was found in header
248
+ * Fix: Date tag overrides header and no offsets are applied
249
+ * Fix: Check for term slug as well as name
250
+
251
  = 1.8.44 (2017-06-14) =
252
  * Ensure only users from current site are validated.
253
+ * Process newlines earlier in process.
254
+ * WordPress 4.8 compatibility testing.
255
 
256
  = 1.8.43 (2017-05-10) =
257
  * Fix "postie-attachments" div to wrap the right content