Postie - Version 1.4.25

Version Description

(2013.01.15) = * Fixed a bug where newlines were being removed erroneously.

Download this release

Release Info

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

Code changes from version 1.4.24 to 1.4.25

Revision CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ Revision: 653072
2
+ Last Changed Date: 2013-01-13 21:19:07 -0800 (Sun, 13 Jan 2013)
docs/Changes.txt CHANGED
@@ -10,6 +10,9 @@ All script, style and body tags are stripped from html emails.
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
 
 
 
13
  = 1.4.24 (2013.01.13) =
14
  * Fixed a bug where the original attachment name wasn't being used.
15
  * Fixed a bug where the #eimg# tags in the excerpt were not getting expanded.
10
  Attachments are now processed in the order they were attached.
11
 
12
  == CHANGELOG ==
13
+ = 1.4.25 (2013.01.15) =
14
+ * Fixed a bug where newlines were being removed erroneously.
15
+
16
  = 1.4.24 (2013.01.13) =
17
  * Fixed a bug where the original attachment name wasn't being used.
18
  * Fixed a bug where the #eimg# tags in the excerpt were not getting expanded.
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.24
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.25
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 652237 2013-01-14 01:57:39Z WayneAllen $
5
  */
6
 
7
  /* TODO
@@ -103,7 +103,7 @@ function EchoInfo($v) {
103
  echo "$v\n";
104
  } else {
105
  if (headers_sent()) {
106
- echo "<p>" . htmlspecialchars($v) . "</p>\n";
107
  }
108
  }
109
  LogInfo($v);
@@ -152,6 +152,8 @@ function tag_Date(&$content, $message_date) {
152
 
153
  function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
154
 
 
 
155
  extract($config);
156
 
157
  $attachments = array(
@@ -160,23 +162,38 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
160
  "image_files" => array() //holds the files for each image
161
  );
162
  EchoInfo("Message Id is :" . htmlentities($mimeDecodedEmail->headers["message-id"]));
163
- //DebugDump($mimeDecodedEmail);
 
164
 
165
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
166
- //DebugDump($mimeDecodedEmail);
 
167
 
168
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
169
- //DebugEcho("the content is $content");
 
170
 
171
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
172
 
173
  filter_Start($content, $config);
 
 
 
174
  filter_End($content, $config);
 
 
 
175
  filter_RemoveSignature($content, $config);
 
 
176
 
177
  $post_excerpt = tag_Excerpt($content, $filternewlines, $convertnewline);
178
-
 
 
179
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
 
 
180
 
181
  $message_date = NULL;
182
  if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) {
@@ -193,28 +210,59 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
193
  $message_date = tag_Date($content, $message_date);
194
 
195
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
 
 
196
 
197
  filter_ubb2HTML($content);
 
 
198
 
199
  $post_categories = tag_categories($subject, $default_post_category);
 
 
 
200
  $post_tags = tag_Tags($content, $default_post_tags);
 
 
201
 
202
  $comment_status = tag_AllowCommentsOnPost($content);
 
 
203
 
204
  if ($converturls) {
205
  $content = filter_Videos($content, $shortcode); //videos first so linkify doesn't mess with them
 
 
 
206
  $content = filter_linkify($content);
 
 
207
  }
208
 
209
  filter_VodafoneHandler($content, $attachments, $config);
 
 
 
210
  filter_ReplaceImageCIDs($content, $attachments, $config);
 
 
 
211
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config);
212
-
 
 
213
  filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config);
214
- DebugEcho("post image excerpt: $post_excerpt");
215
-
 
 
216
  $customImages = tag_CustomImageField($content, $attachments, $config);
 
 
 
217
  $post_type = tag_PostType($subject);
 
 
218
 
219
  $id = GetParentPostForReply($subject);
220
  if (empty($id)) {
@@ -262,8 +310,8 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
262
 
263
  //DebugEcho("pre-insert content: $content");
264
 
265
- DebugEcho("excerpt: $post_excerpt" );
266
-
267
  $details = array(
268
  'post_author' => $poster,
269
  'comment_author' => $postAuthorDetails['author'],
@@ -372,7 +420,7 @@ function filter_linkify($text) {
372
  # It turns urls into links, and video urls into embedded players
373
  //DebugEcho("begin: filter_linkify");
374
 
375
- $html = str_get_html($text);
376
  if ($html) {
377
  //DebugEcho("filter_linkify: " . $html->save());
378
  foreach ($html->find('text') as $element) {
@@ -392,7 +440,7 @@ function filter_Videos($text, $shortcode = false) {
392
  # It turns urls into links, and video urls into embedded players
393
  //DebugEcho("begin: filter_Videos");
394
 
395
- $html = str_get_html($text);
396
  if ($html) {
397
  foreach ($html->find('text') as $element) {
398
  $element->innertext = linkifyVideo($element->innertext, $shortcode);
@@ -869,6 +917,7 @@ function GetContent($part, &$attachments, $post_id, $poster, $config) {
869
  $meta_return .= htmlentities($part->body);
870
  }
871
  $meta_return = filter_StripPGP($meta_return);
 
872
  }
873
 
874
  break;
@@ -1256,9 +1305,9 @@ function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogE
1256
  DebugEcho("after HandleMessageEncoding");
1257
  if (!empty($charset) && strtolower($charset) != 'default') {
1258
  DebugEcho("converting from $charset to $blogEncoding");
1259
- //DebugEcho("before: $body");
1260
  $body = iconv($charset, $blogEncoding . '//TRANSLIT', $body);
1261
- //DebugEcho("after: $body");
1262
  }
1263
  return $body;
1264
  }
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 653157 2013-01-15 20:15:38Z WayneAllen $
5
  */
