Postie - Version 1.5.4

Version Description

(2013.05.01) = * Added support for default post format * Fixed bug where replies were getting attached to the wrong post * Fixed bug where tags were not being detected correctly in html emails * Fixed bug in reply detection

Download this release

Release Info

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

Code changes from version 1.5.3 to 1.5.4

Revision CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ Revision: 706597
2
+ Last Changed Date: 2013-04-16 18:46:28 -0700 (Tue, 16 Apr 2013)
config_form.php CHANGED
@@ -127,7 +127,7 @@
127
  <?php endif; ?>
128
  </td>
129
  </tr>
130
-
131
  <?php echo BuildBooleanSelect(__("Use Transport Layer Security (TLS)"), 'postie-settings[email_tls]', $email_tls, __("Choose Yes if your server requres TLS")); ?>
132
 
133
  <tr>
@@ -338,6 +338,27 @@
338
  </td>
339
  </tr>
340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  <tr>
342
  <th width="33%" valign="top" scope="row"><?php _e('Default Title:', 'postie') ?> </th>
343
  <td>
@@ -371,49 +392,45 @@
371
  <input name='postie-settings[message_end]' type="text" id='postie-settings-message_end' value="<?php echo esc_attr($message_end); ?>" size="50" /><br />
372
  </td>
373
  </tr>
374
- </table>
375
- <a style='cursor:pointer;' onclick='showAdvanced("message-advanced", "message-advanced-arrow");'><span id="message-advanced-arrow">&#9660;</span> Advanced options</a>
376
- <div id="message-advanced" >
377
- <table class='form-table'>
378
- <?php
379
- echo BuildBooleanSelect("Wrap content in pre tags", "postie-settings[wrap_pre]", $wrap_pre);
380
- echo BuildBooleanSelect("Filter newlines", "postie-settings[filternewlines]", $filternewlines, "Retain newlines from plain text. Set to no if using markdown or textitle syntax");
381
- echo BuildBooleanSelect("Replace newline characters with html line breaks (&lt;br /&gt;)", "postie-settings[convertnewline]", $convertnewline);
382
- echo BuildBooleanSelect("Return rejected mail to sender", "postie-settings[return_to_sender]", $return_to_sender);
383
- ?>
384
- <tr>
385
- <th>
386
- <?php _e("Send post confirmation e-mail to", 'postie') ?>
387
- </th>
388
- <td>
389
- <select name='postie-settings[confirmation_email]' id='postie-settings-confirmation_email'>
390
- <option value="sender" <?php echo($confirmation_email == "sender") ? "selected" : "" ?>><?php _e('sender', 'postie') ?></option>
391
- <option value="admin" <?php echo ($confirmation_email == "admin") ? "selected" : "" ?>><?php _e('administrator', 'postie') ?></option>
392
- <option value="both" <?php echo ($confirmation_email == "both") ? "selected" : "" ?>><?php _e('sender and administrator', 'postie') ?></option>
393
- <option value="" <?php echo ($confirmation_email == "") ? "selected" : "" ?>><?php _e('none', 'postie') ?></option>
394
- </select>
395
- </td>
396
- </tr>
397
-
398
- <?php
399
- echo BuildBooleanSelect("Automatically convert urls to links", "postie-settings[converturls]", $converturls);
400
- echo BuildBooleanSelect("Use shortcode for embedding video (youtube and others)", "postie-settings[shortcode]", $shortcode);
401
- ?>
402
- <tr>
403
- <th width="33%" valign="top" scope="row"><?php _e('Encoding for pages and feeds:', 'postie') ?> </th>
404
- <td>
405
- <input name='postie-settings[message_encoding]' type="text" id='postie-settings-message_encoding' value="<?php echo esc_attr($message_encoding); ?>" size="10" />
406
- <span class='recommendation'>UTF-8 <?php _e("should handle ISO-8859-1 as well", 'postie'); ?></span>
407
- </td>
408
- </tr>
409
- <?php echo BuildBooleanSelect("Decode Quoted Printable Data", "postie-settings[message_dequote]", $message_dequote); ?>
410
- <?php echo BuildTextArea("Supported MIME Types", "postie-settings[supported_file_types]", $supported_file_types, "Add just the type (not the subtype). Text, Video, Audio, Image and Multipart are always supported. Put each type on a single line."); ?>
411
- <?php echo BuildTextArea("Banned File Names", "postie-settings[banned_files_list]", $banned_files_list, "Put each file name on a single line.Files matching this list will never be posted to your blog. You can use wildcards such as *.xls, or *.* for all files"); ?>
412
- <?php echo BuildBooleanSelect("Drop The Signature From Mail", "postie-settings[drop_signature]", $drop_signature); ?>
413
- <?php echo BuildTextArea("Signature Patterns", "postie-settings[sig_pattern_list]", $sig_pattern_list, "Put each pattern on a separate line and make sure to escape any special characters."); ?>
414
- <?php echo BuildTextArea("Allowed SMTP servers", "postie-settings[smtp]", $smtp, "Only allow messages which have been sent throught the following smtp servers. Put each server on a separate line. Leave blank to not check smtp servers."); ?>
415
- </table>
416
- </div> <!-- advanced options -->
417
  </div>
418
  <div id="simpleTabs-content-4" class="simpleTabs-content">
419
  <table class='form-table'>
@@ -441,7 +458,7 @@
441
  value="<?php echo esc_attr($selected_imagetemplate) ?>" />
442
  <select name='imagetemplateselect' id='imagetemplateselect'
443
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
444
- 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
445
  <?php
446
  include('templates/image_templates.php');
447
  $styleOptions = $imageTemplates;
@@ -465,7 +482,7 @@
465
  <?php _e('Preview', 'postie'); ?>
466
  <div id='imageTemplatePreview'></div>
467
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
468
- "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
469
  <?php echo esc_attr($imagetemplate) ?>
470
  </textarea>
471
  </td>
@@ -515,7 +532,7 @@
515
  <?php _e('Preview', 'postie'); ?>
516
  <div id='video1TemplatePreview'></div>
517
  <textarea onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template',
518
- 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', true);" cols='70' rows='7' id='postie-settings-video1template'
519
  name='postie-settings[video1template]'><?php echo esc_attr($video1template) ?></textarea>
520
  </td>
521
  </tr>
@@ -539,7 +556,7 @@
539
  value="<?php echo esc_attr($selected_video2template) ?>" />
