Postie - Version 1.9.6

Version Description

(2017-10-19) = * Fix: Post format was not being correctly set.

Download this release

Release Info

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

Code changes from version 1.9.5 to 1.9.6

Files changed (6) hide show
  1. docs/Changes.txt +3 -0
  2. docs/Postie.txt +2 -2
  3. postie-tags.php +12 -12
  4. postie.class.php +6 -2
  5. postie.php +3 -3
  6. readme.txt +5 -2
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.5 (2017-10-13) =
39
  * Feature: change post status to pending/draft if the user doesn't have publish_posts capability
40
  * Fix: process postie_email_notify_recipients filter regardless of the "Send post confirmation email to" setting
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.6 (2017-10-19) =
39
+ * Fix: Post format was not being correctly set.
40
+
41
  = 1.9.5 (2017-10-13) =
42
  * Feature: change post status to pending/draft if the user doesn't have publish_posts capability
43
  * Fix: process postie_email_notify_recipients filter regardless of the "Send post confirmation email to" setting
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.8.1
10
- Stable tag: 1.9.5
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: 4.8.2
10
+ Stable tag: 1.9.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
postie-tags.php CHANGED
@@ -371,31 +371,31 @@ function tag_CustomImageField($post_ID, $email, $config) {
371
  function tag_PostType(&$subject, $config) {
372
 
373
  $post_type = $config['post_type'];
374
- $custom_post_type = $config['post_format'];
375
  $separated_subject = array();
376
  $separated_subject[0] = "";
377
  $separated_subject[1] = $subject;
378
 
379
- $custom_post_type_delim = "//";
 
380
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
381
  // Captures the custom post type in the subject before $custom_post_type_delim
382
  $separated_subject = explode($custom_post_type_delim, $subject);
383
- $custom_post_type = trim(strtolower($separated_subject[0]));
384
- DebugEcho("post type: found possible type '$custom_post_type'");
385
  }
386
 
387
- $known_post_types = get_post_types();
388
-
389
- if (in_array($custom_post_type, array_map('strtolower', $known_post_types))) {
390
- DebugEcho("post type: found type '$post_type'");
391
- $post_type = $custom_post_type;
392
  $subject = trim($separated_subject[1]);
393
- } elseif (in_array($custom_post_type, array_keys(get_post_format_strings()))) {
394
- DebugEcho("post type: found format '$custom_post_type'");
 
395
  $subject = trim($separated_subject[1]);
396
  }
397
 
398
- return $post_type;
399
  }
400
 
401
  function tag_Date(&$content, $message_date) {
371
  function tag_PostType(&$subject, $config) {
372
 
373
  $post_type = $config['post_type'];
374
+ $post_format = $config['post_format'];
375
  $separated_subject = array();
376
  $separated_subject[0] = "";
377
  $separated_subject[1] = $subject;
378
 
379
+ $custom_post_type_delim = '//';
380
+ $trial = '';
381
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
382
  // Captures the custom post type in the subject before $custom_post_type_delim
383
  $separated_subject = explode($custom_post_type_delim, $subject);
384
+ $trial = trim(strtolower($separated_subject[0]));
385
+ DebugEcho("post type: found possible type '$post_format'");
386
  }
387
 
388
+ if (in_array($trial, array_map('strtolower', get_post_types()))) {
389
+ DebugEcho("post type: found type '$trial'");
390
+ $post_type = $trial;
 
 
391
  $subject = trim($separated_subject[1]);
392
+ } elseif (in_array($trial, array_keys(get_post_format_strings()))) {
393
+ DebugEcho("post type: found format '$trial'");
394
+ $post_format = $trial;
395
  $subject = trim($separated_subject[1]);
396
  }
397
 
398
+ return array('post_type' => $post_type, 'post_format' => $post_format);
399
  }
400
 
401
  function tag_Date(&$content, $message_date) {
postie.class.php CHANGED
@@ -677,7 +677,7 @@ class Postie {
677
 
678
 
679
  //do post type before category to keep the subject line correct
680
- $post_type = tag_PostType($subject, $config);
681
  if ($fulldebug) {
682
  DebugEcho("post tag_PostType: $content");
683
  }
@@ -810,7 +810,7 @@ class Postie {
810
  'post_date_gmt' => get_gmt_from_date($post_date),
811
  'post_content' => $content,
812
  'post_title' => $subject,
813
- 'post_type' => $post_type, /* Added by Raam Dev <raam@raamdev.com> */
814
  'ping_status' => get_option('default_ping_status'),
815
  'post_category' => $post_categories,
816
  'tags_input' => $post_tags,
@@ -820,6 +820,10 @@ class Postie {
820
  'ID' => $id,
821
  'post_status' => $post_status
822
  );
 
 
 
 
823
  return $details;
824
  }
825
 
677
 
678
 
679
  //do post type before category to keep the subject line correct
680
+ $post_type_format = tag_PostType($subject, $config);
681
  if ($fulldebug) {
682
  DebugEcho("post tag_PostType: $content");
683
  }
810
  'post_date_gmt' => get_gmt_from_date($post_date),
811
  'post_content' => $content,
812
  'post_title' => $subject,
813
+ 'post_type' => $post_type_format['post_type'],
814
  'ping_status' => get_option('default_ping_status'),
815
  'post_category' => $post_categories,
816
  'tags_input' => $post_tags,
820
  'ID' => $id,
821
  'post_status' => $post_status
822
  );
823
+
824
+ //need to set post format differently since it is a type of taxonomy
825
+ wp_set_post_terms($post_id, $post_type_format['post_format'], 'post_format');
826
+
827
  return $details;
828
  }
829
 
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.5
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1746299 2017-10-13 22:41:34Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.5');
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.6
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1749575 2017-10-19 22:56:15Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.6');
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.8.1
10
- Stable tag: 1.9.5
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -243,6 +243,9 @@ All script, style and body tags are stripped from html emails.
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
 
 
 
246
  = 1.9.5 (2017-10-13) =
247
  * Feature: change post status to pending/draft if the user doesn't have publish_posts capability
248
  * Fix: process postie_email_notify_recipients filter regardless of the "Send post confirmation email to" setting
6
  Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
+ Tested up to: 4.8.2
10
+ Stable tag: 1.9.6
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
246
+ = 1.9.6 (2017-10-19) =
247
+ * Fix: Post format was not being correctly set.
248
+
249
  = 1.9.5 (2017-10-13) =
250
  * Feature: change post status to pending/draft if the user doesn't have publish_posts capability
251
  * Fix: process postie_email_notify_recipients filter regardless of the "Send post confirmation email to" setting