Postie - Version 1.5.15

Version Description

(2013.07.01) = * Added message warning that filter 'postie_post' has been deprecated. * Fixed bug where a category was detected if there happened to be 2 dash (-) characters and a number was the first thing after the first dash. * Simplified header decoding for non-ASCII languages

Download this release

Release Info

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

Code changes from version 1.5.14 to 1.5.15

Files changed (7) hide show
  1. docs/Changes.txt +12 -6
  2. docs/Postie.txt +1 -1
  3. docs/TODO.txt +2 -0
  4. get_mail.php +5 -1
  5. postie-functions.php +27 -17
  6. postie.php +3 -3
  7. readme.txt +14 -7
docs/Changes.txt CHANGED
@@ -1,20 +1,20 @@
1
  == Upgrade Notice ==
2
 
 
 
 
3
  = 1.5.3 =
4
- * Postie can now set the first image in an email to be the "Featured" image. There is a new setting "Use First Image as Featured Image" which is off by default.
5
- * Postie now supports Use Transport Layer Security (TLS)
6
 
7
  = 1.5.0 =
8
- * New filter postie_filter_email. Used to map "from" to any other email. Allows custom user mapping.
9
 
10
  = 1.4.41 =
11
  Post format is now supported. You can specify any of the WordPress supported post formats using the Post type syntax.
12
  Post status can now be specified using the status: tag.
13
  Post status setting was renamed to Default Post Status and moved to the Message tab.
14
 
15
- = 1.4.18 =
16
- Many method names have been changed. Any custom filters may need to be updated.
17
-
18
  = 1.4.10 =
19
  All script, style and body tags are stripped from html emails.
20
 
@@ -22,6 +22,12 @@ All script, style and body tags are stripped from html emails.
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
 
 
 
 
 
 
25
  = 1.5.14 (2013.06.21) =
26
  * Added PHP version to debug output
27
  * Added PHP version check when disabling GSSAPI
1
  == Upgrade Notice ==
2
 
3
+ = 1.5.14 =
4
+ The postie_post filter has be deprecated in favor of postie_post_before.
5
+
6
  = 1.5.3 =
7
+ Postie can now set the first image in an email to be the "Featured" image. There is a new setting "Use First Image as Featured Image" which is off by default.
8
+ Postie now supports Use Transport Layer Security (TLS)
9
 
10
  = 1.5.0 =
11
+ New filter postie_filter_email. Used to map "from" to any other email. Allows custom user mapping.
12
 
13
  = 1.4.41 =
14
  Post format is now supported. You can specify any of the WordPress supported post formats using the Post type syntax.
15
  Post status can now be specified using the status: tag.
16
  Post status setting was renamed to Default Post Status and moved to the Message tab.
17
 
 
 
 
18
  = 1.4.10 =
19
  All script, style and body tags are stripped from html emails.
20
 
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+
26
+ = 1.5.15 (2013.07.01) =
27
+ * Added message warning that filter 'postie_post' has been deprecated.
28
+ * Fixed bug where a category was detected if there happened to be 2 dash (-) characters and a number was the first thing after the first dash.
29
+ * Simplified header decoding for non-ASCII languages
30
+
31
  = 1.5.14 (2013.06.21) =
32
  * Added PHP version to debug output
33
  * Added PHP version check when disabling GSSAPI
docs/Postie.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.2
9
- Stable tag: 1.5.14
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.2
9
+ Stable tag: 1.5.15
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -11,6 +11,8 @@ plugin conflict - Image Rotation Fixer
11
  =========
12
  Postie 2.0
13
 
 
 
14
  setting to turn off individual tags
15
  process single email at a time and don't delete unless successful
16
  plugin mechanism to add new tags (and define "built-in ones")
11
  =========
12
  Postie 2.0
13
 
14
+ http://www.yaconiello.com/blog/how-to-write-wordpress-plugin/
15
+
16
  setting to turn off individual tags
17
  process single email at a time and don't delete unless successful
18
  plugin mechanism to add new tags (and define "built-in ones")
get_mail.php CHANGED
@@ -15,6 +15,10 @@ if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
15
  include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
