Version Description
(2018-11-23) = * If no category is specified and the post type is "page" then the default category is not added * Additional CID changes
Download this release
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.9.26 |
Comparing to | |
See all releases |
Code changes from version 1.9.25 to 1.9.26
- docs/Changes.txt +4 -0
- docs/Postie.txt +1 -1
- docs/TODO.txt +1 -1
- lib/fMailbox.php +7 -7
- postie-config.class.php +13 -1
- postie-filters.php +18 -35
- postie-tags.php +16 -10
- postie.php +3 -3
- readme.txt +5 -1
docs/Changes.txt
CHANGED
@@ -35,6 +35,10 @@ 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.25 (2018-10-02) =
|
39 |
* Add support for CIDs with surrounding <>
|
40 |
* Add support for URLs with unusual characters
|
35 |
Attachments are now processed in the order they were attached.
|
36 |
|
37 |
== CHANGELOG ==
|
38 |
+
= 1.9.26 (2018-11-23) =
|
39 |
+
* If no category is specified and the post type is "page" then the default category is not added
|
40 |
+
* Additional CID changes
|
41 |
+
|
42 |
= 1.9.25 (2018-10-02) =
|
43 |
* Add support for CIDs with surrounding <>
|
44 |
* Add support for URLs with unusual characters
|
docs/Postie.txt
CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
|
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
-
Stable tag: 1.9.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
+
Stable tag: 1.9.26
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
docs/TODO.txt
CHANGED
@@ -13,11 +13,11 @@ Comment not being created when subject contains fomat or type. I.e. re: image//I
|
|
13 |
|
14 |
Other
|
15 |
Process single email at a time and don't delete unless successful
|
|
|
16 |
Add default comment status (like post status) wp_set_comment_status
|
17 |
Send post confirmation email to: add list of individual admins (lisa@kellys.org)
|
18 |
provide a location for custom icons. update docs about location.
|
19 |
"yoast" style admin sidebar - see clicky by yoast
|
20 |
-
fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
21 |
check multiple email accounts
|
22 |
allow other roles access to manual check like "Roles That Can Post"
|
23 |
Test server port combination by opening a socket connection to see if any service responds. (via ajax call)
|
13 |
|
14 |
Other
|
15 |
Process single email at a time and don't delete unless successful
|
16 |
+
Change all "filters" to "addons" and allow them to be disabled (i.e. turn off processing for "date:"
|
17 |
Add default comment status (like post status) wp_set_comment_status
|
18 |
Send post confirmation email to: add list of individual admins (lisa@kellys.org)
|
19 |
provide a location for custom icons. update docs about location.
|
20 |
"yoast" style admin sidebar - see clicky by yoast
|
|
|
21 |
check multiple email accounts
|
22 |
allow other roles access to manual check like "Roles That Can Post"
|
23 |
Test server port combination by opening a socket connection to see if any service responds. (via ajax call)
|
lib/fMailbox.php
CHANGED
@@ -235,7 +235,7 @@ class fMailbox {
|
|
235 |
$has_disposition = !empty($structure['disposition']); // || !empty($structure['type_fields']);
|
236 |
|
237 |
if ($has_disposition || !empty($structure['type_fields'])) {
|
238 |
-
DebugEcho('handlePart: has_disposition');
|
239 |
//ensure the mime type is correct before doing additional decoding. Some mail clients mark all attachments as text/plain regardless of real type - looking at you outlook.com
|
240 |
foreach ($structure['disposition_fields'] as $field => $value) {
|
241 |
if (strtolower($field) == 'filename') {
|
@@ -253,7 +253,7 @@ class fMailbox {
|
|
253 |
}
|
254 |
foreach ($structure['type_fields'] as $field => $value) {
|
255 |
if (strtolower($field) == 'name') {
|
256 |
-
DebugEcho("handlePart: type_fields name: $value");
|
257 |
$filename = $value;
|
258 |
$ftype = wp_check_filetype($filename);
|
259 |
if ($ftype['type']) {
|
@@ -323,7 +323,7 @@ class fMailbox {
|
|
323 |
|
324 |
// If the part doesn't have a disposition and is not the default text or html, set the disposition to inline
|
325 |
if (!$has_disposition && ((!$is_text || !empty($info['text'])) && (!$is_html || !empty($info['html'])))) {
|
326 |
-
DebugEcho("handlePart: checking disposition");
|
327 |
$is_web_image = $structure['type'] == 'image' && in_array($structure['subtype'], array('gif', 'png', 'jpeg', 'pjpeg'));
|
328 |
$structure['disposition'] = $is_text || $is_html || $is_web_image ? 'inline' : 'attachment';
|
329 |
$structure['disposition_fields'] = array();
|
@@ -370,7 +370,7 @@ class fMailbox {
|
|
370 |
$info[$structure['disposition']] = array();
|
371 |
}
|
372 |
|
373 |
-
DebugEcho("handlePart: disposition: {$structure['disposition']} '$filename' {$structure['type']}/{$structure['subtype']}");
|
374 |
$info[$structure['disposition']][] = array(
|
375 |
'filename' => $filename,
|
376 |
'mimetype' => $structure['type'] . '/' . $structure['subtype'],
|
@@ -378,7 +378,7 @@ class fMailbox {
|
|
378 |
);
|
379 |
return $info;
|
380 |
} else {
|
381 |
-
DebugEcho("handlePart: no disposition set");
|
382 |
}
|
383 |
|
384 |
if ($is_text) {
|
@@ -819,8 +819,8 @@ class fMailbox {
|
|
819 |
'disposition' => isset($headers['content-disposition']) ? strtolower($headers['content-disposition']['value']) : NULL,
|
820 |
'disposition_fields' => isset($headers['content-disposition']) ? $headers['content-disposition']['fields'] : array());
|
821 |
|
822 |
-
DebugEcho('parseStructure: content-type');
|
823 |
-
DebugDump($structure);
|
824 |
|
825 |
$structure['data'] = $data;
|
826 |
}
|
235 |
$has_disposition = !empty($structure['disposition']); // || !empty($structure['type_fields']);
|
236 |
|
237 |
if ($has_disposition || !empty($structure['type_fields'])) {
|
238 |
+
//DebugEcho('handlePart: has_disposition');
|
239 |
//ensure the mime type is correct before doing additional decoding. Some mail clients mark all attachments as text/plain regardless of real type - looking at you outlook.com
|
240 |
foreach ($structure['disposition_fields'] as $field => $value) {
|
241 |
if (strtolower($field) == 'filename') {
|
253 |
}
|
254 |
foreach ($structure['type_fields'] as $field => $value) {
|
255 |
if (strtolower($field) == 'name') {
|
256 |
+
//DebugEcho("handlePart: type_fields name: $value");
|
257 |
$filename = $value;
|
258 |
$ftype = wp_check_filetype($filename);
|
259 |
if ($ftype['type']) {
|
323 |
|
324 |
// If the part doesn't have a disposition and is not the default text or html, set the disposition to inline
|
325 |
if (!$has_disposition && ((!$is_text || !empty($info['text'])) && (!$is_html || !empty($info['html'])))) {
|
326 |
+
//DebugEcho("handlePart: checking disposition");
|
327 |
$is_web_image = $structure['type'] == 'image' && in_array($structure['subtype'], array('gif', 'png', 'jpeg', 'pjpeg'));
|
328 |
$structure['disposition'] = $is_text || $is_html || $is_web_image ? 'inline' : 'attachment';
|
329 |
$structure['disposition_fields'] = array();
|
370 |
$info[$structure['disposition']] = array();
|
371 |
}
|
372 |
|
373 |
+
//DebugEcho("handlePart: disposition: {$structure['disposition']} '$filename' {$structure['type']}/{$structure['subtype']}");
|
374 |
$info[$structure['disposition']][] = array(
|
375 |
'filename' => $filename,
|
376 |
'mimetype' => $structure['type'] . '/' . $structure['subtype'],
|
378 |
);
|
379 |
return $info;
|
380 |
} else {
|
381 |
+
//DebugEcho("handlePart: no disposition set");
|
382 |
}
|
383 |
|
384 |
if ($is_text) {
|
819 |
'disposition' => isset($headers['content-disposition']) ? strtolower($headers['content-disposition']['value']) : NULL,
|
820 |
'disposition_fields' => isset($headers['content-disposition']) ? $headers['content-disposition']['fields'] : array());
|
821 |
|
822 |
+
//DebugEcho('parseStructure: content-type');
|
823 |
+
//DebugDump($structure);
|
824 |
|
825 |
$structure['data'] = $data;
|
826 |
}
|
postie-config.class.php
CHANGED
@@ -1,5 +1,17 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class PostieConfig {
|
4 |
|
5 |
private $config;
|
@@ -170,7 +182,7 @@ class PostieConfig {
|
|
170 |
'message_encoding' => "UTF-8",
|
171 |
'message_dequote' => true,
|
172 |
'post_status' => 'publish',
|
173 |
-
'prefer_text_type' =>
|
174 |
'return_to_sender' => false,
|
175 |
'role_access' => array(),
|
176 |
'selected_audiotemplate' => 'simple_link',
|
1 |
<?php
|
2 |
|
3 |
+
class PostieConfigOptions {
|
4 |
+
|
5 |
+
const PostType = 'post_type';
|
6 |
+
const CategoryRemove = 'category_remove';
|
7 |
+
const CategoryMatch = 'category_match';
|
8 |
+
const CategoryBracket = 'category_bracket';
|
9 |
+
const CategoryDash = 'category_dash';
|
10 |
+
const CategoryColon = 'category_colon';
|
11 |
+
const PostFormat = 'post_format';
|
12 |
+
|
13 |
+
}
|
14 |
+
|
15 |
class PostieConfig {
|
16 |
|
17 |
private $config;
|
182 |
'message_encoding' => "UTF-8",
|
183 |
'message_dequote' => true,
|
184 |
'post_status' => 'publish',
|
185 |
+
'prefer_text_type' => 'plain',
|
186 |
'return_to_sender' => false,
|
187 |
'role_access' => array(),
|
188 |
'selected_audiotemplate' => 'simple_link',
|
postie-filters.php
CHANGED
@@ -6,21 +6,30 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
6 |
global $g_postie;
|
7 |
|
8 |
$matches = array();
|
9 |
-
$
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
|
13 |
$html = '';
|
14 |
if (!$config['include_featured_image']) {
|
15 |
//find the image to exclude
|
16 |
-
$
|
17 |
}
|
18 |
-
DebugEcho("filter_AttachmentTemplates: featured image: $
|
19 |
|
20 |
DebugEcho("filter_AttachmentTemplates: # attachments: " . count($mimeDecodedEmail['attachment']));
|
21 |
foreach ($mimeDecodedEmail['attachment'] as $attachment) {
|
22 |
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
|
23 |
-
$skip = ($
|
24 |
if (!$skip) {
|
25 |
if (!$addimages && $attachment['primary'] == 'image') {
|
26 |
DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['wp_filename']);
|
@@ -48,7 +57,7 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
48 |
DebugEcho("filter_AttachmentTemplates: # related: " . count($mimeDecodedEmail['related']));
|
49 |
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
50 |
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
|
51 |
-
$skip = ($
|
52 |
if (!$skip) {
|
53 |
if (!$addimages && $attachment['primary'] == 'image') {
|
54 |
DebugEcho("filter_AttachmentTemplates: skip image (alt) " . $attachment['wp_filename']);
|
@@ -84,11 +93,11 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
84 |
|
85 |
|
86 |
//strip featured image from html
|
87 |
-
if ($
|
88 |
DebugEcho("filter_AttachmentTemplates: remove featured image from post");
|
89 |
$html = str_get_html($content);
|
90 |
if ($html) {
|
91 |
-
$elements = $html->find('img[src=' . wp_get_attachment_url($
|
92 |
foreach ($elements as $e) {
|
93 |
DebugEcho('filter_AttachmentTemplates: outertext:' . $e->outertext);
|
94 |
$e->outertext = '';
|
@@ -98,20 +107,12 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
98 |
}
|
99 |
|
100 |
$imagecount = 0;
|
101 |
-
foreach ($mimeDecodedEmail['attachment'] as $attachment) {
|
102 |
DebugEcho("filter_AttachmentTemplates: attachment mime primary: {$attachment['primary']}");
|
103 |
if ($attachment['primary'] == 'image' && $attachment['exclude'] == false) {
|
104 |
$imagecount++;
|
105 |
}
|
106 |
}
|
107 |
-
if ($config['prefer_text_type'] == 'plain') {
|
108 |
-
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
109 |
-
DebugEcho("filter_AttachmentTemplates: attachment mime primary: {$attachment['primary']}");
|
110 |
-
if ($attachment['primary'] == 'image' && $attachment['exclude'] == false) {
|
111 |
-
$imagecount++;
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
DebugEcho("filter_AttachmentTemplates: image count $imagecount");
|
116 |
|
117 |
if (($imagecount > 0) && $config['auto_gallery']) {
|
@@ -375,17 +376,6 @@ function filter_Linkify($text) {
|
|
375 |
}
|
376 |
}
|
377 |
|
378 |
-
function fixCID($cid) {
|
379 |
-
return $cid;
|
380 |
-
$cid = trim($cid);
|
381 |
-
if (strlen($cid) > 2) {
|
382 |
-
if ($cid[0] == '<' && $cid[strlen($cid) - 1] == '>') {
|
383 |
-
DebugEcho("fixCID: removing extra <> from $cid");
|
384 |
-
$cid = substr($cid, 1, strlen($cid) - 2);
|
385 |
-
}
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
/**
|
390 |
* When sending in HTML email the html refers to the content-id(CID) of the image - this replaces
|
391 |
* the cid place holder with the actual url of the image sent in
|
@@ -404,13 +394,6 @@ function filter_ReplaceImageCIDs($content, &$email) {
|
|
404 |
$url = wp_get_attachment_url($fileid);
|
405 |
$content = str_replace($cid, $url, $content);
|
406 |
$attachment['exclude'] = true;
|
407 |
-
} elseif (false !== stripos($content, fixCID($cid))) {
|
408 |
-
//some email clients add surrounding <> in the image header CID, but not in the email body
|
409 |
-
DebugEcho("filter_ReplaceImageCIDs: CID (fixed): $cid");
|
410 |
-
$fileid = $attachment['wp_id'];
|
411 |
-
$url = wp_get_attachment_url($fileid);
|
412 |
-
$content = str_replace(fixCID($cid), $url, $content);
|
413 |
-
$attachment['exclude'] = true;
|
414 |
} else {
|
415 |
DebugEcho("filter_ReplaceImageCIDs: CID not found: $cid");
|
416 |
}
|
6 |
global $g_postie;
|
7 |
|
8 |
$matches = array();
|
9 |
+
$isgallery = preg_match("/\[gallery[^\[]*\]/u", $content, $matches);
|
10 |
+
|
11 |
+
DebugEcho("filter_AttachmentTemplates: custom_image_field: " . $config['custom_image_field']);
|
12 |
+
DebugEcho("filter_AttachmentTemplates: auto_gallery: " . $config['auto_gallery']);
|
13 |
+
DebugEcho("filter_AttachmentTemplates: [gallery]: " . $isgallery);
|
14 |
+
|
15 |
+
$addimages = !($config['custom_image_field'] || $config['auto_gallery'] || $isgallery);
|
16 |
+
|
17 |
+
DebugEcho("filter_AttachmentTemplates: addimages: " . $addimages);
|
18 |
+
|
19 |
+
$featuredimageid = -1;
|
20 |
|
21 |
DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
|
22 |
$html = '';
|
23 |
if (!$config['include_featured_image']) {
|
24 |
//find the image to exclude
|
25 |
+
$featuredimageid = get_post_thumbnail_id($post_id);
|
26 |
}
|
27 |
+
DebugEcho("filter_AttachmentTemplates: featured image: $featuredimageid");
|
28 |
|
29 |
DebugEcho("filter_AttachmentTemplates: # attachments: " . count($mimeDecodedEmail['attachment']));
|
30 |
foreach ($mimeDecodedEmail['attachment'] as $attachment) {
|
31 |
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
|
32 |
+
$skip = ($featuredimageid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
|
33 |
if (!$skip) {
|
34 |
if (!$addimages && $attachment['primary'] == 'image') {
|
35 |
DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['wp_filename']);
|
57 |
DebugEcho("filter_AttachmentTemplates: # related: " . count($mimeDecodedEmail['related']));
|
58 |
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
59 |
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['wp_filename']);
|
60 |
+
$skip = ($featuredimageid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
|
61 |
if (!$skip) {
|
62 |
if (!$addimages && $attachment['primary'] == 'image') {
|
63 |
DebugEcho("filter_AttachmentTemplates: skip image (alt) " . $attachment['wp_filename']);
|
93 |
|
94 |
|
95 |
//strip featured image from html
|
96 |
+
if ($featuredimageid > 0 && $config['prefer_text_type'] == 'html' && !$config['include_featured_image']) {
|
97 |
DebugEcho("filter_AttachmentTemplates: remove featured image from post");
|
98 |
$html = str_get_html($content);
|
99 |
if ($html) {
|
100 |
+
$elements = $html->find('img[src=' . wp_get_attachment_url($featuredimageid) . ']');
|
101 |
foreach ($elements as $e) {
|
102 |
DebugEcho('filter_AttachmentTemplates: outertext:' . $e->outertext);
|
103 |
$e->outertext = '';
|
107 |
}
|
108 |
|
109 |
$imagecount = 0;
|
110 |
+
foreach (array_merge($mimeDecodedEmail['attachment'], $mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
111 |
DebugEcho("filter_AttachmentTemplates: attachment mime primary: {$attachment['primary']}");
|
112 |
if ($attachment['primary'] == 'image' && $attachment['exclude'] == false) {
|
113 |
$imagecount++;
|
114 |
}
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
DebugEcho("filter_AttachmentTemplates: image count $imagecount");
|
117 |
|
118 |
if (($imagecount > 0) && $config['auto_gallery']) {
|
376 |
}
|
377 |
}
|
378 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
/**
|
380 |
* When sending in HTML email the html refers to the content-id(CID) of the image - this replaces
|
381 |
* the cid place holder with the actual url of the image sent in
|
394 |
$url = wp_get_attachment_url($fileid);
|
395 |
$content = str_replace($cid, $url, $content);
|
396 |
$attachment['exclude'] = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
} else {
|
398 |
DebugEcho("filter_ReplaceImageCIDs: CID not found: $cid");
|
399 |
}
|
postie-tags.php
CHANGED
@@ -285,26 +285,26 @@ function tag_Excerpt(&$content, $config) {
|
|
285 |
*/
|
286 |
function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
287 |
DebugEcho("tag_Categories: start");
|
288 |
-
$category_match = $config[
|
289 |
$original_subject = $subject;
|
290 |
$found = false;
|
291 |
$post_categories = array();
|
292 |
$matchtypes = array();
|
293 |
$matches = array();
|
294 |
|
295 |
-
if ($config[
|
296 |
if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) { // [<category1>] [<category2>] <Subject>
|
297 |
$matchtypes[] = $matches;
|
298 |
}
|
299 |
}
|
300 |
|
301 |
-
if ($config[
|
302 |
if (preg_match_all('/-(.[^-]*)-/', $subject, $matches)) { // -<category>- -<category2>- <Subject>
|
303 |
$matchtypes[] = $matches;
|
304 |
}
|
305 |
}
|
306 |
|
307 |
-
if ($config[
|
308 |
if (preg_match('/(.+):\s?(.*)/', $subject, $matches)) { // <category>: <Subject>
|
309 |
$matchtypes[] = array(array(0 => $matches[1] . ':'), array(1 => $matches[1]));
|
310 |
}
|
@@ -348,9 +348,13 @@ function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
|
348 |
}
|
349 |
}
|
350 |
}
|
351 |
-
if (!$found || !$config[
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
354 |
$subject = $original_subject;
|
355 |
}
|
356 |
$subject = trim($subject);
|
@@ -376,10 +380,10 @@ function tag_CustomImageField($post_ID, $email, $config) {
|
|
376 |
* Also supports setting the Post Format.
|
377 |
*/
|
378 |
|
379 |
-
function tag_PostType(&$subject,
|
380 |
|
381 |
-
$post_type = $config[
|
382 |
-
$post_format = $config[
|
383 |
$separated_subject = array();
|
384 |
$separated_subject[0] = "";
|
385 |
$separated_subject[1] = $subject;
|
@@ -397,10 +401,12 @@ function tag_PostType(&$subject, $config) {
|
|
397 |
DebugEcho("post type: found type '$trial'");
|
398 |
$post_type = $trial;
|
399 |
$subject = trim($separated_subject[1]);
|
|
|
400 |
} elseif (in_array($trial, array_keys(get_post_format_strings()))) {
|
401 |
DebugEcho("post type: found format '$trial'");
|
402 |
$post_format = $trial;
|
403 |
$subject = trim($separated_subject[1]);
|
|
|
404 |
}
|
405 |
|
406 |
return array('post_type' => $post_type, 'post_format' => $post_format);
|
285 |
*/
|
286 |
function tag_Categories(&$subject, $defaultCategoryId, $config, $post_id) {
|
287 |
DebugEcho("tag_Categories: start");
|
288 |
+
$category_match = $config[PostieConfigOptions::CategoryMatch];
|
289 |
$original_subject = $subject;
|
290 |
$found = false;
|
291 |
$post_categories = array();
|
292 |
$matchtypes = array();
|
293 |
$matches = array();
|
294 |
|
295 |
+
if ($config[PostieConfigOptions::CategoryBracket]) {
|
296 |
if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) { // [<category1>] [<category2>] <Subject>
|
297 |
$matchtypes[] = $matches;
|
298 |
}
|
299 |
}
|
300 |
|
301 |
+
if ($config[PostieConfigOptions::CategoryDash]) {
|
302 |
if (preg_match_all('/-(.[^-]*)-/', $subject, $matches)) { // -<category>- -<category2>- <Subject>
|
303 |
$matchtypes[] = $matches;
|
304 |
}
|
305 |
}
|
306 |
|
307 |
+
if ($config[PostieConfigOptions::CategoryColon]) {
|
308 |
if (preg_match('/(.+):\s?(.*)/', $subject, $matches)) { // <category>: <Subject>
|
309 |
$matchtypes[] = array(array(0 => $matches[1] . ':'), array(1 => $matches[1]));
|
310 |
}
|
348 |
}
|
349 |
}
|
350 |
}
|
351 |
+
if (!$found || !$config[PostieConfigOptions::CategoryRemove]) {
|
352 |
+
if ($config[PostieConfigOptions::PostType] == 'page') {
|
353 |
+
DebugEcho("tag_Categories: no default, page post type, not adding default category");
|
354 |
+
} else {
|
355 |
+
DebugEcho("tag_Categories: using default: $defaultCategoryId for post type {$config[PostieConfigOptions::PostType]}");
|
356 |
+
$post_categories[] = $defaultCategoryId;
|
357 |
+
}
|
358 |
$subject = $original_subject;
|
359 |
}
|
360 |
$subject = trim($subject);
|
380 |
* Also supports setting the Post Format.
|
381 |
*/
|
382 |
|
383 |
+
function tag_PostType(&$subject, &$config) {
|
384 |
|
385 |
+
$post_type = $config[PostieConfigOptions::PostType];
|
386 |
+
$post_format = $config[PostieConfigOptions::PostFormat];
|
387 |
$separated_subject = array();
|
388 |
$separated_subject[0] = "";
|
389 |
$separated_subject[1] = $subject;
|
401 |
DebugEcho("post type: found type '$trial'");
|
402 |
$post_type = $trial;
|
403 |
$subject = trim($separated_subject[1]);
|
404 |
+
$config[PostieConfigOptions::PostType] = $trial;
|
405 |
} elseif (in_array($trial, array_keys(get_post_format_strings()))) {
|
406 |
DebugEcho("post type: found format '$trial'");
|
407 |
$post_format = $trial;
|
408 |
$subject = trim($separated_subject[1]);
|
409 |
+
$config[PostieConfigOptions::PostFormat] = $trial;
|
410 |
}
|
411 |
|
412 |
return array('post_type' => $post_type, 'post_format' => $post_format);
|
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.
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL3
|
@@ -28,14 +28,14 @@
|
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
-
$Id: postie.php
|
32 |
*/
|
33 |
|
34 |
if (!defined('WPINC')) {
|
35 |
die; // Exit if accessed directly
|
36 |
}
|
37 |
|
38 |
-
define('POSTIE_VERSION', '1.9.
|
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.26
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL3
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
+
$Id: postie.php 1979823 2018-11-24 04:57:25Z WayneAllen $
|
32 |
*/
|
33 |
|
34 |
if (!defined('WPINC')) {
|
35 |
die; // Exit if accessed directly
|
36 |
}
|
37 |
|
38 |
+
define('POSTIE_VERSION', '1.9.26');
|
39 |
define('POSTIE_ROOT', dirname(__FILE__));
|
40 |
define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
41 |
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
|
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
-
Stable tag: 1.9.
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -107,6 +107,10 @@ All script, style and body tags are stripped from html emails.
|
|
107 |
Attachments are now processed in the order they were attached.
|
108 |
|
109 |
== CHANGELOG ==
|
|
|
|
|
|
|
|
|
110 |
= 1.9.25 (2018-10-02) =
|
111 |
* Add support for CIDs with surrounding <>
|
112 |
* Add support for URLs with unusual characters
|
7 |
Requires PHP: 5.3
|
8 |
Requires at least: 4.0
|
9 |
Tested up to: 4.9
|
10 |
+
Stable tag: 1.9.26
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
107 |
Attachments are now processed in the order they were attached.
|
108 |
|
109 |
== CHANGELOG ==
|
110 |
+
= 1.9.26 (2018-11-23) =
|
111 |
+
* If no category is specified and the post type is "page" then the default category is not added
|
112 |
+
* Additional CID changes
|
113 |
+
|
114 |
= 1.9.25 (2018-10-02) =
|
115 |
* Add support for CIDs with surrounding <>
|
116 |
* Add support for URLs with unusual characters
|