540
  <select name='video2templateselect' id='video2templateselect'
541
  onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
542
- 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
543
  <?php
544
  include('templates/video2_templates.php');
545
  $styleOptions = $video2Templates;
@@ -562,7 +579,7 @@
562
  <?php _e('Preview', 'postie'); ?>
563
  <div id='video2TemplatePreview'></div>
564
  <textarea onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
565
- 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', true);" cols='70' rows='7' id='postie-settings-video2template'
566
  name='postie-settings[video2template]'>
567
  <?php echo esc_attr($video2template) ?>
568
  </textarea>
@@ -589,7 +606,7 @@
589
  value="<?php echo esc_attr($selected_audiotemplate) ?>" />
590
  <select name='audiotemplateselect' id='audiotemplateselect'
591
  onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
592
- 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
593
  <?php
594
  include('templates/audio_templates.php');
595
  $styleOptions = $audioTemplates;
@@ -613,7 +630,7 @@
613
  <?php _e('Preview', 'postie'); ?>
614
  <div id='audioTemplatePreview'></div>
615
  <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
616
- 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
617
  name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
618
  </td>
619
  </tr>
@@ -717,96 +734,96 @@
717
 
718
  <?php $iconDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/icons'; ?>
719
  <script type="text/javascript">
720
- jQuery(document).ready(function() {
721
- jQuery("#simpleTabs").simpleTabs({
722
- fadeSpeed: "medium", // @param : low, medium, fast
723
- defautContent: 1, // @param : number ( simpleTabs-nav-number)
724
- autoNav: "false", // @param : true or false
725
- closeTabs: "false" // @param : true or false;
726
- });
727
-
728
- });
729
-
730
- function changeIconSet(selectBox, size) {
731
- var iconSet = document.getElementById('postie-settings-icon_set');
732
- var iconSize = document.getElementById('postie-settings-icon_size');
733
- var preview = document.getElementById('postie-settings-attachment_preview');
734
- var iconDir = '<?php echo $iconDir ?>/';
735
- if (size == true) {
736
- var hiddenInput = iconSize
737
- } else {
738
- var hiddenInput = iconSet;
739
- }
740
- for (i = 0; i < selectBox.options.length; i++) {
741
- if (selectBox.options[i].selected == true) {
742
- hiddenInput.value = selectBox.options[i].value;
743
- }
744
- }
745
- var fileTypes = new Array('doc', 'pdf', 'xls', 'ppt');
746
- preview.innerHTML = '';
747
- for (j = 0; j < fileTypes.length; j++) {
748
- preview.innerHTML += "<img src='" + iconDir + iconSet.value + '/' +
749
- fileTypes[j] + '-' + iconSize.value + ".png' />";
750
- }
751
- preview.innerHTML += '<br />Here is some sample text with a link to a ' +
752
- 'word document that I think you might find interesting<br />' +
753
- "<a href='#'><img style='text-decoration:none' src='" +
754
- iconDir + iconSet.value + '/doc' +
755
- '-' + iconSize.value + ".png' />Interesting document</a>";
756
- }
757
-
758
- function changeStyle(preview, template, select, selected, sample, custom) {
759
- var preview = document.getElementById(preview);
760
- var pageStyles = document.getElementById(select);
761
- var selectedStyle;
762
- var hiddenStyle = document.getElementById(selected);
763
- var pageStyle = document.getElementById(template);
764
- if (custom == true) {
765
- selectedStyle = pageStyles.options[pageStyles.options.length - 1];
766
- selectedStyle.value = pageStyle.value;
767
- selectedStyle.selected = true;
768
- } else {
769
- for (i = 0; i < pageStyles.options.length; i++) {
770
- if (pageStyles.options[i].selected == true) {
771
- selectedStyle = pageStyles.options[i];
772
- }
773
- }
774
- }
775
- hiddenStyle.value = selectedStyle.innerHTML
776
- var previewHTML = selectedStyle.value;
777
- var fileLink = '<?php echo $templateDir ?>/' + sample;
778
- var thumb = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
779
- '-150x150.jpg');
780
- var medium = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
781
- '-300x200.jpg');
782
- var large = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
783
- '-1024x682.jpg');
784
- previewHTML = previewHTML.replace(/{FILELINK}/g, fileLink);
785
- previewHTML = previewHTML.replace(/{IMAGE}/g, fileLink);
786
- previewHTML = previewHTML.replace(/{FILENAME}/, sample);
787
- previewHTML = previewHTML.replace(/{THUMB(NAIL|)}/, thumb);
788
- previewHTML = previewHTML.replace(/{MEDIUM}/, medium);
789
- previewHTML = previewHTML.replace(/{LARGE}/, large);
790
- previewHTML = previewHTML.replace(/{CAPTION}/g, 'Spencer smiling');
791
- preview.innerHTML = previewHTML;
792
- pageStyle.value = selectedStyle.value;
793
- }
794
-
795
- function showAdvanced(advancedId, arrowId) {
796
- var advanced = document.getElementById(advancedId);
797
- var arrow = document.getElementById(arrowId);
798
- if (advanced.style.display == 'none') {
799
- advanced.style.display = 'block';
800
- arrow.innerHTML = '&#9660;';
801
- } else {
802
- advanced.style.display = 'none';
803
- arrow.innerHTML = '&#9654;';
804
- }
805
- }
806
-
807
- changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate', 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg', false);
808
- changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);
809
- changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', false);
810
- changeStyle('video2TemplatePreview', 'postie-settings-video2template', 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', false);
811
- changeIconSet(document.getElementById('icon_set_select'));
812
  </script>
127
  <?php endif; ?>
128
  </td>
129
  </tr>
130
+
131
  <?php echo BuildBooleanSelect(__("Use Transport Layer Security (TLS)"), 'postie-settings[email_tls]', $email_tls, __("Choose Yes if your server requres TLS")); ?>
132
 
133
  <tr>
338
  </td>
339
  </tr>
340
 
341
+ <tr>
342
+ <th width="33%" valign="top" scope="row"><?php _e('Default Post Format:', 'postie') ?> </th>
343
+ <td>
344
+ <select name='postie-settings[post_format]' id='postie-settings-post_format'>
345
+ <?php
346
+ $formats = get_theme_support('post-formats');
347
+ if (is_array($formats[0])) {
348
+ array_unshift($formats[0], "standard");
349
+ foreach ($formats[0] as $format) {
350
+ $selected = "";
351
+ if ($config['post_format'] == $format) {
352
+ $selected = " selected='selected'";
353
+ }
354
+ echo "<option value='$format'$selected>$format</option>";
355
+ }
356
+ }
357
+ ?>
358
+ </select>
359
+ </td>
360
+ </tr>
361
+
362
  <tr>
363
  <th width="33%" valign="top" scope="row"><?php _e('Default Title:', 'postie') ?> </th>
364
  <td>
392
  <input name='postie-settings[message_end]' type="text" id='postie-settings-message_end' value="<?php echo esc_attr($message_end); ?>" size="50" /><br />
393
  </td>
394
  </tr>
395
+
396
+ <?php
397
+ echo BuildBooleanSelect("Wrap content in pre tags", "postie-settings[wrap_pre]", $wrap_pre);
398
+ echo BuildBooleanSelect("Filter newlines", "postie-settings[filternewlines]", $filternewlines, "Retain newlines from plain text. Set to no if using markdown or textitle syntax");
399
+ echo BuildBooleanSelect("Replace newline characters with html line breaks (&lt;br /&gt;)", "postie-settings[convertnewline]", $convertnewline, "Filter newlines must be turned on for this option to take effect.");
400
+ echo BuildBooleanSelect("Return rejected mail to sender", "postie-settings[return_to_sender]", $return_to_sender);
401
+ ?>
402
+ <tr>
403
+ <th>
404
+ <?php _e("Send post confirmation e-mail to", 'postie') ?>
405
+ </th>
406
+ <td>
407
+ <select name='postie-settings[confirmation_email]' id='postie-settings-confirmation_email'>
408
+ <option value="sender" <?php echo($confirmation_email == "sender") ? "selected" : "" ?>><?php _e('sender', 'postie') ?></option>
409
+ <option value="admin" <?php echo ($confirmation_email == "admin") ? "selected" : "" ?>><?php _e('administrator', 'postie') ?></option>
410
+ <option value="both" <?php echo ($confirmation_email == "both") ? "selected" : "" ?>><?php _e('sender and administrator', 'postie') ?></option>
411
+ <option value="" <?php echo ($confirmation_email == "") ? "selected" : "" ?>><?php _e('none', 'postie') ?></option>
412
+ </select>
413
+ </td>
414
+ </tr>
415
+
416
+ <?php
417
+ echo BuildBooleanSelect("Automatically convert urls to links", "postie-settings[converturls]", $converturls);
418
+ echo BuildBooleanSelect("Use shortcode for embedding video (youtube and others)", "postie-settings[shortcode]", $shortcode);
419
+ ?>
420
+ <tr>
421
+ <th width="33%" valign="top" scope="row"><?php _e('Encoding for pages and feeds:', 'postie') ?> </th>
422
+ <td>
423
+ <input name='postie-settings[message_encoding]' type="text" id='postie-settings-message_encoding' value="<?php echo esc_attr($message_encoding); ?>" size="10" />
424
+ <span class='recommendation'>UTF-8 <?php _e("should handle ISO-8859-1 as well", 'postie'); ?></span>
425
+ </td>
426
+ </tr>
427
+ <?php echo BuildBooleanSelect("Decode Quoted Printable Data", "postie-settings[message_dequote]", $message_dequote); ?>
428
+ <?php echo BuildTextArea("Supported MIME Types", "postie-settings[supported_file_types]", $supported_file_types, "Add just the type (not the subtype). Text, Video, Audio, Image and Multipart are always supported. Put each type on a single line."); ?>
429
+ <?php echo BuildTextArea("Banned File Names", "postie-settings[banned_files_list]", $banned_files_list, "Put each file name on a single line.Files matching this list will never be posted to your blog. You can use wildcards such as *.xls, or *.* for all files"); ?>
430
+ <?php echo BuildBooleanSelect("Drop The Signature From Mail", "postie-settings[drop_signature]", $drop_signature); ?>
431
+ <?php echo BuildTextArea("Signature Patterns", "postie-settings[sig_pattern_list]", $sig_pattern_list, "Put each pattern on a separate line and make sure to escape any special characters."); ?>
432
+ <?php echo BuildTextArea("Allowed SMTP servers", "postie-settings[smtp]", $smtp, "Only allow messages which have been sent throught the following smtp servers. Put each server on a separate line. Leave blank to not check smtp servers."); ?>
433
+ </table>
 
 
 
 
434
  </div>
435
  <div id="simpleTabs-content-4" class="simpleTabs-content">
436
  <table class='form-table'>
458
  value="<?php echo esc_attr($selected_imagetemplate) ?>" />
459
  <select name='imagetemplateselect' id='imagetemplateselect'
460
  onchange="changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate',
461
+ 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg');" >
462
  <?php
463
  include('templates/image_templates.php');
464
  $styleOptions = $imageTemplates;
482
  <?php _e('Preview', 'postie'); ?>
483
  <div id='imageTemplatePreview'></div>
484
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
485
+ "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
486
  <?php echo esc_attr($imagetemplate) ?>
487
  </textarea>
488
  </td>
532
  <?php _e('Preview', 'postie'); ?>
533
  <div id='video1TemplatePreview'></div>
534
  <textarea onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template',
535
+ 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', true);" cols='70' rows='7' id='postie-settings-video1template'
536
  name='postie-settings[video1template]'><?php echo esc_attr($video1template) ?></textarea>
537
  </td>
538
  </tr>
556
  value="<?php echo esc_attr($selected_video2template) ?>" />
557
  <select name='video2templateselect' id='video2templateselect'
558
  onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
559
+ 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv');" >
560
  <?php
561
  include('templates/video2_templates.php');
562
  $styleOptions = $video2Templates;
579
  <?php _e('Preview', 'postie'); ?>
580
  <div id='video2TemplatePreview'></div>
581
  <textarea onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
582
+ 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', true);" cols='70' rows='7' id='postie-settings-video2template'
583
  name='postie-settings[video2template]'>
584
  <?php echo esc_attr($video2template) ?>
585
  </textarea>
606
  value="<?php echo esc_attr($selected_audiotemplate) ?>" />
607
  <select name='audiotemplateselect' id='audiotemplateselect'
608
  onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
609
+ 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);" >
610
  <?php