16
  }
17
 
 
 
 
 
18
  $test_email = null;
19
  $config = config_Read();
20
  extract($config);
@@ -47,7 +51,7 @@ foreach ($emails as $email) {
47
  continue;
48
  }
49
 
50
- $mimeDecodedEmail = DecodeMIMEMail($email, true);
51
 
52
  DebugEmailOutput($email, $mimeDecodedEmail);
53
 
15
  include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
16
  }
17
 
18
+ if (has_filter('postie_post')){
19
+ echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
20
+ }
21
+
22
  $test_email = null;
23
  $config = config_Read();
24
  extract($config);
51
  continue;
52
  }
53
 
54
+ $mimeDecodedEmail = DecodeMIMEMail($email);
55
 
56
  DebugEmailOutput($email, $mimeDecodedEmail);
57
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 731782 2013-06-25 23:40:57Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -50,6 +50,7 @@ function postie_environment() {
50
  EchoInfo("Postie Version: " . POSTIE_VERSION);
51
  EchoInfo("WordPres Version: " . get_bloginfo('version'));
52
  EchoInfo("PHP Version: " . phpversion());
 
53
  EchoInfo("Debug mode: " . (IsDebugMode() ? "On" : "Off"));
54
  EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
55
  DebugEcho("Error log: " . ini_get('error_log'));
@@ -901,7 +902,7 @@ function PostToDB($details, $isReply, $customImageField, $postmodifiers) {
901
  }
902
 
903
  $postmodifiers->apply($post_ID, $details);
904
-
905
  apply_filters('postie_post_after', $details);
906
  }
907
  }
@@ -2073,11 +2074,11 @@ function MailToRecipients(&$mail_content, $testEmail = false, $recipients = arra
2073
  * @param string
2074
  * @return array
2075
  */
2076
- function DecodeMIMEMail($email, $decodeHeaders = false) {
2077
  $params = array();
2078
  $params['include_bodies'] = true;
2079
  $params['decode_bodies'] = false;
2080
- $params['decode_headers'] = $decodeHeaders;
2081
  $params['input'] = $email;
2082
  $md = new Mail_mimeDecode($email);
2083
  $decoded = $md->decode($params);
@@ -2518,14 +2519,13 @@ function tag_Categories(&$subject, $defaultCategory, $category_match) {
2518
  $matches = array();
2519
 
2520
  if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) { // [<category1>] [<category2>] <Subject>
2521
- preg_match("/]([^\[]*)$/", $subject, $subject_matches);
2522
- //DebugDump($subject_matches);
2523
- $subject = trim($subject_matches[1]);
2524
  $matchtypes[] = $matches;
2525
  }
2526
  if (preg_match_all('/-(.[^-]*)-/', $subject, $matches)) { // -<category>- -<category2>- <Subject>
2527
- preg_match("/-(.[^-]*)$/", $subject, $subject_matches);
2528
- $subject = trim($subject_matches[1]);
2529
  $matchtypes[] = $matches;
2530
  }
2531
  if (preg_match('/(.+): (.*)/', $subject, $matches)) { // <category>:<Subject>
@@ -2537,13 +2537,18 @@ function tag_Categories(&$subject, $defaultCategory, $category_match) {
2537
  }
2538
  }
2539
 
 
 
2540
  foreach ($matchtypes as $matches) {
2541
  if (count($matches)) {
 
2542
  foreach ($matches[1] as $match) {
2543
  $category = lookup_category($match, $category_match);
2544
  if (!empty($category)) {
 
2545
  $post_categories[] = $category;
2546
  }
 
2547
  }
2548
  }
2549
  }
@@ -2551,6 +2556,7 @@ function tag_Categories(&$subject, $defaultCategory, $category_match) {
2551
  $post_categories[] = $defaultCategory;
2552
  $subject = $original_subject;
2553
  }
 
2554
  return $post_categories;
2555
  }
2556
 
@@ -2561,19 +2567,23 @@ function lookup_category($trial_category, $category_match) {
2561
  EchoInfo("lookup_category: $trial_category");
2562
 
2563
  $term = get_term_by('name', $trial_category, 'category');
2564
- if ($term !== false) {
2565
  DebugEcho("category: found by name $trial_category");
2566
- //DebugDump($term);
2567
  //then category is a named and found
2568
  return $term->term_id;
2569
  }
2570
 
2571
- $term = get_term_by('id', intval($trial_category), 'category');
2572
- if ($term !== false) {
2573
- DebugEcho("category: found by id $trial_category");
2574
- //DebugDump($term);
2575
- //then cateogry was an ID and found
2576
- return $term->term_id;
 
 
 
 
2577
  }
2578
 
2579
  if ($category_match) {
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 734856 2013-07-01 22:32:53Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
50
  EchoInfo("Postie Version: " . POSTIE_VERSION);
51
  EchoInfo("WordPres Version: " . get_bloginfo('version'));
52
  EchoInfo("PHP Version: " . phpversion());
53
+ EchoInfo("OS: " . php_uname());
54
  EchoInfo("Debug mode: " . (IsDebugMode() ? "On" : "Off"));
55
  EchoInfo("Time: " . date('Y-m-d H:i:s', time()) . " GMT");
56
  DebugEcho("Error log: " . ini_get('error_log'));
902
  }
903
 
904
  $postmodifiers->apply($post_ID, $details);
905
+
906
  apply_filters('postie_post_after', $details);
907
  }
908
  }
