Postie - Version 1.4.21

Version Description

(2013.01.09) = * Removed all Call-time pass-by-references to support PHP 5.4

Download this release

Release Info

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

Code changes from version 1.4.20 to 1.4.21

Revision CHANGED
@@ -1,2 +1,2 @@
1
- Revision: 649983
2
- Last Changed Date: 2013-01-07 17:05:33 -0800 (Mon, 07 Jan 2013)
1
+ Revision: 650350
2
+ Last Changed Date: 2013-01-08 17:02:02 -0800 (Tue, 08 Jan 2013)
config_form.php CHANGED
@@ -239,7 +239,7 @@
239
  <?php
240
  foreach ($wp_roles->role_names as $roleId => $name) {
241
  $name = translate_user_role($name);
242
- $role = &$wp_roles->get_role($roleId);
243
  if ($roleId != "administrator") {
244
  ?>
245
  <tr>
239
  <?php
240
  foreach ($wp_roles->role_names as $roleId => $name) {
241
  $name = translate_user_role($name);
242
+ $role = $wp_roles->get_role($roleId);
243
  if ($roleId != "administrator") {
244
  ?>
245
  <tr>
docs/Changes.txt CHANGED
@@ -4,6 +4,9 @@
4
  * Many method names have been changed as of 1.4.18. Any custom filters may need to be updated.
5
 
6
  == CHANGELOG ==
 
 
 
7
  = 1.4.20 (2013.01.08) =
8
  * Added Date feature. You can now specify a specific publication date.
9
  * Fixed a bug with embeded youtube/vimeo links when shortcodes are turned off
4
  * Many method names have been changed as of 1.4.18. Any custom filters may need to be updated.
5
 
6
  == CHANGELOG ==
7
+ = 1.4.21 (2013.01.09) =
8
+ * Removed all Call-time pass-by-references to support PHP 5.4
9
+
10
  = 1.4.20 (2013.01.08) =
11
  * Added Date feature. You can now specify a specific publication date.
12
  * Fixed a bug with embeded youtube/vimeo links when shortcodes are turned off
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
9
- Stable tag: 1.4.20
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
9
+ Stable tag: 1.4.21
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 649993 2013-01-09 00:40:14Z WayneAllen $
5
  */
6
 
7
  /* TODO
@@ -197,7 +197,7 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
197
  }
198
  $message_date = HandleMessageEncoding($cte, $cs, $mimeDecodedEmail->headers["date"], $message_encoding, $message_dequote);
199
  }
200
- $message_date = tag_Date(&$content, $message_date);
201
 
202
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
203
  DebugEcho("post date: $content");
@@ -1355,7 +1355,7 @@ function filter_AppleFile(&$mimeDecodedEmail) {
1355
  $found = true;
1356
  LogInfo("Removing 'applefile'");
1357
  } else {
1358
- $newParts[] = &$mimeDecodedEmail->parts[$i];
1359
  }
1360
  }
1361
  if ($found && $newParts) {
@@ -1432,15 +1432,17 @@ function postie_media_handle_upload($part, $post_id, $poster, $post_data = array
1432
  $content = '';
1433
 
1434
  // use image exif/iptc data for title and caption defaults if possible
1435
- include_once(ABSPATH . '/wp-admin/includes/image.php');
1436
- if ($image_meta = @wp_read_image_metadata($file)) {
1437
- if (trim($image_meta['title'])) {
1438
- $title = $image_meta['title'];
1439
- DebugEcho("Using metadata title: $title");
1440
- }
1441
- if (trim($image_meta['caption'])) {
1442
- $content = $image_meta['caption'];
1443
- DebugEcho("Using metadata caption: $caption");
 
 
1444
  }
1445
  }
1446
 
@@ -1549,7 +1551,10 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
1549
  // Move the file to the uploads dir
1550
  $new_file = $uploads['path'] . "/$filename";
1551
  if (false === @ rename($file['tmp_name'], $new_file)) {
 
 
1552
  DebugDump($file);
 
1553
  return $upload_error_handler($file, sprintf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
1554
  }
1555
 
@@ -2703,7 +2708,7 @@ function UpdatePostiePermissions($role_access) {
2703
  $role_access = array();
2704
  }
2705
  foreach ($wp_roles->role_names as $roleId => $name) {
2706
- $role = &$wp_roles->get_role($roleId);
2707
  if ($roleId != "administrator") {
2708
  if (array_key_exists($roleId, $role_access)) {
2709
  $role->add_cap("post_via_postie");
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 650353 2013-01-09 19:12:00Z WayneAllen $
5
  */
6
 
7
  /* TODO
197
  }
198
  $message_date = HandleMessageEncoding($cte, $cs, $mimeDecodedEmail->headers["date"], $message_encoding, $message_dequote);
199
  }
200
+ $message_date = tag_Date($content, $message_date);
201
 
202
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
203
  DebugEcho("post date: $content");
1355
  $found = true;
1356
  LogInfo("Removing 'applefile'");
1357
  } else {
1358
+ $newParts[] = $mimeDecodedEmail->parts[$i];
1359
  }
1360
  }
1361
  if ($found && $newParts) {
1432
  $content = '';
1433
 
1434
  // use image exif/iptc data for title and caption defaults if possible
1435
+ if (file_exists(ABSPATH . '/wp-admin/includes/image.php')) {
1436
+ include_once(ABSPATH . '/wp-admin/includes/image.php');
1437
+ if ($image_meta = @wp_read_image_metadata($file)) {
1438
+ if (trim($image_meta['title'])) {
1439
+ $title = $image_meta['title'];
1440
+ DebugEcho("Using metadata title: $title");
1441
+ }
1442
+ if (trim($image_meta['caption'])) {
1443
+ $content = $image_meta['caption'];
1444
+ DebugEcho("Using metadata caption: $caption");
1445
+ }
1446
  }
1447
  }
1448
 
1551
  // Move the file to the uploads dir
1552
  $new_file = $uploads['path'] . "/$filename";
1553
  if (false === @ rename($file['tmp_name'], $new_file)) {
1554
+ DebugEcho("upload: rename failed");
1555
+ DebugEcho("new file: $new_file");
1556
  DebugDump($file);
1557
+ DebugDump($uploads);
1558
  return $upload_error_handler($file, sprintf(__('The uploaded file could not be moved to %s.'), $uploads['path']));
1559
  }
1560
 
2708
  $role_access = array();
2709
  }
2710
  foreach ($wp_roles->role_names as $roleId => $name) {
2711
+ $role = $wp_roles->get_role($roleId);
2712
  if ($roleId != "administrator") {
2713
  if (array_key_exists($roleId, $role_access)) {
2714
  $role->add_cap("post_via_postie");
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.4.20
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,7 +27,7 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 649993 2013-01-09 00:40:14Z WayneAllen $
31
  * -= Requests Pending =-
32
  * Problem with some mail server
33
  * Multiple emails should tie to a single account
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.4.21
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 650353 2013-01-09 19:12:00Z WayneAllen $
31
  * -= Requests Pending =-
32
  * Problem with some mail server
33
  * Multiple emails should tie to a single account
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
9
- Stable tag: 1.4.20
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -373,6 +373,9 @@ It is also possible to turn the WordPress cron off. Please make sure something l
373
  * Many method names have been changed as of 1.4.18. Any custom filters may need to be updated.
374
 
375
  == CHANGELOG ==
 
 
 
376
  = 1.4.20 (2013.01.08) =
377
  * Added Date feature. You can now specify a specific publication date.
378
  * Fixed a bug with embeded youtube/vimeo links when shortcodes are turned off
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5
9
+ Stable tag: 1.4.21
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
373
  * Many method names have been changed as of 1.4.18. Any custom filters may need to be updated.
374
 
375
  == CHANGELOG ==
376
+ = 1.4.21 (2013.01.09) =
377
+ * Removed all Call-time pass-by-references to support PHP 5.4
378
+
379
  = 1.4.20 (2013.01.08) =
380
  * Added Date feature. You can now specify a specific publication date.
381
  * Fixed a bug with embeded youtube/vimeo links when shortcodes are turned off
test/inlineimageTest.php CHANGED
@@ -29,10 +29,6 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
29
 
30
  function testInlineImage() {
31
 
32
- $this->markTestIncomplete(
33
- 'This test has not been implemented yet.'
34
- );
35
-
36
  $message = file_get_contents("data/inline.var");
37
  $email = unserialize($message);
38
  $decoded = DecodeMIMEMail($email);
@@ -49,7 +45,11 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
49
  );
50
 
51
  $config = $this->standardConfig();
 
 
52
  $content = GetContent($decoded, $attachments, 1, "wayne", $config);
 
 
53
  }
54
 
55
  function testMultipleImagesWithSig() {
29
 
30
  function testInlineImage() {
31
 
 
 
 
 
32
  $message = file_get_contents("data/inline.var");
33
  $email = unserialize($message);
34
  $decoded = DecodeMIMEMail($email);
45
  );
46
 
47
  $config = $this->standardConfig();
48
+ $config['prefer_text_type']='html';
49
+
50
  $content = GetContent($decoded, $attachments, 1, "wayne", $config);
51
+
52
+ $this->assertEquals("",$content);
53
  }
54
 
55
  function testMultipleImagesWithSig() {
test/postie-functionsTest.php CHANGED
@@ -436,56 +436,56 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
436
 
437
  public function testfilter_Videos() {
438
  $this->assertEquals("A youtube link <embed width='425' height='344' allowfullscreen='true' allowscriptaccess='always' type='application/x-shockwave-flash' src='http://www.youtube.com/v/oAguHwl9Vzq&hl=en&fs=1' />", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", false));
439
- $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq",true));
440
  }
441
 
442
  public function testtag_Date() {
443
- $c="";
444
- $this->assertEquals(null, tag_Date(&$c, null));
445
  $this->assertEquals("", $c);
446
-
447
- $c="date:";
448
- $this->assertEquals(null, tag_Date(&$c, null));
449
  $this->assertEquals("date:", $c);
450
-
451
- $c="date: nothing";
452
- $this->assertEquals(null, tag_Date(&$c, null));
453
  $this->assertEquals("date: nothing", $c);
454
-
455
- $c="date: 1";
456
- $this->assertEquals(null, tag_Date(&$c, null));
457
  $this->assertEquals("date: 1", $c);
458
-
459
- $c="date: 12/31/2013";
460
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
461
  $this->assertEquals("", $c);
462
-
463
- $c="date:12/31/2013";
464
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
465
  $this->assertEquals("", $c);
466
-
467
- $c="Date: 12/31/2013";
468
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
469
  $this->assertEquals("", $c);
470
-
471
- $c="DATE: 12/31/2013";
472
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
473
  $this->assertEquals("", $c);
474
-
475
- $c="date: 31-12-2013";
476
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
477
  $this->assertEquals("", $c);
478
-
479
- $c="date: 31.12.2013";
480
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
481
  $this->assertEquals("", $c);
482
-
483
- $c="date: Dec 31, 2013";
484
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
485
  $this->assertEquals("", $c);
486
 
487
  $c = "date: 12/31/2013\nstuff";
488
- $this->assertEquals("2013-12-31", tag_Date(&$c, null));
489
  $this->assertEquals("stuff", $c);
490
  }
491
 
436
 
437
  public function testfilter_Videos() {
438
  $this->assertEquals("A youtube link <embed width='425' height='344' allowfullscreen='true' allowscriptaccess='always' type='application/x-shockwave-flash' src='http://www.youtube.com/v/oAguHwl9Vzq&hl=en&fs=1' />", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", false));
439
+ $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", true));
440
  }
441
 
442
  public function testtag_Date() {
443
+ $c = "";
444
+ $this->assertEquals(null, tag_Date($c, null));
445
  $this->assertEquals("", $c);
446
+
447
+ $c = "date:";
448
+ $this->assertEquals(null, tag_Date($c, null));
449
  $this->assertEquals("date:", $c);
450
+
451
+ $c = "date: nothing";
452
+ $this->assertEquals(null, tag_Date($c, null));
453
  $this->assertEquals("date: nothing", $c);
454
+
455
+ $c = "date: 1";
456
+ $this->assertEquals(null, tag_Date($c, null));
457
  $this->assertEquals("date: 1", $c);
458
+
459
+ $c = "date: 12/31/2013";
460
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
461
  $this->assertEquals("", $c);
462
+
463
+ $c = "date:12/31/2013";
464
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
465
  $this->assertEquals("", $c);
466
+
467
+ $c = "Date: 12/31/2013";
468
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
469
  $this->assertEquals("", $c);
470
+
471
+ $c = "DATE: 12/31/2013";
472
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
473
  $this->assertEquals("", $c);
474
+
475
+ $c = "date: 31-12-2013";
476
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
477
  $this->assertEquals("", $c);
478
+
479
+ $c = "date: 31.12.2013";
480
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
481
  $this->assertEquals("", $c);
482
+
483
+ $c = "date: Dec 31, 2013";
484
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
485
  $this->assertEquals("", $c);
486
 
487
  $c = "date: 12/31/2013\nstuff";
488
+ $this->assertEquals("2013-12-31", tag_Date($c, null));
489
  $this->assertEquals("stuff", $c);
490
  }
491
 
test/wpstub.php CHANGED
@@ -23,6 +23,7 @@ class wpdb {
23
  }
24
  return $r;
25
  }
 
26
  }
27
 
28
  class WP_Error {
@@ -53,6 +54,7 @@ function get_post() {
53
  $r->post_parent = 0;
54
  $r->guid = '7b0d965d-b8b0-4654-ac9e-eeef1d8cf571';
55
  $r->post_title = '';
 
56
  return $r;
57
  }
58
 
@@ -76,7 +78,7 @@ function wp_upload_dir() {
76
  }
77
 
78
  function wp_unique_filename() {
79
- return tempnam(sys_get_temp_dir(), "postie");
80
  }
81
 
82
  function wp_get_attachment_url() {
@@ -115,4 +117,24 @@ function register_deactivation_hook() {
115
 
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ?>
23
  }
24
  return $r;
25
  }
26
+
27
  }
28
 
29
  class WP_Error {
54
  $r->post_parent = 0;
55
  $r->guid = '7b0d965d-b8b0-4654-ac9e-eeef1d8cf571';
56
  $r->post_title = '';
57
+ $r->post_excerpt='';
58
  return $r;
59
  }
60
 
78
  }
79
 
80
  function wp_unique_filename() {
81
+ return uniqid("postie");
82
  }
83
 
84
  function wp_get_attachment_url() {
117
 
118
  }
119
 
120
+ function apply_filters() {
121
+
122
+ }
123
+
124
+ function wp_insert_attachment() {
125
+ return 1;
126
+ }
127
+
128
+ function wp_update_attachment_metadata() {
129
+
130
+ }
131
+
132
+ function wp_generate_attachment_metadata() {
133
+
134
+ }
135
+
136
+ function is_wp_error() {
137
+ return false;
138
+ }
139
+
140
  ?>