611
  include('templates/audio_templates.php');
612
  $styleOptions = $audioTemplates;
630
  <?php _e('Preview', 'postie'); ?>
631
  <div id='audioTemplatePreview'></div>
632
  <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
633
+ 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
634
  name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
635
  </td>
636
  </tr>
734
 
735
  <?php $iconDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/icons'; ?>
736
  <script type="text/javascript">
737
+ jQuery(document).ready(function() {
738
+ jQuery("#simpleTabs").simpleTabs({
739
+ fadeSpeed: "medium", // @param : low, medium, fast
740
+ defautContent: 1, // @param : number ( simpleTabs-nav-number)
741
+ autoNav: "false", // @param : true or false
742
+ closeTabs: "false" // @param : true or false;
743
+ });
744
+
745
+ });
746
+
747
+ function changeIconSet(selectBox, size) {
748
+ var iconSet = document.getElementById('postie-settings-icon_set');
749
+ var iconSize = document.getElementById('postie-settings-icon_size');
750
+ var preview = document.getElementById('postie-settings-attachment_preview');
751
+ var iconDir = '<?php echo $iconDir ?>/';
752
+ if (size == true) {
753
+ var hiddenInput = iconSize
754
+ } else {
755
+ var hiddenInput = iconSet;
756
+ }
757
+ for (i = 0; i < selectBox.options.length; i++) {
758
+ if (selectBox.options[i].selected == true) {
759
+ hiddenInput.value = selectBox.options[i].value;
760
+ }
761
+ }
762
+ var fileTypes = new Array('doc', 'pdf', 'xls', 'ppt');
763
+ preview.innerHTML = '';
764
+ for (j = 0; j < fileTypes.length; j++) {
765
+ preview.innerHTML += "<img src='" + iconDir + iconSet.value + '/' +
766
+ fileTypes[j] + '-' + iconSize.value + ".png' />";
767
+ }
768
+ preview.innerHTML += '<br />Here is some sample text with a link to a ' +
769
+ 'word document that I think you might find interesting<br />' +
770
+ "<a href='#'><img style='text-decoration:none' src='" +
771
+ iconDir + iconSet.value + '/doc' +
772
+ '-' + iconSize.value + ".png' />Interesting document</a>";
773
+ }
774
+
775
+ function changeStyle(preview, template, select, selected, sample, custom) {
776
+ var preview = document.getElementById(preview);
777
+ var pageStyles = document.getElementById(select);
778
+ var selectedStyle;
779
+ var hiddenStyle = document.getElementById(selected);
780
+ var pageStyle = document.getElementById(template);
781
+ if (custom == true) {
782
+ selectedStyle = pageStyles.options[pageStyles.options.length - 1];
783
+ selectedStyle.value = pageStyle.value;
784
+ selectedStyle.selected = true;
785
+ } else {
786
+ for (i = 0; i < pageStyles.options.length; i++) {
787
+ if (pageStyles.options[i].selected == true) {
788
+ selectedStyle = pageStyles.options[i];
789
+ }
790
+ }
791
+ }
792
+ hiddenStyle.value = selectedStyle.innerHTML
793
+ var previewHTML = selectedStyle.value;
794
+ var fileLink = '<?php echo $templateDir ?>/' + sample;
795
+ var thumb = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
796
+ '-150x150.jpg');
797
+ var medium = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
798
+ '-300x200.jpg');
799
+ var large = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
800
+ '-1024x682.jpg');
801
+ previewHTML = previewHTML.replace(/{FILELINK}/g, fileLink);
802
+ previewHTML = previewHTML.replace(/{IMAGE}/g, fileLink);
803
+ previewHTML = previewHTML.replace(/{FILENAME}/, sample);
804
+ previewHTML = previewHTML.replace(/{THUMB(NAIL|)}/, thumb);
805
+ previewHTML = previewHTML.replace(/{MEDIUM}/, medium);
806
+ previewHTML = previewHTML.replace(/{LARGE}/, large);
807
+ previewHTML = previewHTML.replace(/{CAPTION}/g, 'Spencer smiling');
808
+ preview.innerHTML = previewHTML;
809
+ pageStyle.value = selectedStyle.value;
810
+ }
811
+
812
+ function showAdvanced(advancedId, arrowId) {
813
+ var advanced = document.getElementById(advancedId);
814
+ var arrow = document.getElementById(arrowId);
815
+ if (advanced.style.display == 'none') {
816
+ advanced.style.display = 'block';
817
+ arrow.innerHTML = '&#9660;';
818
+ } else {
819
+ advanced.style.display = 'none';
820
+ arrow.innerHTML = '&#9654;';
821
+ }
822
+ }
823
+
824
+ changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate', 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg', false);
825
+ changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);
826
+ changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', false);
827
+ changeStyle('video2TemplatePreview', 'postie-settings-video2template', 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', false);
828
+ changeIconSet(document.getElementById('icon_set_select'));
829
  </script>
docs/Changes.txt CHANGED
@@ -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.3 (2013.04.13) =
26
  * Added support for Featured Images
27
  * Added support for Use Transport Layer Security (TLS)
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+ = 1.5.4 (2013.05.01) =
26
+ * Added support for default post format
27
+ * Fixed bug where replies were getting attached to the wrong post
28
+ * Fixed bug where tags were not being detected correctly in html emails
29
+ * Fixed bug in reply detection
30
+
31
  = 1.5.3 (2013.04.13) =
32
  * Added support for Featured Images
33
  * Added support for Use Transport Layer Security (TLS)
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.1
9
- Stable tag: 1.5.3
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.1
9
+ Stable tag: 1.5.4
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -5,16 +5,15 @@ replace native imap MIME parser with flourish - http://flourishlib.com/docs/fMai
5
  automatically create category if it doesn't exist. new option to allow this feature?
6
  WP MU support
7
  Add setting for category detection. I.e. checkboxes for [], -- and : styles. Default to all on.
8
- setting for default post type/post format
9
  Make sure all failures are sent to admin (option?) failed attachments, etc.
10
  debug assistance
11
  Comment not being created when subject contains category command []. I.e. listserv subject lines
12
- reply logic not adding to comments
13
  rework attachment logic. video files can come through as application/octect-stream. Mail parsing should separate attachments
14
  into buckets? i.e. video, image, other. Each gets processed differently. I.e. when gallery in turned on images don't get embedded
15
  but videos do.
16
  date: tag is being detected in body when not wanted
17
  Enhance #img# to specify the featured image
 
18
 
19
  standardize tags
20
  fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
5
  automatically create category if it doesn't exist. new option to allow this feature?
6
  WP MU support
7
  Add setting for category detection. I.e. checkboxes for [], -- and : styles. Default to all on.
 
8
  Make sure all failures are sent to admin (option?) failed attachments, etc.
9
  debug assistance
10
  Comment not being created when subject contains category command []. I.e. listserv subject lines
 
11
  rework attachment logic. video files can come through as application/octect-stream. Mail parsing should separate attachments
12
  into buckets? i.e. video, image, other. Each gets processed differently. I.e. when gallery in turned on images don't get embedded
13
  but videos do.
14
  date: tag is being detected in body when not wanted
15
  Enhance #img# to specify the featured image
16
+ Update tag_* and filter_* to handle HTML (per tag_Tags)
17
 
18
  standardize tags
19
  fix postie settings http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
docs/Usage.txt CHANGED
@@ -9,7 +9,7 @@
9
  * status: draft
10
 
11
  = Post Date =
12
- * Posts can have a specific publication date. Relative dates like "tomorrow", "monday", "first day of next month" are supported.
13
  * date: date
14
  * date: date time
15
  * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
9
  * status: draft
10
 
11
  = Post Date =
12
+ * Posts can have a specific publication date such as Apr 14, 2013. Relative dates like "tomorrow", "monday", "first day of next month" are also supported.
13
  * date: date
14
  * date: date time
15
  * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 697183 2013-04-14 05:39:42Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -255,7 +255,7 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
255
  if ($fulldebug)
256
  DebugEcho("post custom: $content");
257
 
258
- $post_type = tag_PostType($subject, $postmodifiers);
259
  if ($fulldebug)
260
  DebugEcho("post type: $content");
261
 
@@ -399,9 +399,14 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
399
  * $custom_post_type_delim, e.g. "Movies // My Favorite Movie"
400
  * Also supports setting the Post Format.
401
  */
402
- function tag_PostType(&$subject, $postmodifiers) {
 
 
 
 
 
 
403
 
404
- $post_type = 'post';
405
  $custom_post_type_delim = "//";
406
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
407
  // Captures the custom post type in the subject before $custom_post_type_delim
@@ -410,21 +415,18 @@ function tag_PostType(&$subject, $postmodifiers) {
410
 
411
  $custom_post_type = trim(strtolower($custom_post_type));
412
  DebugEcho("post type: found possible type '$custom_post_type'");
 
 
 
413
 
414
- // Check if custom post type exists, if not, set default post type of 'post'
415
- $known_post_types = get_post_types();
416
- //DebugDump($known_post_types);
417
- //DebugDump(get_post_format_slugs());
418
-
419
- if (in_array($custom_post_type, array_map('strtolower', $known_post_types))) {
420
- DebugEcho("post type: found type '$post_type'");
421
- $post_type = $custom_post_type;
422
- $subject = trim($separated_subject[1]);
423
- } elseif (in_array($custom_post_type, array_keys(get_post_format_slugs()))) {
424
- DebugEcho("post type: found format '$custom_post_type'");
425
- $postmodifiers->PostFormat = $custom_post_type;
426
- $subject = trim($separated_subject[1]);
427
- }
428
  }
429
 
430
  return $post_type;
@@ -620,8 +622,8 @@ function GetParentPostForReply(&$subject) {
620
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
621
  $tmpSubject = trim($tmpSubject_matches[1]);
622
  }
623
- $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE '$tmpSubject' = post_title";
624
- if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, array()))) {
625
  if (is_array($id)) {
626
  $id = $id[count($id) - 1];
627
  }
@@ -1473,19 +1475,6 @@ function filter_StripPGP($content) {
1473
  return preg_replace($search, $replace, $content);
1474
  }
1475
 
1476
- function ConvertUTF8ToISO_8859_1($contenttransferencoding, $currentcharset, $body) {
1477
- if ((strtolower($currentcharset) != 'iso-8859-1')) {
1478
- $contenttransferencoding = strtolower($contenttransferencoding);
1479
- if ($contenttransferencoding == 'base64') {
1480
- $body = utf8_decode($body);
1481
- }
1482
- if ($contenttransferencoding == 'quoted-printable') {
1483
- $body = iconv($currentcharset, "UTF-8//TRANSLIT", quoted_printable_decode($body));
1484
- }
1485
- }
1486
- return $body;
1487
- }
1488
-
1489
  function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogEncoding = 'utf-8', $dequote = true) {
1490
  $charset = strtolower($charset);
1491
  $contenttransferencoding = strtolower($contenttransferencoding);
@@ -1514,11 +1503,6 @@ function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogE
1514
  return $body;
1515
  }