6
 
7
  /* TODO
103
  echo "$v\n";
104
  } else {
105
  if (headers_sent()) {
106
+ echo "<pre>" . htmlspecialchars($v) . "</pre>\n";
107
  }
108
  }
109
  LogInfo($v);
152
 
153
  function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config) {
154
 
155
+ $fulldebug = true;
156
+
157
  extract($config);
158
 
159
  $attachments = array(
162
  "image_files" => array() //holds the files for each image
163
  );
164
  EchoInfo("Message Id is :" . htmlentities($mimeDecodedEmail->headers["message-id"]));
165
+ if ($fulldebug)
166
+ DebugDump($mimeDecodedEmail);
167
 
168
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
169
+ if ($fulldebug)
170
+ DebugDump($mimeDecodedEmail);
171
 
172
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
173
+ if ($fulldebug)
174
+ DebugEcho("the content is $content");
175
 
176
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
177
 
178
  filter_Start($content, $config);
179
+ if ($fulldebug)
180
+ DebugEcho("post start: $content");
181
+
182
  filter_End($content, $config);
183
+ if ($fulldebug)
184
+ DebugEcho("post end: $content");
185
+
186
  filter_RemoveSignature($content, $config);
187
+ if ($fulldebug)
188
+ DebugEcho("post sig: $content");
189
 
190
  $post_excerpt = tag_Excerpt($content, $filternewlines, $convertnewline);
191
+ if ($fulldebug)
192
+ DebugEcho("post excerpt: $content");
193
+
194
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
195
+ if ($fulldebug)
196
+ DebugEcho("post author: $content");
197
 
198
  $message_date = NULL;
199
  if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) {
210
  $message_date = tag_Date($content, $message_date);
211
 
212
  list($post_date, $post_date_gmt, $delay) = DeterminePostDate($content, $message_date, $time_offset);
213
+ if ($fulldebug)
214
+ DebugEcho("post date: $content");
215
 
216
  filter_ubb2HTML($content);
217
+ if ($fulldebug)
218
+ DebugEcho("post ubb: $content");
219
 
220
  $post_categories = tag_categories($subject, $default_post_category);
221
+ if ($fulldebug)
222
+ DebugEcho("post category: $content");
223
+
224
  $post_tags = tag_Tags($content, $default_post_tags);
225
+ if ($fulldebug)
226
+ DebugEcho("post tag: $content");
227
 
228
  $comment_status = tag_AllowCommentsOnPost($content);
229
+ if ($fulldebug)
230
+ DebugEcho("post comment: $content");
231
 
232
  if ($converturls) {
233
  $content = filter_Videos($content, $shortcode); //videos first so linkify doesn't mess with them
234
+ if ($fulldebug)
235
+ DebugEcho("post video: $content");
236
+
237
  $content = filter_linkify($content);
238
+ if ($fulldebug)
239
+ DebugEcho("post linkify: $content");
240
  }
241
 
242
  filter_VodafoneHandler($content, $attachments, $config);
243
+ if ($fulldebug)
244
+ DebugEcho("post vodafone: $content");
245
+
246
  filter_ReplaceImageCIDs($content, $attachments, $config);
247
+ if ($fulldebug)
248
+ DebugEcho("post cid: $content");
249
+
250
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config);
251
+ if ($fulldebug)
252
+ DebugEcho("post body img: $content");
253
+
254
  filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config);
255
+ if ($fulldebug)
256
+ DebugEcho("post excerpt img: $content");
257
+
258
+
259
  $customImages = tag_CustomImageField($content, $attachments, $config);
260
+ if ($fulldebug)
261
+ DebugEcho("post custom: $content");
262
+
263
  $post_type = tag_PostType($subject);
264
+ if ($fulldebug)
265
+ DebugEcho("post type: $content");
266
 
267
  $id = GetParentPostForReply($subject);
268
  if (empty($id)) {
310
 
311
  //DebugEcho("pre-insert content: $content");
312
 
313
+ DebugEcho("excerpt: $post_excerpt");
314
+
315
  $details = array(
316
  'post_author' => $poster,
317
  'comment_author' => $postAuthorDetails['author'],
420
  # It turns urls into links, and video urls into embedded players
421
  //DebugEcho("begin: filter_linkify");
422
 
423
+ $html = str_get_html($text, true, true, DEFAULT_TARGET_CHARSET, false);
424
  if ($html) {
425
  //DebugEcho("filter_linkify: " . $html->save());
426
  foreach ($html->find('text') as $element) {
440
  # It turns urls into links, and video urls into embedded players
441
  //DebugEcho("begin: filter_Videos");
442
 
443
+ $html = str_get_html($text, true, true, DEFAULT_TARGET_CHARSET, false);
444
  if ($html) {
445
  foreach ($html->find('text') as $element) {
446
  $element->innertext = linkifyVideo($element->innertext, $shortcode);
917
  $meta_return .= htmlentities($part->body);
918
  }
919
  $meta_return = filter_StripPGP($meta_return);
920
+ DebugEcho("meta return: $meta_return");
921
  }
922
 
923
  break;
1305
  DebugEcho("after HandleMessageEncoding");
1306
  if (!empty($charset) && strtolower($charset) != 'default') {
1307
  DebugEcho("converting from $charset to $blogEncoding");
1308
+ DebugEcho("before: $body");
1309
  $body = iconv($charset, $blogEncoding . '//TRANSLIT', $body);
1310
+ DebugEcho("after: $body");
1311
  }
1312
  return $body;
1313
  }
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.24
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 652290 2013-01-14 05:19:07Z 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.25
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 653157 2013-01-15 20:15:38Z 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.24
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -398,6 +398,9 @@ All script, style and body tags are stripped from html emails.
398
  Attachments are now processed in the order they were attached.
399
 
400
  == CHANGELOG ==
 
 
 
401
  = 1.4.24 (2013.01.13) =
402
  * Fixed a bug where the original attachment name wasn't being used.
403
  * Fixed a bug where the #eimg# tags in the excerpt were not getting expanded.
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5
9
+ Stable tag: 1.4.25
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
398
  Attachments are now processed in the order they were attached.
399
 
400
  == CHANGELOG ==
401
+ = 1.4.25 (2013.01.15) =
402
+ * Fixed a bug where newlines were being removed erroneously.
403
+
404
  = 1.4.24 (2013.01.13) =
405
  * Fixed a bug where the original attachment name wasn't being used.
406
  * Fixed a bug where the #eimg# tags in the excerpt were not getting expanded.
test/data/linebreaks.var ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ s:5598:"Delivered-To: postie-test@devzing.com
2
+ Received: by 10.220.3.83 with SMTP id 19csp107597vcm; Tue, 15 Jan 2013
3
+ 03:34:23 -0800 (PST)
4
+ X-Received: by 10.14.174.132 with SMTP id x4mr237305628eel.39.1358249662791;
5
+ Tue, 15 Jan 2013 03:34:22 -0800 (PST)
6
+ Return-Path: <info.stephanfrank.nl@gmail.com>
7
+ Received: from mail-ea0-f173.google.com (mail-ea0-f173.google.com
8
+ [209.85.215.173]) by mx.google.com with ESMTPS id
9
+ s42si44619974eem.70.2013.01.15.03.34.22 (version=TLSv1
10
+ cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 03:34:22 -0800 (PST)
11
+ Received-SPF: pass (google.com: domain of info.stephanfrank.nl@gmail.com
12
+ designates 209.85.215.173 as permitted sender) client-ip=209.85.215.173;
13
+ Authentication-Results: mx.google.com; spf=pass (google.com: domain of
14
+ info.stephanfrank.nl@gmail.com designates 209.85.215.173 as permitted sender)
15
+ smtp.mail=info.stephanfrank.nl@gmail.com; dkim=pass header.i=@gmail.com
16
+ Received: by mail-ea0-f173.google.com with SMTP id i13so2078848eaa.4 for
17
+ <postie-test@devzing.com>; Tue, 15 Jan 2013 03:34:22 -0800 (PST)
18
+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
19
+ h=x-received:sender:subject:from:content-type:x-mailer:message-id
20
+ :date:to:content-transfer-encoding:mime-version;
21
+ bh=Hi0PYXNlusF3XJzS83/g9iZL0oW66DSpsnNb45g/eBc=;
22
+ b=ubRV63NuLxCprmwr3Nm3HZkDieQtV3ZvH1dwi3FewvLlvUFYpdOmd6NLDqnz2AmvV0
23
+ uCBbz+KQ8K8RlIj+kGuGm9AKXkQZyrn7jgb8oqnidRMH4MBpO2p3vyaVzFXXDpojC1oz
24
+ 4fFBj+ZAu0w35Y/hEbZ7vD3Npc7vhcSf4lkKvxh7TQ5uY6Z5yoWVPbTYMzSXRctYFNmA
25
+ n96hIuuzmLPx1+MpwFVJRJOtAx5xnLF2AuDUHKfBgMuiHkJla6VwU9isjtx4aapUz4nv
26
+ /ox0kxa+n2qio9QUIac977wyJe2p3p1Y3Y3lP6U+tIdjpuYrsAwpMTsNmE2dfzAzYu/2 /4ng==
27
+ X-Received: by 10.14.219.72 with SMTP id l48mr241362170eep.37.1358249662206;
28
+ Tue, 15 Jan 2013 03:34:22 -0800 (PST)
29
+ Return-Path: <info.stephanfrank.nl@gmail.com>
30
+ Received: from [192.168.1.76] (s55975e63.adsl.online.nl. [85.151.94.99]) by
31
+ mx.google.com with ESMTPS id w44sm25213135eep.6.2013.01.15.03.34.20
32
+ (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013
33
+ 03:34:21 -0800 (PST)
34
+ Sender: Stephan Frank <info.stephanfrank.nl@gmail.com>
35
+ Subject: Test mail Stephan
36
+ From: Stephan Frank <info@stephanfrank.nl>
37
+ Content-Type: multipart/alternative;
38
+ boundary=Apple-Mail-5188981C-92D4-4E12-B741-48865CC69241
39
+ X-Mailer: iPad Mail (10A523)
40
+ Message-Id: <B66784C4-DD84-4474-8C06-DCA9E5F292E0@stephanfrank.nl>
41
+ Date: Tue, 15 Jan 2013 12:34:19 +0100
42
+ To: "postie-test@devzing.com" <postie-test@devzing.com>
43
+ Content-Transfer-Encoding: 7bit
44
+ Mime-Version: 1.0 (1.0)
45
+
46
+
47
+ --Apple-Mail-5188981C-92D4-4E12-B741-48865CC69241
48
+ Content-Type: text/plain;
49
+ charset=us-ascii
50
+ Content-Transfer-Encoding: 7bit
51
+
52
+ Test
53
+
54
+ Een stuck TekstEen stuck TekstEen stuck TekstEen stuck Tekst
55
+
56
+ Een stuck TekstEen stuck Tekst
57
+
58
+
59
+ Een stuck TekstEen stuck Tekst
60
+ --Apple-Mail-5188981C-92D4-4E12-B741-48865CC69241
61
+ Content-Type: text/html;
62
+ charset=utf-8
63
+ Content-Transfer-Encoding: quoted-printable
64
+
65
+ <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
66
+ utf-8"></head><body dir=3D"auto"><span style=3D"font-family: '.Helvetica Neu=
67
+ eUI'; font-size: 18px; line-height: 24px; -webkit-tap-highlight-color: rgba(=
68
+ 26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(130, 98, 83, 0.0=
69
+ 976563); -webkit-composition-frame-color: rgba(191, 107, 82, 0.496094); ">Te=
70
+ st</span><div style=3D"font-family: '.Helvetica NeueUI'; font-size: 18px; li=
71
+ ne-height: 24px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -w=
72
+ ebkit-composition-fill-color: rgba(130, 98, 83, 0.0976563); -webkit-composit=
73
+ ion-frame-color: rgba(191, 107, 82, 0.496094); "><br></div><div style=3D"fon=
74
+ t-family: '.Helvetica NeueUI'; font-size: 18px; line-height: 24px; -webkit-t=
75
+ ap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-col=
76
+ or: rgba(130, 98, 83, 0.0976563); -webkit-composition-frame-color: rgba(191,=
77
+ 107, 82, 0.496094); ">Een stuck TekstEen stuck TekstEen stuck TekstEen stuc=
78
+ k Tekst</div><div style=3D"font-family: '.Helvetica NeueUI'; font-size: 18px=
79
+ ; line-height: 24px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875)=
80
+ ; -webkit-composition-fill-color: rgba(130, 98, 83, 0.0976563); -webkit-comp=
81
+ osition-frame-color: rgba(191, 107, 82, 0.496094); "><br></div><div style=3D=
82
+ "font-family: '.Helvetica NeueUI'; font-size: 18px; line-height: 24px; -webk=
83
+ it-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill=
84
+ -color: rgba(130, 98, 83, 0.0976563); -webkit-composition-frame-color: rgba(=
85
+ 191, 107, 82, 0.496094); ">Een stuck TekstEen stuck Tekst</div><div style=3D=
86
+ "font-family: '.Helvetica NeueUI'; font-size: 18px; line-height: 24px; -webk=
87
+ it-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill=
88
+ -color: rgba(130, 98, 83, 0.0976563); -webkit-composition-frame-color: rgba(=
89
+ 191, 107, 82, 0.496094); "><br></div><div style=3D"font-family: '.Helvetica N=
90
+ eueUI'; font-size: 18px; line-height: 24px; -webkit-tap-highlight-color: rgb=
91
+ a(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(130, 98, 83, 0=
92
+ .0976563); -webkit-composition-frame-color: rgba(191, 107, 82, 0.496094); ">=
93
+ <br></div><div style=3D"font-family: '.Helvetica NeueUI'; font-size: 18px; l=
94
+ ine-height: 24px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -=
95
+ webkit-composition-fill-color: rgba(130, 98, 83, 0.0976563); -webkit-composi=
96
+ tion-frame-color: rgba(191, 107, 82, 0.496094); ">Een stuck TekstEen stuck T=
97
+ ekst</div></body></html>=
98
+
99
+ --Apple-Mail-5188981C-92D4-4E12-B741-48865CC69241--
100
+ ";
test/inlineimageTest.php CHANGED
@@ -16,6 +16,16 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
16
  return $post;
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
19
  function testBase64Subject() {
20
  $message = file_get_contents("data/b-encoded-subject.var");
21
  $email = unserialize($message);
@@ -37,10 +47,19 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
37
  $config['imagetemplate'] = '<a href="{FILELINK}">{FILENAME}</a>';
38
 
39
  $post = $this->process_file("data/inline.var", $config);
40
- $this->assertEquals('test<div><br></div><div><img src="http://example.net/wp-content/uploads/filename" alt="Inline image 1"><br></div><div><br></div><div>test</div> ', $post['post_content']);
41
  $this->assertEquals('inline', $post['post_title']);
42
  }
43
 
 
 
 
 
 
 
 
 
 
44
  function testjapaneseAttachment() {
45
 
46
  $config = config_GetDefaults();
@@ -56,7 +75,7 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
56
  $config['prefer_text_type'] = 'html';
57
 
58
  $post = $this->process_file("data/ics-attachment.var", $config);
59
- $this->assertEquals("<div dir='ltr'>sample text<div><br></div></div> <a href='http://example.net/wp-content/uploads/filename'><img src='localhost/postie/icons/silver/default-32.png' alt='default icon' />sample.ics</a> ", $post['post_content']);
60
  }
61
 
62
  function testTagsImg() {
@@ -70,7 +89,7 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
70
  $this->assertEquals(2, count($post['tags_input']));
71
  $this->assertEquals('test', $post['tags_input'][0]);
72
  $this->assertEquals('tag2', $post['tags_input'][1]);
73
- $this->assertEquals(' <a href="http://example.net/wp-content/uploads/filename">close_account.png</a><br /> ', $post['post_content']);
74
  }
75
 
76
  function testSig() {
@@ -78,7 +97,7 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
78
  $config['prefer_text_type'] = 'plain';
79
 
80
  $post = $this->process_file("data/signature.var", $config);
81
- $this->assertEquals('test content ', $post['post_content']);
82
 
83
  $config['prefer_text_type'] = 'html';
84
  $post = $this->process_file("data/signature.var", $config);
16
  return $post;
17
  }
18
 
19
+ function testSimpleHtmlDomWithWhitespace() {
20
+ $html = str_get_html("\n", true, true, DEFAULT_TARGET_CHARSET, false);
21
+ $r = $html->save();
22
+ $this->assertEquals("\n", $r);
23
+
24
+ $html = str_get_html("<div>\n<p>some text</p>\n</div>\n", true, true, DEFAULT_TARGET_CHARSET, false);
25
+ $r = $html->save();
26
+ $this->assertEquals("<div>\n<p>some text</p>\n</div>\n", $r);
27
+ }
28
+
29
  function testBase64Subject() {
30
  $message = file_get_contents("data/b-encoded-subject.var");
31
  $email = unserialize($message);
47
  $config['imagetemplate'] = '<a href="{FILELINK}">{FILENAME}</a>';
48
 
49
  $post = $this->process_file("data/inline.var", $config);
50
+ $this->assertEquals('test<div><br></div><div><img src="http://example.net/wp-content/uploads/filename" alt="Inline image 1"><br></div><div><br></div><div>test</div> ', $post['post_content']);
51
  $this->assertEquals('inline', $post['post_title']);
52
  }
53
 
54
+ function testLineBreaks() {
55
+
56
+ $config = config_GetDefaults();
57
+ $config['convertnewline'] = true;
58
+
59
+ $post = $this->process_file("data/linebreaks.var", $config);
60
+ $this->assertEquals("Test<br />\nEen stuck TekstEen stuck TekstEen stuck TekstEen stuck Tekst<br />\nEen stuck TekstEen stuck Tekst<br />\n<br />\nEen stuck TekstEen stuck Tekst<br />\n<br />\n", $post['post_content']);
61
+ }
62
+
63
  function testjapaneseAttachment() {
64
 
65
  $config = config_GetDefaults();
75
  $config['prefer_text_type'] = 'html';
76
 
77
  $post = $this->process_file("data/ics-attachment.var", $config);
78
+ $this->assertEquals("<div dir='ltr'>sample text<div><br></div></div> <a href='http://example.net/wp-content/uploads/filename'><img src='localhost/postie/icons/silver/default-32.png' alt='default icon' />sample.ics</a> ", $post['post_content']);
79
  }
80
 
81
  function testTagsImg() {
89
  $this->assertEquals(2, count($post['tags_input']));
90
  $this->assertEquals('test', $post['tags_input'][0]);
91
  $this->assertEquals('tag2', $post['tags_input'][1]);
92
+ $this->assertEquals(' <a href="http://example.net/wp-content/uploads/filename">close_account.png</a><br /> ', $post['post_content']);
93
  }
94
 
95
  function testSig() {
97
  $config['prefer_text_type'] = 'plain';
98
 
99
  $post = $this->process_file("data/signature.var", $config);
100
+ $this->assertEquals('test content ', $post['post_content']);
101
 
102
  $config['prefer_text_type'] = 'html';
103
  $post = $this->process_file("data/signature.var", $config);
test/postie-functionsTest.php CHANGED
@@ -501,6 +501,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
501
  }
502
 
503
  public function testfilter_Videos() {
 
504
  $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));
505
  $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", true));
506
  }
501
  }
502
 
503
  public function testfilter_Videos() {
504
+ $this->assertEquals("video\ntest", filter_Videos("video\ntest"));
505
  $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));
506
  $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", true));
507
  }