2074
  * @param string
2075
  * @return array
2076
  */
2077
+ function DecodeMIMEMail($email) {
2078
  $params = array();
2079
  $params['include_bodies'] = true;
2080
  $params['decode_bodies'] = false;
2081
+ $params['decode_headers'] = true;
2082
  $params['input'] = $email;
2083
  $md = new Mail_mimeDecode($email);
2084
  $decoded = $md->decode($params);
2519
  $matches = array();
2520
 
2521
  if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) { // [<category1>] [<category2>] <Subject>
2522
+ //preg_match("/]([^\[]*)$/", $subject, $subject_matches);
2523
+ //$subject = trim($subject_matches[1]);
 
2524
  $matchtypes[] = $matches;
2525
  }
2526
  if (preg_match_all('/-(.[^-]*)-/', $subject, $matches)) { // -<category>- -<category2>- <Subject>
2527
+ //preg_match("/-(.[^-]*)$/", $subject, $subject_matches);
2528
+ //$subject = trim($subject_matches[1]);
2529
  $matchtypes[] = $matches;
2530
  }
2531
  if (preg_match('/(.+): (.*)/', $subject, $matches)) { // <category>:<Subject>
2537
  }
2538
  }
2539
 
2540
+ DebugEcho("tag_Categories: found categories");
2541
+ DebugDump($matchtypes);
2542
  foreach ($matchtypes as $matches) {
2543
  if (count($matches)) {
2544
+ $i = 0;
2545
  foreach ($matches[1] as $match) {
2546
  $category = lookup_category($match, $category_match);
2547
  if (!empty($category)) {
2548
+ $subject = str_replace($matches[0][$i], '', $subject);
2549
  $post_categories[] = $category;
2550
  }
2551
+ $i++;
2552
  }
2553
  }
2554
  }
2556
  $post_categories[] = $defaultCategory;
2557
  $subject = $original_subject;
2558
  }
2559
+ $subject = trim($subject);
2560
  return $post_categories;
2561
  }
2562
 
2567
  EchoInfo("lookup_category: $trial_category");
2568
 
2569
  $term = get_term_by('name', $trial_category, 'category');
2570
+ if (!empty($term)) {
2571
  DebugEcho("category: found by name $trial_category");
2572
+ DebugDump($term);
2573
  //then category is a named and found
2574
  return $term->term_id;
2575
  }
2576
 
2577
+ if (is_numeric($trial_category)) {
2578
+ DebugEcho("category: looking for id '$trial_category'");
2579
+ $cat_id = intval($trial_category);
2580
+ $term = get_term_by('id', $cat_id, 'category');
2581
+ if (!empty($term) && $term->term_id == $trial_category) {
2582
+ DebugEcho("category: found by id '$cat_id'");
2583
+ DebugDump($term);
2584
+ //then cateogry was an ID and found
2585
+ return $term->term_id;
2586
+ }
2587
  }