1516
 
1517
- function ConvertToUTF_8($charset, $body) {
1518
- DebugEcho("convert to utf-8");
1519
- return iconv($charset, "UTF-8//TRANSLIT", $body);
1520
- }
1521
-
1522
  /**
1523
  * This function handles decoding base64 if needed
1524
  */
@@ -2363,6 +2347,40 @@ function GetSubject(&$mimeDecodedEmail, &$content, $config) {
2363
  */
2364
  function tag_Tags(&$content, $defaultTags) {
2365
  $post_tags = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2366
  //try and determine tags
2367
  if (preg_match('/tags: ?(.*)$/im', $content, $matches)) {
2368
  if (!empty($matches[1])) {
@@ -2639,7 +2657,8 @@ function config_GetDefaults() {
2639
  'video2templates' => $video2Templates,
2640
  'wrap_pre' => 'no',
2641
  'featured_image' => false,
2642
- 'email_tls' => false
 
2643
  );
2644
  }
2645
 
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 706653 2013-05-01 21:04:15Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
255
  if ($fulldebug)
256
  DebugEcho("post custom: $content");
257
 
258
+ $post_type = tag_PostType($subject, $postmodifiers, $config);
259
  if ($fulldebug)
260
  DebugEcho("post type: $content");
261
 
399
  * $custom_post_type_delim, e.g. "Movies // My Favorite Movie"
400
  * Also supports setting the Post Format.
401
  */
402
+ function tag_PostType(&$subject, $postmodifiers, $config) {
403
+
404
+ $post_type = "post";
405
+ $custom_post_type = $config['post_format'];
406
+ $separated_subject = array();
407
+ $separated_subject[0] = "";
408
+ $separated_subject[1] = $subject;
409
 
 
410
  $custom_post_type_delim = "//";
411
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
412
  // Captures the custom post type in the subject before $custom_post_type_delim
415
 
416
  $custom_post_type = trim(strtolower($custom_post_type));
417
  DebugEcho("post type: found possible type '$custom_post_type'");
418
+ }
419
+
420
+ $known_post_types = get_post_types();
421
 
422
+ if (in_array($custom_post_type, array_map('strtolower', $known_post_types))) {
423
+ DebugEcho("post type: found type '$post_type'");
424
+ $post_type = $custom_post_type;
425
+ $subject = trim($separated_subject[1]);
426
+ } elseif (in_array($custom_post_type, array_keys(get_post_format_slugs()))) {
427
+ DebugEcho("post type: found format '$custom_post_type'");
428
+ $postmodifiers->PostFormat = $custom_post_type;
429
+ $subject = trim($separated_subject[1]);
 
 
 
 
 
 
430
  }
431
 
432
  return $post_type;
622
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
623
  $tmpSubject = trim($tmpSubject_matches[1]);
624
  }
625
+ $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_status = 'publish'";
626
+ if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject))) {
627
  if (is_array($id)) {
628
  $id = $id[count($id) - 1];
629
  }
1475
  return preg_replace($search, $replace, $content);
1476
  }
