Version Description
(2015-07-30) = * Added additional output if wp_insert_post() fails * Fixed image upload failure when image filename doesn't have an extension
Download this release
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.7.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.3 to 1.7.4
- docs/Changes.txt +4 -0
- docs/Postie.txt +2 -2
- postie-functions.php +53 -41
- postie.php +3 -3
- readme.txt +6 -2
docs/Changes.txt
CHANGED
@@ -27,6 +27,10 @@ All script, style and body tags are stripped from html emails.
|
|
27 |
Attachments are now processed in the order they were attached.
|
28 |
|
29 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
30 |
= 1.7.3 (2015-07-22) =
|
31 |
* Fix parameter order bug in postie_gallery filter
|
32 |
|
27 |
Attachments are now processed in the order they were attached.
|
28 |
|
29 |
== CHANGELOG ==
|
30 |
+
= 1.7.4 (2015-07-30) =
|
31 |
+
* Added additional output if wp_insert_post() fails
|
32 |
+
* Fixed image upload failure when image filename doesn't have an extension
|
33 |
+
|
34 |
= 1.7.3 (2015-07-22) =
|
35 |
* Fix parameter order bug in postie_gallery filter
|
36 |
|
docs/Postie.txt
CHANGED
@@ -5,8 +5,8 @@ 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.2.
|
9 |
-
Stable tag: 1.7.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
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.2.3
|
9 |
+
Stable tag: 1.7.4
|
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
|
4 |
*/
|
5 |
|
6 |
//to turn on debug output add the following line to wp-config.php
|
@@ -443,44 +443,50 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
|
|
443 |
/* in order to do attachments correctly, we need to associate the
|
444 |
attachments with a post. So we add the post here, then update it */
|
445 |
$tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost', 'post_status' => 'draft');
|
446 |
-
$post_id = wp_insert_post($tmpPost);
|
447 |
-
|
|
|
448 |
|
449 |
-
|
450 |
-
|
451 |
|
452 |
-
|
453 |
|
454 |
-
|
455 |
-
|
456 |
|
457 |
-
|
458 |
-
|
459 |
|
460 |
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
|
472 |
-
|
473 |
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
|
|
|
|
481 |
}
|
482 |
-
MailToRecipients($mimeDecodedEmail, false, $recipients, false, false, $postid);
|
483 |
}
|
|
|
|
|
|
|
|
|
484 |
}
|
485 |
postie_disable_revisions(true);
|
486 |
DebugEcho("Done");
|
@@ -1148,7 +1154,7 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
|
|
1148 |
|
1149 |
case 'image':
|
1150 |
DebugEcho("GetContent: image Attachement: $filename");
|
1151 |
-
$file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails);
|
1152 |
if (!is_wp_error($file_id)) {
|
1153 |
//featured image logic
|
1154 |
//set the first image we come across as the featured image
|
@@ -1814,7 +1820,7 @@ function filter_AppleFile(&$mimeDecodedEmail) {
|
|
1814 |
}
|
1815 |
}
|
1816 |
|
1817 |
-
function postie_media_handle_upload($part, $post_id, $poster, $generate_thubnails = true) {
|
1818 |
$post_data = array();
|
1819 |
$overrides = array('test_form' => false);
|
1820 |
|
@@ -1881,7 +1887,7 @@ function postie_media_handle_upload($part, $post_id, $poster, $generate_thubnail
|
|
1881 |
$time = $post->post_date;
|
1882 |
}
|
1883 |
|
1884 |
-
$file = postie_handle_upload($the_file, $overrides, $time);
|
1885 |
|
1886 |
|
1887 |
if (isset($file['error'])) {
|
@@ -1947,7 +1953,7 @@ function postie_media_handle_upload($part, $post_id, $poster, $generate_thubnail
|
|
1947 |
return $id;
|
1948 |
}
|
1949 |
|
1950 |
-
function postie_handle_upload(&$file, $overrides = false, $time = null) {
|
1951 |
// The default error handler.
|
1952 |
if (!function_exists('wp_handle_upload_error')) {
|
1953 |
|
@@ -1959,12 +1965,18 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
|
|
1959 |
|
1960 |
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
|
1961 |
$wp_filetype = wp_check_filetype($file['name']);
|
1962 |
-
DebugEcho("postie_handle_upload: detected file type for " . $file['name'] . " is " . $wp_filetype['type']);
|
1963 |
-
|
1964 |
if (!isset($file['type'])) {
|
1965 |
-
DebugEcho("postie_handle_upload:
|
1966 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1967 |
}
|
|
|
|
|
1968 |
$file = apply_filters('wp_handle_upload_prefilter', $file);
|
1969 |
|
1970 |
// You may define your own function and pass the name in $overrides['upload_error_handler']
|
@@ -2000,15 +2012,15 @@ function postie_handle_upload(&$file, $overrides = false, $time = null) {
|
|
2000 |
return $upload_error_handler($file, __('Specified file failed upload test.'));
|
2001 |
}
|
2002 |
|
2003 |
-
|
2004 |
-
$mimetype = $wp_filetype['type'];
|
2005 |
$ext = $wp_filetype['ext'];
|
2006 |
|
2007 |
if (empty($ext)) {
|
2008 |
$ext = ltrim(strrchr($file['name'], '.'), '.');
|
2009 |
}
|
2010 |
-
if (empty($
|
2011 |
-
$
|
|
|
2012 |
}
|
2013 |
|
2014 |
DebugEcho("postie_handle_upload (type/ext): '$mimetype' / '$ext'");
|
1 |
<?php
|
2 |
/*
|
3 |
+
$Id: postie-functions.php 1210023 2015-07-30 22:41:55Z WayneAllen $
|
4 |
*/
|
5 |
|
6 |
//to turn on debug output add the following line to wp-config.php
|
443 |
/* in order to do attachments correctly, we need to associate the
|
444 |
attachments with a post. So we add the post here, then update it */
|
445 |
$tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost', 'post_status' => 'draft');
|
446 |
+
$post_id = wp_insert_post($tmpPost, true);
|
447 |
+
if (!is_wp_error($post_id)) {
|
448 |
+
DebugEcho("tmp post id is $post_id");
|
449 |
|
450 |
+
$is_reply = false;
|
451 |
+
$postmodifiers = new PostiePostModifiers();
|
452 |
|
453 |
+
$details = CreatePost($poster, $mimeDecodedEmail, $post_id, $is_reply, $config, $postmodifiers);
|
454 |
|
455 |
+
$details = apply_filters('postie_post', $details);
|
456 |
+
$details = apply_filters('postie_post_before', $details);
|
457 |
|
458 |
+
DebugEcho(("Post postie_post filter"));
|
459 |
+
DebugDump($details);
|
460 |
|
461 |
|
462 |
+
if (empty($details)) {
|
463 |
+
// It is possible that the filter has removed the post, in which case, it should not be posted.
|
464 |
+
// And if we created a placeholder post (because this was not a reply to an existing post),
|
465 |
+
// then it should be removed
|
466 |
+
if (!$is_reply) {
|
467 |
+
wp_delete_post($post_id);
|
468 |
+
EchoInfo("postie_post filter cleared the post, not saving.");
|
469 |
+
}
|
470 |
+
} else {
|
471 |
+
DisplayEmailPost($details);
|
472 |
|
473 |
+
$postid = PostToDB($details, $is_reply, $custom_image_field, $postmodifiers);
|
474 |
|
475 |
+
if ($confirmation_email != '') {
|
476 |
+
if ($confirmation_email == 'sender') {
|
477 |
+
$recipients = array($details['email_author']);
|
478 |
+
} elseif ($confirmation_email == 'admin') {
|
479 |
+
$recipients = array(get_option("admin_email"));
|
480 |
+
} elseif ($confirmation_email == 'both') {
|
481 |
+
$recipients = array($details['email_author'], get_option("admin_email"));
|
482 |
+
}
|
483 |
+
MailToRecipients($mimeDecodedEmail, false, $recipients, false, false, $postid);
|
484 |
}
|
|
|
485 |
}
|
486 |
+
} else {
|
487 |
+
EchoInfo("wp_insert_post failed: " . $post_id->get_error_message());
|
488 |
+
DebugDump($post_id->get_error_messages());
|
489 |
+
DebugDump($post_id->get_error_data());
|
490 |
}
|
491 |
postie_disable_revisions(true);
|
492 |
DebugEcho("Done");
|
1154 |
|
1155 |
case 'image':
|
1156 |
DebugEcho("GetContent: image Attachement: $filename");
|
1157 |
+
$file_id = postie_media_handle_upload($part, $post_id, $poster, $generate_thumbnails, $mimetype_primary, $mimetype_secondary);
|
1158 |
if (!is_wp_error($file_id)) {
|
1159 |
//featured image logic
|
1160 |
//set the first image we come across as the featured image
|
1820 |
}
|
1821 |
}
|
1822 |
|
1823 |
+
function postie_media_handle_upload($part, $post_id, $poster, $generate_thubnails = true, $mimetype_primary = null, $mimetype_secondary = null) {
|
1824 |
$post_data = array();
|
1825 |
$overrides = array('test_form' => false);
|
1826 |
|
1887 |
$time = $post->post_date;
|
1888 |
}
|
1889 |
|
1890 |
+
$file = postie_handle_upload($the_file, $overrides, $time, $mimetype_primary, $mimetype_secondary);
|
1891 |
|
1892 |
|
1893 |
if (isset($file['error'])) {
|
1953 |
return $id;
|
1954 |
}
|
1955 |
|
1956 |
+
function postie_handle_upload(&$file, $overrides = false, $time = null, $mimetype_primary = null, $mimetype_secondary = null) {
|
1957 |
// The default error handler.
|
1958 |
if (!function_exists('wp_handle_upload_error')) {
|
1959 |
|
1965 |
|
1966 |
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
|
1967 |
$wp_filetype = wp_check_filetype($file['name']);
|
|
|
|
|
1968 |
if (!isset($file['type'])) {
|
1969 |
+
DebugEcho("postie_handle_upload: missing file[type]");
|
1970 |
+
if (!empty($wp_filetype['type'])) {
|
1971 |
+
DebugEcho("postie_handle_upload: substituting wp_filetype[type] - " . $wp_filetype['type']);
|
1972 |
+
$file['type'] = $wp_filetype['type'];
|
1973 |
+
} else if (!empty($mimetype_primary)) {
|
1974 |
+
DebugEcho("postie_handle_upload: substituting mimetype_primary - $mimetype_primary/$mimetype_secondary");
|
1975 |
+
$file['type'] = "$mimetype_primary/$mimetype_secondary";
|
1976 |
+
}
|
1977 |
}
|
1978 |
+
DebugEcho("postie_handle_upload: detected file type for " . $file['name'] . " is " . $file['type']);
|
1979 |
+
|
1980 |
$file = apply_filters('wp_handle_upload_prefilter', $file);
|
1981 |
|
1982 |
// You may define your own function and pass the name in $overrides['upload_error_handler']
|
2012 |
return $upload_error_handler($file, __('Specified file failed upload test.'));
|
2013 |
}
|
2014 |
|
2015 |
+
$mimetype = $file['type'];
|
|
|
2016 |
$ext = $wp_filetype['ext'];
|
2017 |
|
2018 |
if (empty($ext)) {
|
2019 |
$ext = ltrim(strrchr($file['name'], '.'), '.');
|
2020 |
}
|
2021 |
+
if (empty($ext) && !empty($mimetype_secondary)) {
|
2022 |
+
$ext = $mimetype_secondary;
|
2023 |
+
$file['name'] = $file['name'] . ".$ext";
|
2024 |
}
|
2025 |
|
2026 |
DebugEcho("postie_handle_upload (type/ext): '$mimetype' / '$ext'");
|
postie.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Postie
|
5 |
Plugin URI: http://PostiePlugin.com/
|
6 |
Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
|
7 |
-
Version: 1.7.
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
@@ -27,11 +27,11 @@
|
|
27 |
*/
|
28 |
|
29 |
/*
|
30 |
-
$Id: postie.php
|
31 |
*/
|
32 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
|
33 |
|
34 |
-
define('POSTIE_VERSION', '1.7.
|
35 |
define("POSTIE_ROOT", dirname(__FILE__));
|
36 |
define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
37 |
|
4 |
Plugin Name: Postie
|
5 |
Plugin URI: http://PostiePlugin.com/
|
6 |
Description: Create posts via email. Signifigantly upgrades the Post by Email features of Word Press.
|
7 |
+
Version: 1.7.4
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
27 |
*/
|
28 |
|
29 |
/*
|
30 |
+
$Id: postie.php 1210023 2015-07-30 22:41:55Z WayneAllen $
|
31 |
*/
|
32 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
|
33 |
|
34 |
+
define('POSTIE_VERSION', '1.7.4');
|
35 |
define("POSTIE_ROOT", dirname(__FILE__));
|
36 |
define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
37 |
|
readme.txt
CHANGED
@@ -5,8 +5,8 @@ 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.2.
|
9 |
-
Stable tag: 1.7.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -234,6 +234,10 @@ All script, style and body tags are stripped from html emails.
|
|
234 |
Attachments are now processed in the order they were attached.
|
235 |
|
236 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
237 |
= 1.7.3 (2015-07-22) =
|
238 |
* Fix parameter order bug in postie_gallery filter
|
239 |
|
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.2.3
|
9 |
+
Stable tag: 1.7.4
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
234 |
Attachments are now processed in the order they were attached.
|
235 |
|
236 |
== CHANGELOG ==
|
237 |
+
= 1.7.4 (2015-07-30) =
|
238 |
+
* Added additional output if wp_insert_post() fails
|
239 |
+
* Fixed image upload failure when image filename doesn't have an extension
|
240 |
+
|
241 |
= 1.7.3 (2015-07-22) =
|
242 |
* Fix parameter order bug in postie_gallery filter
|
243 |
|