2588
 
2589
  if ($category_match) {
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
- Version: 1.5.14
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,10 +27,10 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 731782 2013-06-25 23:40:57Z WayneAllen $
31
  */
32
 
33
- define('POSTIE_VERSION', '1.5.14');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Signifigantly upgrades the posting by mail features of Word Press (See <a href='options-general.php?page=postie/postie.php'>Settings and options</a>) to configure your e-mail settings. See the <a href='http://wordpress.org/extend/plugins/postie/other_notes'>Readme</a> for usage. Visit the <a href='http://wordpress.org/support/plugin/postie'>postie forum</a> for support.
7
+ Version: 1.5.15
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 734872 2013-07-01 23:25:27Z WayneAllen $
31
  */
32
 
33
+ define('POSTIE_VERSION', '1.5.15');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.2
9
- Stable tag: 1.5.14
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -423,21 +423,22 @@ It is also possible to turn the WordPress cron off. Please make sure something l
423
  `define('DISABLE_WP_CRON', true);` is not in your wp-config.php file.
424
  == Upgrade Notice ==
425
 
 
 
 
426
  = 1.5.3 =
427
- * Postie can now set the first image in an email to be the "Featured" image. There is a new setting "Use First Image as Featured Image" which is off by default.
428
- * Postie now supports Use Transport Layer Security (TLS)
 
429
 
430
  = 1.5.0 =
431
- * New filter postie_filter_email. Used to map "from" to any other email. Allows custom user mapping.
432
 
433
  = 1.4.41 =
434
  Post format is now supported. You can specify any of the WordPress supported post formats using the Post type syntax.
435
  Post status can now be specified using the status: tag.
436
  Post status setting was renamed to Default Post Status and moved to the Message tab.
437
 
438
- = 1.4.18 =
439
- Many method names have been changed. Any custom filters may need to be updated.
440
-
441
  = 1.4.10 =
442
  All script, style and body tags are stripped from html emails.
443
 
@@ -445,6 +446,12 @@ All script, style and body tags are stripped from html emails.
445
  Attachments are now processed in the order they were attached.
446
 
447
  == CHANGELOG ==
 
 
 
 
 
 
448
  = 1.5.14 (2013.06.21) =
449
  * Added PHP version to debug output
450
  * Added PHP version check when disabling GSSAPI
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.2
9
+ Stable tag: 1.5.15
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
423
  `define('DISABLE_WP_CRON', true);` is not in your wp-config.php file.
424
  == Upgrade Notice ==
425
 
426
+ = 1.5.14 =
427
+ The postie_post filter has be deprecated in favor of postie_post_before.
428
+
429
  = 1.5.3 =
430
+ Postie can now set the first image in an email to be the "Featured" image. There is a new setting "Use First Image as Featured Image" which is off by default.
431
+
432
+ Postie now supports Use Transport Layer Security (TLS)
433
 
434
  = 1.5.0 =
435
+ New filter postie_filter_email. Used to map "from" to any other email. Allows custom user mapping.
436
 
437
  = 1.4.41 =
438
  Post format is now supported. You can specify any of the WordPress supported post formats using the Post type syntax.
439
  Post status can now be specified using the status: tag.
440
  Post status setting was renamed to Default Post Status and moved to the Message tab.
441
 
 
 
 
442
  = 1.4.10 =
443
  All script, style and body tags are stripped from html emails.
444
 
446
  Attachments are now processed in the order they were attached.
447
 
448
  == CHANGELOG ==
449
+
450
+ = 1.5.15 (2013.07.01) =
451
+ * Added message warning that filter 'postie_post' has been deprecated.
452
+ * Fixed bug where a category was detected if there happened to be 2 dash (-) characters and a number was the first thing after the first dash.
453
+ * Simplified header decoding for non-ASCII languages
454
+
455
  = 1.5.14 (2013.06.21) =
456
  * Added PHP version to debug output
457
  * Added PHP version check when disabling GSSAPI