1477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1478
  function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogEncoding = 'utf-8', $dequote = true) {
1479
  $charset = strtolower($charset);
1480
  $contenttransferencoding = strtolower($contenttransferencoding);
1503
  return $body;
1504
  }
1505
 
 
 
 
 
 
1506
  /**
1507
  * This function handles decoding base64 if needed
1508
  */
2347
  */
2348
  function tag_Tags(&$content, $defaultTags) {
2349
  $post_tags = array();
2350
+
2351
+ $html = LoadDOM($content);
2352
+ if ($html !== false) {
2353
+ DebugEcho("tag_Tags: html detected");
2354
+ foreach ($html->find('text') as $element) {
2355
+ $e = $element->innertext;
2356
+ $post_tags = array_merge($post_tags, tag_TagsWorker($e));
2357
+ $element->innertext = $e;
2358
+ }
2359
+ $content = $html->save();
2360
+ } else {
2361
+ $post_tags = tag_TagsWorker($content);
2362
+ }
2363
+
2364
+ if (count($post_tags) == 0 && is_array($defaultTags)) {
2365
+ $post_tags = $defaultTags;
2366
+ }
2367
+ return $post_tags;
2368
+ }
2369
+
2370
+ function tag_TagsWorker(&$content) {
2371
+ $post_tags = array();
2372
+ if (preg_match('/tags: ?(.*)$/im', $content, $matches)) {
2373
+ if (!empty($matches[1])) {
2374
+ DebugEcho("Found tags: $matches[1]");
2375
+ $content = str_replace($matches[0], "", $content);
2376
+ $post_tags = preg_split("/,\s*/", trim($matches[1]));
2377
+ }
2378
+ }
2379
+ return $post_tags;
2380
+ }
2381
+
2382
+ function tag_Tags2(&$content, $defaultTags) {
2383
+ $post_tags = array();
2384
  //try and determine tags
2385
  if (preg_match('/tags: ?(.*)$/im', $content, $matches)) {
2386
  if (!empty($matches[1])) {
2657
  'video2templates' => $video2Templates,
2658
  'wrap_pre' => 'no',
2659
  'featured_image' => false,
2660
+ 'email_tls' => false,
2661
+ 'post_format' => 'standard'
2662
  );
2663
  }
2664
 
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.3
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 697184 2013-04-14 05:43:22Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
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.4
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 706653 2013-05-01 21:04:15Z WayneAllen $
31
  */
32
 
33
  define("POSTIE_ROOT", dirname(__FILE__));
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.1
9
- Stable tag: 1.5.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -90,7 +90,7 @@ Then use the Task Scheduler control panel to call wget or cron.
90
  * status: draft
91
 
92
  = Post Date =
93
- * Posts can have a specific publication date. Relative dates like "tomorrow", "monday", "first day of next month" are supported.
94
  * date: date
95
  * date: date time
96
  * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
@@ -443,6 +443,12 @@ All script, style and body tags are stripped from html emails.
443
  Attachments are now processed in the order they were attached.
444
 
445
  == CHANGELOG ==
 
 
 
 
 
 
446
  = 1.5.3 (2013.04.13) =
447
  * Added support for Featured Images
448
  * Added support for Use Transport Layer Security (TLS)
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
  Tested up to: 3.5.1
9
+ Stable tag: 1.5.4
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
90
  * status: draft
91
 
92
  = Post Date =
93
+ * Posts can have a specific publication date such as Apr 14, 2013. Relative dates like "tomorrow", "monday", "first day of next month" are also supported.
94
  * date: date
95
  * date: date time
96
  * Posts can be delayed by adding a line with delayXdXhXm where X is a number.
443
  Attachments are now processed in the order they were attached.
444
 
445
  == CHANGELOG ==
446
+ = 1.5.4 (2013.05.01) =
447
+ * Added support for default post format
448
+ * Fixed bug where replies were getting attached to the wrong post
449
+ * Fixed bug where tags were not being detected correctly in html emails
450
+ * Fixed bug in reply detection
451
+
452
  = 1.5.3 (2013.04.13) =
453
  * Added support for Featured Images
454
  * Added support for Use Transport Layer Security (TLS)
test/inlineimageTest.php CHANGED
@@ -227,7 +227,6 @@ class postiefunctions2Test extends PHPUnit_Framework_TestCase {
227
  filter_ReplaceImagePlaceHolders($c, array(), $config);
228
  $this->assertEquals("test", $c);
229
  }
230
-
231
  }
232
 
233
  ?>
227
  filter_ReplaceImagePlaceHolders($c, array(), $config);
228
  $this->assertEquals("test", $c);
229
  }
 
230
  }
231
 
232
  ?>
test/postie-functionsTest.php CHANGED
@@ -63,21 +63,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
63
  $this->assertTrue(isEmailAddressAuthorized("bob", array("jane", "bob")));
64
  }
65
 
66
- public function testConvertUTF8ToISO_8859_1() {
67
- $this->assertEquals("test", ConvertUTF8ToISO_8859_1("random", "stuff", "test"));
68
- $this->assertEquals("Phasa Thai", ConvertUTF8ToISO_8859_1('quoted-printable', 'iso-8859-1', "Phasa Thai"));
69
- $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('quoted-printable', 'tis-620', "=C0=D2=C9=D2=E4=B7=C2 Phasa Thai"));
70
- $this->assertEquals("??????? Phasa Thai", ConvertUTF8ToISO_8859_1('base64', 'utf-8', "ภาษาไทย Phasa Thai"));
71
- $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('something', 'utf-8', "ภาษาไทย Phasa Thai"));
72
- $this->assertEquals("ภาษาไทย Phasa Thai", ConvertUTF8ToISO_8859_1('base64', 'iso-8859-1', "ภาษาไทย Phasa Thai"));
73
- }
74
-
75
- public function testConvertToUTF_8() {
76
- $this->assertEquals("に投稿できる", ConvertToUTF_8('iso-2022-jp', iconv("UTF-8", "ISO-2022-JP", "に投稿できる")));
77
- $this->assertEquals("Код Обмена Информацией, 8 бит", ConvertToUTF_8('koi8-r', iconv("UTF-8", "koi8-r", "Код Обмена Информацией, 8 бит")));
78
- }
79
-
80
- public function testfilter_Delay() {
81
  $content = "test";
82
  $r = filter_Delay($content);
83
  $this->assertTrue(is_array($r));
@@ -142,7 +128,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
142
  $this->assertEquals("test", $content);
143
  }
144
 
145
- public function testfilter_Start() {
146
  $config = config_GetDefaults();
147
 
148
  $c = "test";
@@ -162,7 +148,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
162
  $this->assertEquals("</p><p>something</p>", $c);
163
  }
164
 
165
- public function testfilter_End() {
166
  $config = config_GetDefaults();
167
  $c = "test";
168
  filter_End($c, $config);
@@ -189,7 +175,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
189
  $this->assertEquals("<p>This is a test</p><p>", $c);
190
  }
191
 
192
- public function testfilter_Newlines() {
193
  $config = config_GetDefaults();
194
 
195
  $c = "test";
@@ -258,40 +244,49 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
258
  }
259
 
260
  public function testGetPostType() {
 
 
261
  $pm = new PostiePostModifiers();
262
  $subject = "test";
263
- $this->assertEquals("post", tag_PostType($subject, $pm));
264
  $this->assertEquals("test", $subject);
265
 
266
  $subject = "custom//test";
267
- $this->assertEquals("custom", tag_PostType($subject, $pm));
268
  $this->assertEquals("test", $subject);
269
 
270
  $subject = "//test";
271
- $this->assertEquals("post", tag_PostType($subject, $pm));
272
  $this->assertEquals("//test", $subject);
273
 
274
  $subject = "//";
275
- $this->assertEquals("post", tag_PostType($subject, $pm));
276
  $this->assertEquals("//", $subject);
277
 
278
  $subject = "custom2//test";
279
- $this->assertEquals("custom2", tag_PostType($subject, $pm));
280
  $this->assertEquals("test", $subject);
281
 
282
  $subject = "Custom1 // test";
283
- $this->assertEquals("custom1", tag_PostType($subject, $pm));
284
  $this->assertEquals("test", $subject);
285
 
286
  $subject = "video//test";
287
- $this->assertEquals("post", tag_PostType($subject, $pm));
288
  $this->assertEquals("test", $subject);
289
  $this->assertEquals('video', $pm->PostFormat);
290
-
291
  $subject = "//WL2K /Test Message";
292
- $this->assertEquals("post", tag_PostType($subject, $pm));
293
  $this->assertEquals("//WL2K /Test Message", $subject);
294
  $this->assertEquals('video', $pm->PostFormat);
 
 
 
 
 
 
 
295
  }
296
 
297
  public function testGetPostExcerpt() {
@@ -390,7 +385,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
390
  $this->assertEquals("testtest", SafeFileName('test\/:*?"<>|test'));
391
  }
392
 
393
- public function testremove_signature() {
394
  $config = config_GetDefaults();
395
 
396
  $c = "";
@@ -434,13 +429,13 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
434
  $this->assertEquals("test content<div><br></div>", $c);
435
  }
436
 
437
- public function testmore_reccurences() {
438
  $sched = array();
439
  $newsched = postie_more_reccurences($sched);
440
  $this->assertEquals(4, count($newsched));
441
  }
442
 
443
- public function testpostie_get_tags() {
444
  $c = "";
445
  $t = tag_Tags($c, "");
446
  $this->assertEquals(0, count($t));
@@ -515,9 +510,15 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
515
  $this->assertEquals("tag1", $t[0]);
516
  $this->assertEquals("tag2", $t[1]);
517
  $this->assertEquals("test \nmore stuff\n:end", $c);
 
 
 
 
 
 
518
  }
519
 
520
- public function testfilter_linkify() {
521
  $this->assertEquals("", filter_linkify(""));
522
  $this->assertEquals("test", filter_linkify("test"));
523
  $this->assertEquals('<a href="http://www.example.com" >http://www.example.com</a>', filter_linkify("http://www.example.com"));
@@ -530,13 +531,13 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
530
  $this->assertEquals("<img src='http://www.example.com'/>", filter_linkify("<img src='http://www.example.com'/>"));
531
  }
532
 
533
- public function testfilter_Videos() {
534
  $this->assertEquals("video\ntest", filter_Videos("video\ntest"));
535
  $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));
536
  $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", true));
537
  }
538
 
539
- public function testtag_Date() {
540
  $c = "";
541
  $this->assertEquals(null, tag_Date($c, null, 0));
542
  $this->assertEquals("", $c);
@@ -598,7 +599,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
598
  $this->assertEquals("<p>stuff</p><p></p><p>morestuff</p>", $c);
599
  }
600
 
601
- function testtag_Excerpt() {
602
  $c = "";
603
  $e = tag_Excerpt($c, false, false);
604
  $this->assertEquals("", $c);
@@ -633,7 +634,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
633
  $this->assertEquals("D09AD0BED0B3D0B0D182D0BE.png", filename_fix("Когато.png"));
634
  }
635
 
636
- function testtag_Status() {
637
 
638
  $c = "";
639
  $s = tag_Status($c, 'publish');
@@ -661,7 +662,7 @@ class postiefunctionsTest extends PHPUnit_Framework_TestCase {
661
  $this->assertEquals("private", $s);
662
  }
663
 
664
- function testgetPostAuthorDetails() {
665
  $s = "subject";
666
  $c = "content";
667
  $e = new stdClass();
63
  $this->assertTrue(isEmailAddressAuthorized("bob", array("jane", "bob")));
64
  }
65
 
66
+ public function test_filter_Delay() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  $content = "test";
68
  $r = filter_Delay($content);
69
  $this->assertTrue(is_array($r));
128
  $this->assertEquals("test", $content);
129
  }
130
 
131
+ public function test_filter_Start() {
132
  $config = config_GetDefaults();
133
 
134
  $c = "test";
148
  $this->assertEquals("</p><p>something</p>", $c);
149
  }
150
 
151
+ public function test_filter_End() {
152
  $config = config_GetDefaults();
153
  $c = "test";
154
  filter_End($c, $config);
175
  $this->assertEquals("<p>This is a test</p><p>", $c);
176
  }
177
 
178
+ public function test_filter_Newlines() {
179
  $config = config_GetDefaults();
180
 
181
  $c = "test";
244
  }
245
 
246
  public function testGetPostType() {
247
+ $config = config_GetDefaults();
248
+
249
  $pm = new PostiePostModifiers();
250
  $subject = "test";
251
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
252
  $this->assertEquals("test", $subject);
253
 
254
  $subject = "custom//test";
255
+ $this->assertEquals("custom", tag_PostType($subject, $pm, $config));
256
  $this->assertEquals("test", $subject);
257
 
258
  $subject = "//test";
259
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
260
  $this->assertEquals("//test", $subject);
261
 
262
  $subject = "//";
263
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
264
  $this->assertEquals("//", $subject);
265
 
266
  $subject = "custom2//test";
267
+ $this->assertEquals("custom2", tag_PostType($subject, $pm, $config));
268
  $this->assertEquals("test", $subject);
269
 
270
  $subject = "Custom1 // test";
271
+ $this->assertEquals("custom1", tag_PostType($subject, $pm, $config));
272
  $this->assertEquals("test", $subject);
273
 
274
  $subject = "video//test";
275
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
276
  $this->assertEquals("test", $subject);
277
  $this->assertEquals('video', $pm->PostFormat);
278
+
279
  $subject = "//WL2K /Test Message";
280
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
281
  $this->assertEquals("//WL2K /Test Message", $subject);
282
  $this->assertEquals('video', $pm->PostFormat);
283
+
284
+ //test w/ non-default post format
285
+ $config['post_format'] = 'aside';
286
+ $subject = "test";
287
+ $this->assertEquals("post", tag_PostType($subject, $pm, $config));
288
+ $this->assertEquals("test", $subject);
289
+ $this->assertEquals('aside', $pm->PostFormat);
290
  }
291
 
292
  public function testGetPostExcerpt() {
385
  $this->assertEquals("testtest", SafeFileName('test\/:*?"<>|test'));
386
  }
387
 
388
+ public function test_Remove_signature() {
389
  $config = config_GetDefaults();
390
 
391
  $c = "";
429
  $this->assertEquals("test content<div><br></div>", $c);
430
  }
431
 
432
+ public function test_postie_more_reccurences() {
433
  $sched = array();
434
  $newsched = postie_more_reccurences($sched);
435
  $this->assertEquals(4, count($newsched));
436
  }
437
 
438
+ public function test_tag_Tags() {
439
  $c = "";
440
  $t = tag_Tags($c, "");
441
  $this->assertEquals(0, count($t));
510
  $this->assertEquals("tag1", $t[0]);
511
  $this->assertEquals("tag2", $t[1]);
512
  $this->assertEquals("test \nmore stuff\n:end", $c);
513
+
514
+ $c = '<div><font face=Calibri>tags: sample tag</font></div>';
515
+ $t = tag_Tags($c, "");
516
+ $this->assertEquals(1, count($t));
517
+ $this->assertEquals("sample tag", $t[0]);
518
+ $this->assertEquals("<div><font face=Calibri></font></div>", $c);
519
  }
520
 
521
+ public function test_filter_linkify() {
522
  $this->assertEquals("", filter_linkify(""));
523
  $this->assertEquals("test", filter_linkify("test"));
524
  $this->assertEquals('<a href="http://www.example.com" >http://www.example.com</a>', filter_linkify("http://www.example.com"));
531
  $this->assertEquals("<img src='http://www.example.com'/>", filter_linkify("<img src='http://www.example.com'/>"));
532
  }
533
 
534
+ public function test_filter_Videos() {
535
  $this->assertEquals("video\ntest", filter_Videos("video\ntest"));
536
  $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));
537
  $this->assertEquals("A youtube link [youtube oAguHwl9Vzq]", filter_Videos("A youtube link https://www.youtube.com/watch?v=oAguHwl9Vzq", true));
538
  }
539
 
540
+ public function test_tag_Date() {
541
  $c = "";
542
  $this->assertEquals(null, tag_Date($c, null, 0));
543
  $this->assertEquals("", $c);
599
  $this->assertEquals("<p>stuff</p><p></p><p>morestuff</p>", $c);
600
  }
601
 
602
+ function test_tag_Excerpt() {
603
  $c = "";
604
  $e = tag_Excerpt($c, false, false);
605
  $this->assertEquals("", $c);
634
  $this->assertEquals("D09AD0BED0B3D0B0D182D0BE.png", filename_fix("Когато.png"));
635
  }
636
 
637
+ function test_tag_Status() {
638
 
639
  $c = "";
640
  $s = tag_Status($c, 'publish');
662
  $this->assertEquals("private", $s);
663
  }
664
 
665
+ function test_getPostAuthorDetails() {
666
  $s = "subject";
667
  $c = "content";
668
  $e = new stdClass();
test/wpstub.php CHANGED
@@ -172,4 +172,7 @@ function get_post_format_slugs() {
172
  return array('standard' => 'standard', 'video' => 'video', 'image' => 'image', 'aside' => 'aside');
173
  }
174
 
 
 
 
175
  ?>
172
  return array('standard' => 'standard', 'video' => 'video', 'image' => 'image', 'aside' => 'aside');
173
  }
174
 
175
+ function has_post_thumbnail(){
176
+ return false;
177
+ }
178
  ?>