Postie - Version 1.5.19

Version Description

(2014.04.30) = * Updated image preview to recognize all variables. * Updated "wordpress_default" images template to match WP 3.8. * Clarified logging messages for IMAP/IMAP-SSL/POP3-SSL * Removed POSTTITLE from templates since we don't know the actual title at template time. * Verified WordPress 3.9 compatibility

Download this release

Release Info

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

Code changes from version 1.5.18 to 1.5.19

Revision CHANGED
@@ -0,0 +1,2 @@
 
 
1
+ Revision: 861068
2
+ Last Changed Date: 2014-02-19 09:07:53 -0800 (Wed, 19 Feb 2014)
config_form.php CHANGED
@@ -108,9 +108,7 @@
108
  </form>
109
 
110
  <form name="postie-options" method="post" action='options.php' autocomplete="off">
111
- <?php
112
- settings_fields('postie-settings');
113
- ?>
114
  <input type="hidden" name="action" value="config" />
115
  <div id="simpleTabs">
116
  <div class="simpleTabs-nav">
@@ -187,7 +185,7 @@
187
  </tr>
188
  <tr>
189
  <th>
190
- <?php _e('Check for mail every', 'postie') ?>
191
  </th>
192
  <td>
193
  <select name='postie-settings[interval]' id='postie-settings-interval'>
@@ -328,7 +326,7 @@
328
 
329
  <tr valign="top">
330
  <th scope="row">
331
- <?php _e('Default post by mail tag(s)', 'postie') ?><br />
332
  <span
333
  class='recommendation'><?php _e('separated by commas', 'postie') ?>
334
  </span>
@@ -451,7 +449,7 @@
451
  ?>
452
  <tr>
453
  <th>
454
- <?php _e("Send post confirmation e-mail to", 'postie') ?>
455
  </th>
456
  <td>
457
  <select name='postie-settings[confirmation_email]' id='postie-settings-confirmation_email'>
@@ -468,7 +466,8 @@
468
  echo BuildBooleanSelect("Use shortcode for embedding video (youtube and others)", "postie-settings[shortcode]", $shortcode);
469
  ?>
470
  <tr>
471
- <th width="33%" valign="top" scope="row"><?php _e('Encoding for pages and feeds:', 'postie') ?> </th>
 
472
  <td>
473
  <input name='postie-settings[message_encoding]' type="text" id='postie-settings-message_encoding' value="<?php echo esc_attr($message_encoding); ?>" size="10" />
474
  <span class='recommendation'>UTF-8 <?php _e("should handle ISO-8859-1 as well", 'postie'); ?></span>
@@ -499,7 +498,7 @@
499
  </td>
500
  </tr>
501
  <tr>
502
- <th width="33%" valign="top" scope="row"><?php _e('Image Template', 'postie') ?><br />
503
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie'); ?></span><br /><br />
504
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br /><br />
505
  <span class='recommendation'><?php _e('Sizes for thumbnail, medium, and large images can be chosen in the <a href="options-media.php">Media Settings</a>. The samples here use the default sizes, and will not reflect the sizes you have chosen.', 'postie'); ?></span>
@@ -534,7 +533,7 @@
534
  </div>
535
  <div id='imageTemplatePreview'></div>
536
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
537
- "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
538
  <?php echo esc_attr($imagetemplate) ?>
539
  </textarea>
540
  <div class='recommendation'>
@@ -553,13 +552,12 @@
553
  <li>{MEDIUMWIDTH} gets replaced with the width of a medium image</li>
554
  <li>{MEDIUM} gets replaced with the url to the medium-sized image</li>
555
  <li>{PAGELINK} gets replaced with the URL of the file in WordPress</li>
556
- <li>{POSTTITLE} gets replaced with the post title (subject)</li>
557
  <li>{RELFILENAME} gets replaced with the relative path to the full-size image</li>
558
  <li>{THUMBHEIGHT} gets replaced with the height of a thumbnail image</li>
559
  <li>{THUMB} gets replaced with the url to the thumbnail image</li>
560
  <li>{THUMBNAIL} same as {THUMB}</li>
561
  <li>{THUMBWIDTH} gets replaced with the width of a thumbnail image</li>
562
- <li>{TITLE} same as {POSTTITLE}</li>
563
  <li>{URL} same as {FILELINK}</li>
564
  <li>{WIDTH} gets replaced with width of the photo</li>
565
  <li>{ICON} insert the icon for the attachment (for non-audio/image/video attachments only)</li>
@@ -579,7 +577,7 @@
579
  <table class='form-table'>
580
 
581
  <tr>
582
- <th scope='row'><?php _e('Video template 1', 'postie') ?><br />
583
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span><br />
584
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
585
  </th>
@@ -613,7 +611,7 @@
613
  </div>
614
  <div id='video1TemplatePreview'></div>
615
  <textarea onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template',
616
- 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', true);" cols='70' rows='7' id='postie-settings-video1template'
617
  name='postie-settings[video1template]'><?php echo esc_attr($video1template) ?></textarea>
618
  </td>
619
  </tr>
@@ -628,7 +626,7 @@
628
  </tr>
629
  <tr><td colspan="2"><hr /></td></tr>
630
  <tr>
631
- <th scope='row'><?php _e('Video template 2', 'postie') ?><br />
632
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span><br/>
633
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
634
  </th>
@@ -661,7 +659,7 @@
661
  </div>
662
  <div id='video2TemplatePreview'></div>
663
  <textarea onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
664
- 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', true);" cols='70' rows='7' id='postie-settings-video2template'
665
  name='postie-settings[video2template]'>
666
  <?php echo esc_attr($video2template) ?>
667
  </textarea>
@@ -679,7 +677,7 @@
679
  </tr>
680
  <tr><td colspan="2"><hr /></td></tr>
681
  <tr>
682
- <th scope='row'><?php _e('Audio template', 'postie') ?><br />
683
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span>
684
  <br />
685
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
@@ -714,7 +712,7 @@
714
  </div>
715
  <div id='audioTemplatePreview'></div>
716
  <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
717
- 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
718
  name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
719
  </td>
720
  </tr>
@@ -734,7 +732,7 @@
734
  <table class='form-table'>
735
 
736
  <tr>
737
- <th scope='row'><?php _e('Attachment icon set', 'postie') ?><br /></th>
738
  <td>
739
  <input type='hidden' id='postie-settings-icon_set' name='postie-settings[icon_set]'
740
  value="<?php echo esc_attr($icon_set) ?>" />
@@ -763,7 +761,7 @@
763
  </td>
764
  </tr>
765
  <tr>
766
- <th scope='row'><?php _e('Attachment icon size (in pixels)', 'postie') ?><br /></th>
767
  <td>
768
  <input type='hidden' id='postie-settings-icon_size' name='postie-settings[icon_size]'
769
  value="<?php echo esc_attr($icon_size) ?>" />
@@ -786,7 +784,7 @@
786
  </td>
787
  </tr>
788
  <tr>
789
- <th scope='row'><?php _e('Attachment template', 'postie') ?><br />
790
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span>
791
  <br />
792
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
@@ -849,91 +847,102 @@
849
 
850
  <?php $iconDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/icons'; ?>
851
  <script type="text/javascript">
852
- jQuery(document).ready(function() {
853
- jQuery("#simpleTabs").simpleTabs({
854
- fadeSpeed: "medium", // @param : low, medium, fast
855
- defautContent: 1, // @param : number ( simpleTabs-nav-number)
856
- autoNav: "false", // @param : true or false
857
- closeTabs: "false" // @param : true or false;
858
- });
859
-
860
- });
861
-
862
- function changeIconSet(selectBox, size) {
863
- var iconSet = document.getElementById('postie-settings-icon_set');
864
- var iconSize = document.getElementById('postie-settings-icon_size');
865
- var preview = document.getElementById('postie-settings-attachment_preview');
866
- var iconDir = '<?php echo $iconDir ?>/';
867
- if (size == true) {
868
- var hiddenInput = iconSize
869
- } else {
870
- var hiddenInput = iconSet;
871
- }
872
- for (i = 0; i < selectBox.options.length; i++) {
873
- if (selectBox.options[i].selected == true) {
874
- hiddenInput.value = selectBox.options[i].value;
875
- }
876
- }
877
- var fileTypes = new Array('doc', 'pdf', 'xls', 'default');
878
- preview.innerHTML = '';
879
- for (j = 0; j < fileTypes.length; j++) {
880
- preview.innerHTML += "<img src='" + iconDir + iconSet.value + '/' +
881
- fileTypes[j] + '-' + iconSize.value + ".png' />";
882
- }
883
- }
884
 
885
- function changeStyle(preview, template, select, selected, sample, custom) {
886
- var preview = document.getElementById(preview);
887
- var pageStyles = document.getElementById(select);
888
- var selectedStyle;
889
- var hiddenStyle = document.getElementById(selected);
890
- var pageStyle = document.getElementById(template);
891
- if (custom == true) {
892
- selectedStyle = pageStyles.options[pageStyles.options.length - 1];
893
- selectedStyle.value = pageStyle.value;
894
- selectedStyle.selected = true;
895
- } else {
896
- for (i = 0; i < pageStyles.options.length; i++) {
897
- if (pageStyles.options[i].selected == true) {
898
- selectedStyle = pageStyles.options[i];
899
- }
900
- }
901
- }
902
- hiddenStyle.value = selectedStyle.innerHTML
903
- var previewHTML = selectedStyle.value;
904
- var fileLink = '<?php echo $templateDir ?>/' + sample;
905
- var thumb = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
906
- '-150x150.jpg');
907
- var medium = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
908
- '-300x200.jpg');
909
- var large = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/,
910
- '-1024x682.jpg');
911
- previewHTML = previewHTML.replace(/{FILELINK}/g, fileLink);
912
- previewHTML = previewHTML.replace(/{IMAGE}/g, fileLink);
913
- previewHTML = previewHTML.replace(/{FILENAME}/, sample);
914
- previewHTML = previewHTML.replace(/{THUMB(NAIL|)}/, thumb);
915
- previewHTML = previewHTML.replace(/{MEDIUM}/, medium);
916
- previewHTML = previewHTML.replace(/{LARGE}/, large);
917
- previewHTML = previewHTML.replace(/{CAPTION}/g, 'Spencer smiling');
918
- preview.innerHTML = previewHTML;
919
- pageStyle.value = selectedStyle.value;
920
- }
 
 
 
 
 
 
 
 
 
 
 
921
 
922
- function showAdvanced(advancedId, arrowId) {
923
- var advanced = document.getElementById(advancedId);
924
- var arrow = document.getElementById(arrowId);
925
- if (advanced.style.display == 'none') {
926
- advanced.style.display = 'block';
927
- arrow.innerHTML = '&#9660;';
928
- } else {
929
- advanced.style.display = 'none';
930
- arrow.innerHTML = '&#9654;';
931
- }
932
- }
933
 
934
- changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate', 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg', false);
935
- changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);
936
- changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', false);
937
- changeStyle('video2TemplatePreview', 'postie-settings-video2template', 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', false);
938
- changeIconSet(document.getElementById('icon_set_select'));
939
  </script>
108
  </form>
109
 
110
  <form name="postie-options" method="post" action='options.php' autocomplete="off">
111
+ <?php settings_fields('postie-settings'); ?>
 
 
112
  <input type="hidden" name="action" value="config" />
113
  <div id="simpleTabs">
114
  <div class="simpleTabs-nav">
185
  </tr>
186
  <tr>
187
  <th>
188
+ <?php _e('Check for mail every', 'postie') ?>:
189
  </th>
190
  <td>
191
  <select name='postie-settings[interval]' id='postie-settings-interval'>
326
 
327
  <tr valign="top">
328
  <th scope="row">
329
+ <?php _e('Default post by mail tag(s)', 'postie') ?>:<br />
330
  <span
331
  class='recommendation'><?php _e('separated by commas', 'postie') ?>
332
  </span>
449
  ?>
450
  <tr>
451
  <th>
452
+ <?php _e("Send post confirmation e-mail to", 'postie') ?>:
453
  </th>
454
  <td>
455
  <select name='postie-settings[confirmation_email]' id='postie-settings-confirmation_email'>
466
  echo BuildBooleanSelect("Use shortcode for embedding video (youtube and others)", "postie-settings[shortcode]", $shortcode);
467
  ?>
468
  <tr>
469
+ <th width="33%" valign="top" scope="row"><?php _e('Encoding for pages and feeds:', 'postie') ?> <br />
470
+ <span class='recommendation'><?php _e('The character set for your blog.', 'postie') ?></span></th>
471
  <td>
472
  <input name='postie-settings[message_encoding]' type="text" id='postie-settings-message_encoding' value="<?php echo esc_attr($message_encoding); ?>" size="10" />
473
  <span class='recommendation'>UTF-8 <?php _e("should handle ISO-8859-1 as well", 'postie'); ?></span>
498
  </td>
499
  </tr>
500
  <tr>
501
+ <th width="33%" valign="top" scope="row"><?php _e('Image Template', 'postie') ?>:<br />
502
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie'); ?></span><br /><br />
503
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br /><br />
504
  <span class='recommendation'><?php _e('Sizes for thumbnail, medium, and large images can be chosen in the <a href="options-media.php">Media Settings</a>. The samples here use the default sizes, and will not reflect the sizes you have chosen.', 'postie'); ?></span>
533
  </div>
534
  <div id='imageTemplatePreview'></div>
535
  <textarea onchange='changeStyle("imageTemplatePreview", "postie-settings-imagetemplate", "imagetemplateselect",
536
+ "postie-settings-selected_imagetemplate", "smiling.jpg", true);' cols='70' rows='7' id='postie-settings-imagetemplate' name='postie-settings[imagetemplate]'>
537
  <?php echo esc_attr($imagetemplate) ?>
538
  </textarea>
539
  <div class='recommendation'>
552
  <li>{MEDIUMWIDTH} gets replaced with the width of a medium image</li>
553
  <li>{MEDIUM} gets replaced with the url to the medium-sized image</li>
554
  <li>{PAGELINK} gets replaced with the URL of the file in WordPress</li>
 
555
  <li>{RELFILENAME} gets replaced with the relative path to the full-size image</li>
556
  <li>{THUMBHEIGHT} gets replaced with the height of a thumbnail image</li>
557
  <li>{THUMB} gets replaced with the url to the thumbnail image</li>
558
  <li>{THUMBNAIL} same as {THUMB}</li>
559
  <li>{THUMBWIDTH} gets replaced with the width of a thumbnail image</li>
560
+ <li>{TITLE} same as {FILENAME}</li>
561
  <li>{URL} same as {FILELINK}</li>
562
  <li>{WIDTH} gets replaced with width of the photo</li>
563
  <li>{ICON} insert the icon for the attachment (for non-audio/image/video attachments only)</li>
577
  <table class='form-table'>
578
 
579
  <tr>
580
+ <th scope='row'><?php _e('Video template 1', 'postie') ?>:<br />
581
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span><br />
582
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
583
  </th>
611
  </div>
612
  <div id='video1TemplatePreview'></div>
613
  <textarea onchange="changeStyle('video1TemplatePreview', 'postie-settings-video1template',
614
+ 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', true);" cols='70' rows='7' id='postie-settings-video1template'
615
  name='postie-settings[video1template]'><?php echo esc_attr($video1template) ?></textarea>
616
  </td>
617
  </tr>
626
  </tr>
627
  <tr><td colspan="2"><hr /></td></tr>
628
  <tr>
629
+ <th scope='row'><?php _e('Video template 2', 'postie') ?>:<br />
630
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span><br/>
631
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
632
  </th>
659
  </div>
660
  <div id='video2TemplatePreview'></div>
661
  <textarea onchange="changeStyle('video2TemplatePreview', 'postie-settings-video2template',
662
+ 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', true);" cols='70' rows='7' id='postie-settings-video2template'
663
  name='postie-settings[video2template]'>
664
  <?php echo esc_attr($video2template) ?>
665
  </textarea>
677
  </tr>
678
  <tr><td colspan="2"><hr /></td></tr>
679
  <tr>
680
+ <th scope='row'><?php _e('Audio template', 'postie') ?>:<br />
681
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span>
682
  <br />
683
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
712
  </div>
713
  <div id='audioTemplatePreview'></div>
714
  <textarea onchange="changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate',
715
+ 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', true);" cols='70' rows='7' id='postie-settings-audiotemplate'
716
  name='postie-settings[audiotemplate]'><?php echo esc_attr($audiotemplate) ?></textarea>
717
  </td>
718
  </tr>
732
  <table class='form-table'>
733
 
734
  <tr>
735
+ <th scope='row'><?php _e('Attachment icon set', 'postie') ?>:<br /></th>
736
  <td>
737
  <input type='hidden' id='postie-settings-icon_set' name='postie-settings[icon_set]'
738
  value="<?php echo esc_attr($icon_set) ?>" />
761
  </td>
762
  </tr>
763
  <tr>
764
+ <th scope='row'><?php _e('Attachment icon size (in pixels)', 'postie') ?>:<br /></th>
765
  <td>
766
  <input type='hidden' id='postie-settings-icon_size' name='postie-settings[icon_size]'
767
  value="<?php echo esc_attr($icon_size) ?>" />
784
  </td>
785
  </tr>
786
  <tr>
787
+ <th scope='row'><?php _e('Attachment template', 'postie') ?>:<br />
788
  <span class='recommendation'><?php _e('Choose a default template, then customize to your liking in the text box', 'postie') ?></span>
789
  <br />
790
  <span class='recommendation'><?php _e('Note that this template are only used if the "Preferred Text Type" setting is set to "plain"', 'postie'); ?></span><br />
847
 
848
  <?php $iconDir = get_option('siteurl') . '/' . PLUGINDIR . '/postie/icons'; ?>
849
  <script type="text/javascript">
850
+ jQuery(document).ready(function() {
851
+ jQuery("#simpleTabs").simpleTabs({
852
+ fadeSpeed: "medium", // @param : low, medium, fast
853
+ defautContent: 1, // @param : number ( simpleTabs-nav-number)
854
+ autoNav: "false", // @param : true or false
855
+ closeTabs: "false" // @param : true or false;
856
+ });
857
+
858
+ });
859
+
860
+ function changeIconSet(selectBox, size) {
861
+ var iconSet = document.getElementById('postie-settings-icon_set');
862
+ var iconSize = document.getElementById('postie-settings-icon_size');
863
+ var preview = document.getElementById('postie-settings-attachment_preview');
864
+ var iconDir = '<?php echo $iconDir ?>/';
865
+ if (size == true) {
866
+ var hiddenInput = iconSize
867
+ } else {
868
+ var hiddenInput = iconSet;
869
+ }
870
+ for (i = 0; i < selectBox.options.length; i++) {
871
+ if (selectBox.options[i].selected == true) {
872
+ hiddenInput.value = selectBox.options[i].value;
873
+ }
874
+ }
875
+ var fileTypes = new Array('doc', 'pdf', 'xls', 'default');
876
+ preview.innerHTML = '';
877
+ for (j = 0; j < fileTypes.length; j++) {
878
+ preview.innerHTML += "<img src='" + iconDir + iconSet.value + '/' +
879
+ fileTypes[j] + '-' + iconSize.value + ".png' />";
880
+ }
881
+ }
882
 
883
+ function changeStyle(preview, template, select, selected, sample, custom) {
884
+ var preview = document.getElementById(preview);
885
+ var pageStyles = document.getElementById(select);
886
+ var selectedStyle;
887
+ var hiddenStyle = document.getElementById(selected);
888
+ var pageStyle = document.getElementById(template);
889
+ if (custom == true) {
890
+ selectedStyle = pageStyles.options[pageStyles.options.length - 1];
891
+ selectedStyle.value = pageStyle.value;
892
+ selectedStyle.selected = true;
893
+ } else {
894
+ for (i = 0; i < pageStyles.options.length; i++) {
895
+ if (pageStyles.options[i].selected == true) {
896
+ selectedStyle = pageStyles.options[i];
897
+ }
898
+ }
899
+ }
900
+ hiddenStyle.value = selectedStyle.innerHTML
901
+ var previewHTML = selectedStyle.value;
902
+ var fileLink = '<?php echo $templateDir ?>/' + sample;
903
+ var thumb = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/, '-150x150.jpg');
904
+ var medium = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/, '-300x200.jpg');
905
+ var large = '<?php echo $templateDir ?>/' + sample.replace(/\.jpg/, '-1024x682.jpg');
906
+ var pagelink = '<?php echo get_option("siteurl") ?>' + '/?attachment_id=9999';
907
+ previewHTML = previewHTML.replace(/{FILELINK}/g, fileLink);
908
+ previewHTML = previewHTML.replace(/{FULL}/g, fileLink);
909
+ previewHTML = previewHTML.replace(/{IMAGE}/g, fileLink);
910
+ previewHTML = previewHTML.replace(/{FILENAME}/, sample);
911
+ previewHTML = previewHTML.replace(/{PAGELINK}/, pagelink);
912
+ previewHTML = previewHTML.replace(/{RELFILENAME}/, sample);
913
+ previewHTML = previewHTML.replace(/{THUMB(NAIL|)}/, thumb);
914
+ previewHTML = previewHTML.replace(/{MEDIUM}/, medium);
915
+ previewHTML = previewHTML.replace(/{LARGE}/, large);
916
+ previewHTML = previewHTML.replace(/{HEIGHT}/, 800);
917
+ previewHTML = previewHTML.replace(/{WIDTH}/, 1200);
918
+ previewHTML = previewHTML.replace(/{THUMBWIDTH}/, 150);
919
+ previewHTML = previewHTML.replace(/{THUMBHEIGHT}/, 150);
920
+ previewHTML = previewHTML.replace(/{MEDIUMWIDTH}/, 300);
921
+ previewHTML = previewHTML.replace(/{MEDIUMHEIGHT}/, 200);
922
+ previewHTML = previewHTML.replace(/{LARGEWIDTH}/, 1024);
923
+ previewHTML = previewHTML.replace(/{LARGEHEIGHT}/, 682);
924
+ previewHTML = previewHTML.replace(/{ID}/, 9999);
925
+ previewHTML = previewHTML.replace(/{POSTTITLE}/g, 'Post title');
926
+ previewHTML = previewHTML.replace(/{CAPTION}/g, 'Spencer smiling');
927
+ preview.innerHTML = previewHTML;
928
+ pageStyle.value = selectedStyle.value;
929
+ }
930
 
931
+ function showAdvanced(advancedId, arrowId) {
932
+ var advanced = document.getElementById(advancedId);
933
+ var arrow = document.getElementById(arrowId);
934
+ if (advanced.style.display == 'none') {
935
+ advanced.style.display = 'block';
936
+ arrow.innerHTML = '&#9660;';
937
+ } else {
938
+ advanced.style.display = 'none';
939
+ arrow.innerHTML = '&#9654;';
940
+ }
941
+ }
942
 
943
+ changeStyle('imageTemplatePreview', 'postie-settings-imagetemplate', 'imagetemplateselect', 'postie-settings-selected_imagetemplate', 'smiling.jpg', false);
944
+ changeStyle('audioTemplatePreview', 'postie-settings-audiotemplate', 'audiotemplateselect', 'postie-settings-selected_audiotemplate', 'funky.mp3', false);
945
+ changeStyle('video1TemplatePreview', 'postie-settings-video1template', 'video1templateselect', 'postie-settings-selected_video1template', 'hi.mp4', false);
946
+ changeStyle('video2TemplatePreview', 'postie-settings-video2template', 'video2templateselect', 'postie-settings-selected_video2template', 'hi.flv', false);
947
+ changeIconSet(document.getElementById('icon_set_select'));
948
  </script>
docs/Changes.txt CHANGED
@@ -22,10 +22,16 @@ 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.18 (2014.01.12) =
26
  * Reverted text encoding change in 1.5.17.
27
 
28
-
29
  = 1.5.17 (2013.12.19) =
30
  * Fixed date calculation in test screen.
31
  * Fixed text encoding issues for systems with PHP 5.4
22
  Attachments are now processed in the order they were attached.
23
 
24
  == CHANGELOG ==
25
+ = 1.5.19 (2014.04.30) =
26
+ * Updated image preview to recognize all variables.
27
+ * Updated "wordpress_default" images template to match WP 3.8.
28
+ * Clarified logging messages for IMAP/IMAP-SSL/POP3-SSL
29
+ * Removed POSTTITLE from templates since we don't know the actual title at template time.
30
+ * Verified WordPress 3.9 compatibility
31
+
32
  = 1.5.18 (2014.01.12) =
33
  * Reverted text encoding change in 1.5.17.
34
 
 
35
  = 1.5.17 (2013.12.19) =
36
  * Fixed date calculation in test screen.
37
  * Fixed text encoding issues for systems with PHP 5.4
docs/Postie.txt CHANGED
@@ -5,8 +5,8 @@ Author URI: http://allens-home.com/
5
  Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
- Tested up to: 3.8
9
- Stable tag: 1.5.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
5
  Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
+ Tested up to: 3.9
9
+ Stable tag: 1.5.19
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
docs/TODO.txt CHANGED
@@ -10,6 +10,8 @@ plugin conflict - Image Rotation Fixer
10
  send email notice when attachments are rejected.
11
  review http://wp.smashingmagazine.com/2011/11/23/improve-wordpress-plugins-readme-txt/
12
  more info in postie.txt
 
 
13
 
14
  =========
15
  AddOn Ideas
10
  send email notice when attachments are rejected.
11
  review http://wp.smashingmagazine.com/2011/11/23/improve-wordpress-plugins-readme-txt/
12
  more info in postie.txt
13
+ configurable message for "post confirmation" - variable substitution
14
+ hook for post failure, success
15
 
16
  =========
17
  AddOn Ideas
docs/Usage.txt CHANGED
@@ -117,13 +117,12 @@
117
  * {MEDIUMWIDTH} gets replaced with the width of a medium image
118
  * {MEDIUM} gets replaced with the url to the medium-sized image
119
  * {PAGELINK} gets replaced with the URL of the file in WordPress
120
- * {POSTTITLE} gets replaced with the post title (subject)
121
  * {RELFILENAME} gets replaced with the relative path to the full-size image
122
  * {THUMBHEIGHT} gets replaced with the height of a thumbnail image
123
  * {THUMB} gets replaced with the url to the thumbnail image
124
  * {THUMBNAIL} same as {THUMB}
125
  * {THUMBWIDTH} gets replaced with the width of a thumbnail image
126
- * {TITLE} same as {POSTTITLE}
127
  * {URL} same as {FILELINK}
128
  * {WIDTH} gets replaced with width of the photo
129
  * {ICON} insert the icon for the attachment (for non-audio/image/video attachments only)
117
  * {MEDIUMWIDTH} gets replaced with the width of a medium image
118
  * {MEDIUM} gets replaced with the url to the medium-sized image
119
  * {PAGELINK} gets replaced with the URL of the file in WordPress
 
120
  * {RELFILENAME} gets replaced with the relative path to the full-size image
121
  * {THUMBHEIGHT} gets replaced with the height of a thumbnail image
122
  * {THUMB} gets replaced with the url to the thumbnail image
123
  * {THUMBNAIL} same as {THUMB}
124
  * {THUMBWIDTH} gets replaced with the width of a thumbnail image
125
+ * {TITLE} same as {FILENAME}
126
  * {URL} same as {FILELINK}
127
  * {WIDTH} gets replaced with width of the photo
128
  * {ICON} insert the icon for the attachment (for non-audio/image/video attachments only)
get_mail.php CHANGED
@@ -3,8 +3,9 @@
3
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-wp-config.php');
4
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php');
5
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php');
6
- if (!function_exists('file_get_html'))
7
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'simple_html_dom.php');
 
8
 
9
  EchoInfo("Starting mail fetch");
10
  postie_environment();
@@ -15,23 +16,25 @@ if (file_exists($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php")) {
15
  include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
16
  }
17
 
18
- if (has_filter('postie_post')){
19
  echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
20
  }
21
 
22
  $test_email = null;
23
  $config = config_Read();
24
  extract($config);
25
- if (!isset($maxemails))
26
  $maxemails = 0;
 
27
 
28
  $emails = FetchMail($mail_server, $mail_server_port, $mail_userid, $mail_password, $input_protocol, $time_offset, $test_email, $delete_mail_after_processing, $maxemails, $email_tls);
29
  $message = 'Done.';
30
 
31
  EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails)));
32
 
33
- if (function_exists('memory_get_usage'))
34
  DebugEcho(__("memory at start of e-mail processing:") . memory_get_usage());
 
35
 
36
  DebugDump($config);
37
 
@@ -66,6 +69,6 @@ foreach ($emails as $email) {
66
  }
67
  EchoInfo("Mail fetch complete, $message_number emails");
68
 
69
- if (function_exists('memory_get_usage'))
70
  DebugEcho("memory at end of e-mail processing:" . memory_get_usage());
71
- ?>
3
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-wp-config.php');
4
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mimedecode.php');
5
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'postie-functions.php');
6
+ if (!function_exists('file_get_html')) {
7
  require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'simple_html_dom.php');
8
+ }
9
 
10
  EchoInfo("Starting mail fetch");
11
  postie_environment();
16
  include_once ($wp_content_path . DIRECTORY_SEPARATOR . "filterPostie.php");
17
  }
18
 
19
+ if (has_filter('postie_post')) {
20
  echo "Postie: filter 'postie_post' is depricated in favor of 'postie_post_before'";
21
  }
22
 
23
  $test_email = null;
24
  $config = config_Read();
25
  extract($config);
26
+ if (!isset($maxemails)) {
27
  $maxemails = 0;
28
+ }
29
 
30
  $emails = FetchMail($mail_server, $mail_server_port, $mail_userid, $mail_password, $input_protocol, $time_offset, $test_email, $delete_mail_after_processing, $maxemails, $email_tls);
31
  $message = 'Done.';
32
 
33
  EchoInfo(sprintf(__("There are %d messages to process", "postie"), count($emails)));
34
 
35
+ if (function_exists('memory_get_usage')) {
36
  DebugEcho(__("memory at start of e-mail processing:") . memory_get_usage());
37
+ }
38
 
39
  DebugDump($config);
40
 
69
  }
70
  EchoInfo("Mail fetch complete, $message_number emails");
71
 
72
+ if (function_exists('memory_get_usage')) {
73
  DebugEcho("memory at end of e-mail processing:" . memory_get_usage());
74
+ }
postie-functions.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- $Id: postie-functions.php 837484 2014-01-13 05:31:23Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
@@ -11,7 +11,7 @@ class PostiePostModifiers {
11
 
12
  var $PostFormat = 'standard';
13
 
14
- function apply($postid, $postdetails) {
15
 
16
  if ($this->PostFormat != 'standard') {
17
  set_post_format($postid, $this->PostFormat);
@@ -26,8 +26,7 @@ if (!function_exists('mb_str_replace')) {
26
  if (!is_array($subject)) {
27
  // Normalize $search and $replace so they are both arrays of the same length
28
  $searches = is_array($search) ? array_values($search) : array($search);
29
- $replacements = is_array($replace) ? array_values($replace) : array($replace);
30
- $replacements = array_pad($replacements, count($searches), '');
31
 
32
  foreach ($searches as $key => $search) {
33
  $parts = mb_split(preg_quote($search), $subject);
@@ -119,11 +118,8 @@ function postie_disable_revisions($restore = false) {
119
  if (!function_exists('fnmatch')) {
120
 
121
  function fnmatch($pattern, $string) {
122
- $pattern = strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' =>
123
- '.', '\[' => '[', '\]' => ']'));
124
- return @preg_match(
125
- '/^' . strtr(addcslashes($pattern, '/\\.+^$(){}=!<>|'), array('*' => '.*', '?' => '.?')) . '$/i', $string
126
- );
127
  }
128
 
129
  }
@@ -176,6 +172,7 @@ function tag_Date(&$content, $message_date) {
176
  DebugEcho("tag_Date: html " . count($es));
177
  foreach ($es as $e) {
178
  DebugEcho(trim($e->plaintext));
 
179
  if (1 === preg_match("/^date:\s?(.*)$/im", trim($e->plaintext), $matches)) {
180
  DebugEcho("tag_Date: found date tag $matches[1]");
181
  $newdate = strtotime($matches[1]);
@@ -214,31 +211,37 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
214
 
215
  if (array_key_exists('message-id', $mimeDecodedEmail->headers)) {
216
  DebugEcho("Message Id is :" . htmlentities($mimeDecodedEmail->headers["message-id"]));
217
- if ($fulldebugdump)
218
  DebugDump($mimeDecodedEmail);
 
219
  }
220
 
221
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
222
- if ($fulldebugdump)
223
  DebugDump($mimeDecodedEmail);
 
224
 
225
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
226
- if ($fulldebug)
227
  DebugEcho("the content is $content");
 
228
 
229
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
230
 
231
  filter_RemoveSignature($content, $config);
232
- if ($fulldebug)
233
  DebugEcho("post sig: $content");
 
234
 
235
  $post_excerpt = tag_Excerpt($content, $config);
236
- if ($fulldebug)
237
  DebugEcho("post excerpt: $content");
 
238
 
239
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
240
- if ($fulldebug)
241
  DebugEcho("post author: $content");
 
242
 
243
  $message_date = NULL;
244
  if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) {
@@ -255,54 +258,66 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
255
  $message_date = tag_Date($content, $message_date);
256
 
257
  list($post_date, $post_date_gmt, $delay) = filter_Delay($content, $message_date, $time_offset);
258
- if ($fulldebug)
259
  DebugEcho("post date: $content");
 
260
 
261
  filter_Ubb2HTML($content);
262
- if ($fulldebug)
263
  DebugEcho("post ubb: $content");
 
264
 
265
  $post_categories = tag_Categories($subject, $default_post_category, $category_match);
266
- if ($fulldebug)
267
  DebugEcho("post category: $content");
 
268
 
269
  $post_tags = tag_Tags($content, $default_post_tags);
270
- if ($fulldebug)
271
  DebugEcho("post tag: $content");
 
272
 
273
  $comment_status = tag_AllowCommentsOnPost($content);
274
- if ($fulldebug)
275
  DebugEcho("post comment: $content");
 
276
 
277
  $post_status = tag_Status($content, $post_status);
278
- if ($fulldebug)
279
  DebugEcho("post status: $content");
 
280
 
281
  if ($converturls) {
282
  $content = filter_Videos($content, $shortcode); //videos first so linkify doesn't mess with them
283
- if ($fulldebug)
284
  DebugEcho("post video: $content");
 
285
 
286
  $content = filter_Linkify($content);
287
- if ($fulldebug)
288
  DebugEcho("post linkify: $content");
 
289
  }
290
 
291
  filter_VodafoneHandler($content, $attachments, $config);
292
- if ($fulldebug)
293
  DebugEcho("post vodafone: $content");
 
294
 
295
  filter_ReplaceImageCIDs($content, $attachments, $config);
296
- if ($fulldebug)
297
  DebugEcho("post cid: $content");
 
298
 
299
  $customImages = tag_CustomImageField($content, $attachments, $config);
300
- if ($fulldebug)
301
  DebugEcho("post custom: $content");
 
302
 
303
  $post_type = tag_PostType($subject, $postmodifiers, $config);
304
- if ($fulldebug)
305
  DebugEcho("post type: $content");
 
306
 
307
  $id = GetParentPostForReply($subject);
308
  if (empty($id)) {
@@ -345,25 +360,30 @@ function CreatePost($poster, $mimeDecodedEmail, $post_id, &$is_reply, $config, $
345
  }
346
 
347
  filter_Newlines($content, $config);
348
- if ($fulldebug)
349
  DebugEcho("post newline: $content");
 
350
 
351
  filter_Start($content, $config);
352
- if ($fulldebug)
353
  DebugEcho("post start: $content");
 
354
 
355
  filter_End($content, $config);
356
- if ($fulldebug)
357
  DebugEcho("post end: $content");
 
358
 
359
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config, $id, $config['image_placeholder'], true);
360
- if ($fulldebug)
361
  DebugEcho("post body img: $content");
 
362
 
363
  if ($post_excerpt) {
364
  filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config, $id, "#eimg%#", false);
365
- if ($fulldebug)
366
  DebugEcho("post excerpt img: $content");
 
367
  }
368
 
369
  DebugEcho("excerpt: $post_excerpt");
@@ -421,8 +441,6 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
421
  DebugEcho(("Post postie_post filter"));
422
  DebugDump($details);
423
 
424
- DebugEcho("Post modifiers");
425
- DebugDump($postmodifiers);
426
 
427
  if (empty($details)) {
428
  // It is possible that the filter has removed the post, in which case, it should not be posted.
@@ -472,9 +490,7 @@ function tag_PostType(&$subject, $postmodifiers, $config) {
472
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
473
  // Captures the custom post type in the subject before $custom_post_type_delim
474
  $separated_subject = explode($custom_post_type_delim, $subject);
475
- $custom_post_type = $separated_subject[0];
476
-
477
- $custom_post_type = trim(strtolower($custom_post_type));
478
  DebugEcho("post type: found possible type '$custom_post_type'");
479
  }
480
 
@@ -621,6 +637,7 @@ function getPostAuthorDetails(&$subject, &$content, &$mimeDecodedEmail) {
621
  }
622
 
623
  // see if subject starts with Fwd:
 
624
  if (preg_match("/(^Fwd:) (.*)/", $subject, $matches)) {
625
  DebugEcho("Fwd: detected");
626
  $subject = trim($matches[2]);
@@ -672,9 +689,11 @@ function GetParentPostForReply(&$subject) {
672
  global $wpdb;
673
 
674
  $id = NULL;
675
-
676
  // see if subject starts with Re:
 
677
  if (preg_match("/(^Re:)(.*)/i", $subject, $matches)) {
 
678
  $subject = trim($matches[2]);
679
  // strip out category info into temporary variable
680
  $tmpSubject = $subject;
@@ -682,18 +701,25 @@ function GetParentPostForReply(&$subject) {
682
  $tmpSubject = trim($matches[2]);
683
  $matches[1] = array($matches[1]);
684
  } else if (preg_match_all('/\[(.[^\[]*)\]/', $tmpSubject, $matches)) {
 
685
  preg_match("/](.[^\[]*)$/", $tmpSubject, $tmpSubject_matches);
686
  $tmpSubject = trim($tmpSubject_matches[1]);
687
  } else if (preg_match_all('/-(.[^-]*)-/', $tmpSubject, $matches)) {
688
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
689
  $tmpSubject = trim($tmpSubject_matches[1]);
690
  }
 
691
  $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_status = 'publish'";
692
  if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject))) {
693
  if (is_array($id)) {
694
  $id = $id[count($id) - 1];
 
 
 
695
  }
696
  }
 
 
697
  }
698
  return $id;
699
  }
@@ -839,7 +865,7 @@ function POP3MessageFetch($server = NULL, $port = NULL, $email = NULL, $password
839
  $emails[$i] = implode('', $m);
840
  if ($deleteMessages) {
841
  if (!$pop3->delete($i)) {
842
- EchoInfo('POP3MessageFetch: cannot delete message $i ' . $pop3->ERROR);
843
  $pop3->reset();
844
  exit;
845
  }
@@ -907,7 +933,7 @@ function PostToDB($details, $isReply, $customImageField, $postmodifiers) {
907
  }
908
  }
909
 
910
- $postmodifiers->apply($post_ID, $details);
911
 
912
  apply_filters('postie_post_after', $details);
913
  }
@@ -1562,8 +1588,8 @@ function HandleMessageEncoding($contenttransferencoding, $charset, $body, $blogE
1562
  $contenttransferencoding = strtolower($contenttransferencoding);
1563
 
1564
  DebugEcho("before HandleMessageEncoding");
1565
- DebugEcho("charset: $charset");
1566
- DebugEcho("encoding: $contenttransferencoding");
1567
  //DebugDump($body);
1568
 
1569
  if ($contenttransferencoding == 'base64') {
@@ -2269,7 +2295,6 @@ function parseTemplate($id, $type, $template, $orig_filename, $icon = "") {
2269
  $template = str_replace('{IMAGE}', $fileLink, $template);
2270
  $template = str_replace('{URL}', $fileLink, $template);
2271
  $template = str_replace('{RELFILENAME}', $relFileName, $template);
2272
- $template = str_replace('{POSTTITLE}', $the_parent->post_title, $template);
2273
  $template = str_replace('{ICON}', $icon, $template);
2274
 
2275
  DebugEcho("parseTemplate - after: $template");
1
  <?php
2
 
3
  /*
4
+ $Id: postie-functions.php 905802 2014-04-30 19:15:38Z WayneAllen $
5
  */
6
 
7
  //to turn on debug output add the following line to wp-config.php
11
 
12
  var $PostFormat = 'standard';
13
 
14
+ function apply($postid) {
15
 
16
  if ($this->PostFormat != 'standard') {
17
  set_post_format($postid, $this->PostFormat);
26
  if (!is_array($subject)) {
27
  // Normalize $search and $replace so they are both arrays of the same length
28
  $searches = is_array($search) ? array_values($search) : array($search);
29
+ $replacements = array_pad(is_array($replace) ? array_values($replace) : array($replace), count($searches), '');
 
30
 
31
  foreach ($searches as $key => $search) {
32
  $parts = mb_split(preg_quote($search), $subject);
118
  if (!function_exists('fnmatch')) {
119
 
120
  function fnmatch($pattern, $string) {
121
+ $pattern = strtr(preg_quote($pattern, '#'), array('\*' => '.*', '\?' => '.', '\[' => '[', '\]' => ']'));
122
+ return preg_match('/^' . strtr(addcslashes($pattern, '/\\.+^$(){}=!<>|'), array('*' => '.*', '?' => '.?')) . '$/i', $string);
 
 
 
123
  }
124
 
125
  }
172
  DebugEcho("tag_Date: html " . count($es));
173
  foreach ($es as $e) {
174
  DebugEcho(trim($e->plaintext));
175
+ $matches = array();
176
  if (1 === preg_match("/^date:\s?(.*)$/im", trim($e->plaintext), $matches)) {
177
  DebugEcho("tag_Date: found date tag $matches[1]");
178
  $newdate = strtotime($matches[1]);
211
 
212
  if (array_key_exists('message-id', $mimeDecodedEmail->headers)) {
213
  DebugEcho("Message Id is :" . htmlentities($mimeDecodedEmail->headers["message-id"]));
214
+ if ($fulldebugdump) {
215
  DebugDump($mimeDecodedEmail);
216
+ }
217
  }
218
 
219
  filter_PreferedText($mimeDecodedEmail, $prefer_text_type);
220
+ if ($fulldebugdump) {
221
  DebugDump($mimeDecodedEmail);
222
+ }
223
 
224
  $content = GetContent($mimeDecodedEmail, $attachments, $post_id, $poster, $config);
225
+ if ($fulldebug) {
226
  DebugEcho("the content is $content");
227
+ }
228
 
229
  $subject = GetSubject($mimeDecodedEmail, $content, $config);
230
 
231
  filter_RemoveSignature($content, $config);
232
+ if ($fulldebug) {
233
  DebugEcho("post sig: $content");
234
+ }
235
 
236
  $post_excerpt = tag_Excerpt($content, $config);
237
+ if ($fulldebug) {
238
  DebugEcho("post excerpt: $content");
239
+ }
240
 
241
  $postAuthorDetails = getPostAuthorDetails($subject, $content, $mimeDecodedEmail);
242
+ if ($fulldebug) {
243
  DebugEcho("post author: $content");
244
+ }
245
 
246
  $message_date = NULL;
247
  if (array_key_exists("date", $mimeDecodedEmail->headers) && !empty($mimeDecodedEmail->headers["date"])) {
258
  $message_date = tag_Date($content, $message_date);
259
 
260
  list($post_date, $post_date_gmt, $delay) = filter_Delay($content, $message_date, $time_offset);
261
+ if ($fulldebug) {
262
  DebugEcho("post date: $content");
263
+ }
264
 
265
  filter_Ubb2HTML($content);
266
+ if ($fulldebug) {
267
  DebugEcho("post ubb: $content");
268
+ }
269
 
270
  $post_categories = tag_Categories($subject, $default_post_category, $category_match);
271
+ if ($fulldebug) {
272
  DebugEcho("post category: $content");
273
+ }
274
 
275
  $post_tags = tag_Tags($content, $default_post_tags);
276
+ if ($fulldebug) {
277
  DebugEcho("post tag: $content");
278
+ }
279
 
280
  $comment_status = tag_AllowCommentsOnPost($content);
281
+ if ($fulldebug) {
282
  DebugEcho("post comment: $content");
283
+ }
284
 
285
  $post_status = tag_Status($content, $post_status);
286
+ if ($fulldebug) {
287
  DebugEcho("post status: $content");
288
+ }
289
 
290
  if ($converturls) {
291
  $content = filter_Videos($content, $shortcode); //videos first so linkify doesn't mess with them
292
+ if ($fulldebug) {
293
  DebugEcho("post video: $content");
294
+ }
295
 
296
  $content = filter_Linkify($content);
297
+ if ($fulldebug) {
298
  DebugEcho("post linkify: $content");
299
+ }
300
  }
301
 
302
  filter_VodafoneHandler($content, $attachments, $config);
303
+ if ($fulldebug) {
304
  DebugEcho("post vodafone: $content");
305
+ }
306
 
307
  filter_ReplaceImageCIDs($content, $attachments, $config);
308
+ if ($fulldebug) {
309
  DebugEcho("post cid: $content");
310
+ }
311
 
312
  $customImages = tag_CustomImageField($content, $attachments, $config);
313
+ if ($fulldebug) {
314
  DebugEcho("post custom: $content");
315
+ }
316
 
317
  $post_type = tag_PostType($subject, $postmodifiers, $config);
318
+ if ($fulldebug) {
319
  DebugEcho("post type: $content");
320
+ }
321
 
322
  $id = GetParentPostForReply($subject);
323
  if (empty($id)) {
360
  }
361
 
362
  filter_Newlines($content, $config);
363
+ if ($fulldebug) {
364
  DebugEcho("post newline: $content");
365
+ }
366
 
367
  filter_Start($content, $config);
368
+ if ($fulldebug) {
369
  DebugEcho("post start: $content");
370
+ }
371
 
372
  filter_End($content, $config);
373
+ if ($fulldebug) {
374
  DebugEcho("post end: $content");
375
+ }
376
 
377
  filter_ReplaceImagePlaceHolders($content, $attachments["html"], $config, $id, $config['image_placeholder'], true);
378
+ if ($fulldebug) {
379
  DebugEcho("post body img: $content");
380
+ }
381
 
382
  if ($post_excerpt) {
383
  filter_ReplaceImagePlaceHolders($post_excerpt, $attachments["html"], $config, $id, "#eimg%#", false);
384
+ if ($fulldebug) {
385
  DebugEcho("post excerpt img: $content");
386
+ }
387
  }
388
 
389
  DebugEcho("excerpt: $post_excerpt");
441
  DebugEcho(("Post postie_post filter"));
442
  DebugDump($details);
443
 
 
 
444
 
445
  if (empty($details)) {
446
  // It is possible that the filter has removed the post, in which case, it should not be posted.
490
  if (strpos($subject, $custom_post_type_delim) !== FALSE) {
491
  // Captures the custom post type in the subject before $custom_post_type_delim
492
  $separated_subject = explode($custom_post_type_delim, $subject);
493
+ $custom_post_type = trim(strtolower($separated_subject[0]));
 
 
494
  DebugEcho("post type: found possible type '$custom_post_type'");
495
  }
496
 
637
  }
638
 
639
  // see if subject starts with Fwd:
640
+ $matches = array();
641
  if (preg_match("/(^Fwd:) (.*)/", $subject, $matches)) {
642
  DebugEcho("Fwd: detected");
643
  $subject = trim($matches[2]);
689
  global $wpdb;
690
 
691
  $id = NULL;
692
+ DebugEcho("GetParentPostForReply: Looking for parent '$subject'");
693
  // see if subject starts with Re:
694
+ $matches = array();
695
  if (preg_match("/(^Re:)(.*)/i", $subject, $matches)) {
696
+ DebugEcho("GetParentPostForReply: Re: detected");
697
  $subject = trim($matches[2]);
698
  // strip out category info into temporary variable
699
  $tmpSubject = $subject;
701
  $tmpSubject = trim($matches[2]);
702
  $matches[1] = array($matches[1]);
703
  } else if (preg_match_all('/\[(.[^\[]*)\]/', $tmpSubject, $matches)) {
704
+ $tmpSubject_matches = array();
705
  preg_match("/](.[^\[]*)$/", $tmpSubject, $tmpSubject_matches);
706
  $tmpSubject = trim($tmpSubject_matches[1]);
707
  } else if (preg_match_all('/-(.[^-]*)-/', $tmpSubject, $matches)) {
708
  preg_match("/-(.[^-]*)$/", $tmpSubject, $tmpSubject_matches);
709
  $tmpSubject = trim($tmpSubject_matches[1]);
710
  }
711
+ DebugEcho("GetParentPostForReply: tmpSubject: $tmpSubject");
712
  $checkExistingPostQuery = "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_status = 'publish'";
713
  if ($id = $wpdb->get_var($wpdb->prepare($checkExistingPostQuery, $tmpSubject))) {
714
  if (is_array($id)) {
715
  $id = $id[count($id) - 1];
716
+ DebugEcho("GetParentPostForReply: id: $id");
717
+ } else {
718
+ DebugEcho("GetParentPostForReply: No parent id found");
719
  }
720
  }
721
+ } else {
722
+ DebugEcho("GetParentPostForReply: No parent found");
723
  }
724
  return $id;
725
  }
865
  $emails[$i] = implode('', $m);
866
  if ($deleteMessages) {
867
  if (!$pop3->delete($i)) {
868
+ EchoInfo("POP3MessageFetch: cannot delete message $i: " . $pop3->ERROR);
869
  $pop3->reset();
870
  exit;
871
  }
933
  }
934
  }
935
 
936
+ $postmodifiers->apply($post_ID);
937
 
938
  apply_filters('postie_post_after', $details);
939
  }
1588
  $contenttransferencoding = strtolower($contenttransferencoding);
1589
 
1590
  DebugEcho("before HandleMessageEncoding");
1591
+ DebugEcho("email charset: $charset");
1592
+ DebugEcho("email encoding: $contenttransferencoding");
1593
  //DebugDump($body);
1594
 
1595
  if ($contenttransferencoding == 'base64') {
2295
  $template = str_replace('{IMAGE}', $fileLink, $template);
2296
  $template = str_replace('{URL}', $fileLink, $template);
2297
  $template = str_replace('{RELFILENAME}', $relFileName, $template);
 
2298
  $template = str_replace('{ICON}', $icon, $template);
2299
 
2300
  DebugEcho("parseTemplate - after: $template");
postie-wp-config.php CHANGED
@@ -11,4 +11,3 @@ if (file_exists($wp_config_path . DIRECTORY_SEPARATOR . "wp-config.php")) {
11
  } else {
12
  die("wp-config.php could not be found.");
13
  }
14
- ?>
11
  } else {
12
  die("wp-config.php could not be found.");
13
  }
 
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.18
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
@@ -27,10 +27,10 @@
27
  */
28
 
29
  /*
30
- $Id: postie.php 837484 2014-01-13 05:31:23Z WayneAllen $
31
  */
32
 
33
- define('POSTIE_VERSION', '1.5.18');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
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.19
8
  Author: Wayne Allen
9
  Author URI: http://allens-home.com/
10
  License: GPL2
27
  */
28
 
29
  /*
30
+ $Id: postie.php 905802 2014-04-30 19:15:38Z WayneAllen $
31
  */
32
 
33
+ define('POSTIE_VERSION', '1.5.19');
34
  define("POSTIE_ROOT", dirname(__FILE__));
35
  define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
36
 
postieIMAP.php CHANGED
@@ -37,7 +37,7 @@ class PostieIMAP {
37
  */
38
  function TLSOn() {
39
  $this->_tls_on = true;
40
- DebugEcho("IMAP: TLS enabled");
41
  }
42
 
43
  /**
@@ -75,23 +75,23 @@ class PostieIMAP {
75
  }
76
  if (preg_match("/google|gmail/i", $server)) {
77
  //Fix from Jim Hodgson http://www.jimhodgson.com/2006/07/19/postie/
78
- DebugEcho("IMAP: using Google INBOX");
79
  $this->_server_string = "{" . $server . ":" . $port . $option . "}INBOX";
80
  } else {
81
  $this->_server_string = "{" . $server . ":" . $port . $option . "}";
82
  }
83
- DebugEcho("IMAP: connection string - {$this->_server_string}");
84
  //Exchange connection, but requires PHP 5.3.2
85
  if (version_compare(phpversion(), '5.3.2', '<')) {
86
  $this->_connection = imap_open($this->_server_string, $login, $password);
87
  } else {
88
- DebugEcho("IMAP: disabling GSSAPI");
89
  $this->_connection = imap_open($this->_server_string, $login, $password, NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
90
  }
91
 
92
  if ($this->_connection) {
93
  $this->_connected = true;
94
- DebugEcho("IMAP: connected");
95
  } else {
96
  LogInfo("imap_open failed: " . imap_last_error());
97
  }
@@ -105,9 +105,9 @@ class PostieIMAP {
105
  function getNumberOfMessages() {
106
  $status = imap_status($this->_connection, $this->_server_string, SA_ALL); //get all messages in debug mode so we can reprocess them
107
  DebugDump($status);
108
- if ($status)
109
  return $status->messages;
110
- else {
111
  LogInfo("Error imap_status did not return a value");
112
  //DebugDump($this);
113
  return 0;
@@ -137,7 +137,7 @@ class PostieIMAP {
137
  * Marks a message for deletion
138
  */
139
  function deleteMessage($index) {
140
- DebugEcho("IMAP: deleting message $index");
141
  imap_delete($this->_connection, $index);
142
  }
143
 
@@ -145,7 +145,7 @@ class PostieIMAP {
145
  * Handles purging any files that are marked for deletion
146
  */
147
  function expungeMessages() {
148
- DebugEcho("IMAP: expunge");
149
  imap_expunge($this->_connection);
150
  }
151
 
@@ -153,7 +153,7 @@ class PostieIMAP {
153
  * Handles disconnecting from the server
154
  */
155
  function disconnect() {
156
- DebugEcho("IMAP: closing connection");
157
  imap_close($this->_connection);
158
  $this->_connection = false;
159
  }
@@ -217,5 +217,3 @@ class PostiePOP3SSL Extends PostieIMAP {
217
  }
218
 
219
  }
220
-
221
- ?>
37
  */
38
  function TLSOn() {
39
  $this->_tls_on = true;
40
+ DebugEcho($this->_protocol . ": TLS enabled");
41
  }
42
 
43
  /**
75
  }
76
  if (preg_match("/google|gmail/i", $server)) {
77
  //Fix from Jim Hodgson http://www.jimhodgson.com/2006/07/19/postie/
78
+ DebugEcho($this->_protocol . ": using Google INBOX");
79
  $this->_server_string = "{" . $server . ":" . $port . $option . "}INBOX";
80
  } else {
81
  $this->_server_string = "{" . $server . ":" . $port . $option . "}";
82
  }
83
+ DebugEcho($this->_protocol . ": connection string - {$this->_server_string}");
84
  //Exchange connection, but requires PHP 5.3.2
85
  if (version_compare(phpversion(), '5.3.2', '<')) {
86
  $this->_connection = imap_open($this->_server_string, $login, $password);
87
  } else {
88
+ DebugEcho($this->_protocol . ": disabling GSSAPI");
89
  $this->_connection = imap_open($this->_server_string, $login, $password, NULL, 1, array('DISABLE_AUTHENTICATOR' => 'GSSAPI'));
90
  }
91
 
92
  if ($this->_connection) {
93
  $this->_connected = true;
94
+ DebugEcho($this->_protocol . ": connected");
95
  } else {
96
  LogInfo("imap_open failed: " . imap_last_error());
97
  }
105
  function getNumberOfMessages() {
106
  $status = imap_status($this->_connection, $this->_server_string, SA_ALL); //get all messages in debug mode so we can reprocess them
107
  DebugDump($status);
108
+ if ($status) {
109
  return $status->messages;
110
+ } else {
111
  LogInfo("Error imap_status did not return a value");
112
  //DebugDump($this);
113
  return 0;
137
  * Marks a message for deletion
138
  */
139
  function deleteMessage($index) {
140
+ DebugEcho($this->_protocol . ": deleting message $index");
141
  imap_delete($this->_connection, $index);
142
  }
143
 
145
  * Handles purging any files that are marked for deletion
146
  */
147
  function expungeMessages() {
148
+ DebugEcho($this->_protocol . ": expunge");
149
  imap_expunge($this->_connection);
150
  }
151
 
153
  * Handles disconnecting from the server
154
  */
155
  function disconnect() {
156
+ DebugEcho($this->_protocol . ": closing connection");
157
  imap_close($this->_connection);
158
  $this->_connection = false;
159
  }
217
  }
218
 
219
  }
 
 
readme.txt CHANGED
@@ -5,8 +5,8 @@ Author URI: http://allens-home.com/
5
  Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
- Tested up to: 3.8
9
- Stable tag: 1.5.18
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -198,13 +198,12 @@ Then use the Task Scheduler control panel to call wget or cron.
198
  * {MEDIUMWIDTH} gets replaced with the width of a medium image
199
  * {MEDIUM} gets replaced with the url to the medium-sized image
200
  * {PAGELINK} gets replaced with the URL of the file in WordPress
201
- * {POSTTITLE} gets replaced with the post title (subject)
202
  * {RELFILENAME} gets replaced with the relative path to the full-size image
203
  * {THUMBHEIGHT} gets replaced with the height of a thumbnail image
204
  * {THUMB} gets replaced with the url to the thumbnail image
205
  * {THUMBNAIL} same as {THUMB}
206
  * {THUMBWIDTH} gets replaced with the width of a thumbnail image
207
- * {TITLE} same as {POSTTITLE}
208
  * {URL} same as {FILELINK}
209
  * {WIDTH} gets replaced with width of the photo
210
  * {ICON} insert the icon for the attachment (for non-audio/image/video attachments only)
@@ -445,10 +444,16 @@ All script, style and body tags are stripped from html emails.
445
  Attachments are now processed in the order they were attached.
446
 
447
  == CHANGELOG ==
 
 
 
 
 
 
 
448
  = 1.5.18 (2014.01.12) =
449
  * Reverted text encoding change in 1.5.17.
450
 
451
-
452
  = 1.5.17 (2013.12.19) =
453
  * Fixed date calculation in test screen.
454
  * Fixed text encoding issues for systems with PHP 5.4
5
  Plugin URI: http://PostiePlugin.com/
6
  Tags: e-mail, email
7
  Requires at least: 3.0
8
+ Tested up to: 3.9
9
+ Stable tag: 1.5.19
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
198
  * {MEDIUMWIDTH} gets replaced with the width of a medium image
199
  * {MEDIUM} gets replaced with the url to the medium-sized image
200
  * {PAGELINK} gets replaced with the URL of the file in WordPress
 
201
  * {RELFILENAME} gets replaced with the relative path to the full-size image
202
  * {THUMBHEIGHT} gets replaced with the height of a thumbnail image
203
  * {THUMB} gets replaced with the url to the thumbnail image
204
  * {THUMBNAIL} same as {THUMB}
205
  * {THUMBWIDTH} gets replaced with the width of a thumbnail image
206
+ * {TITLE} same as {FILENAME}
207
  * {URL} same as {FILELINK}
208
  * {WIDTH} gets replaced with width of the photo
209
  * {ICON} insert the icon for the attachment (for non-audio/image/video attachments only)
444
  Attachments are now processed in the order they were attached.
445
 
446
  == CHANGELOG ==
447
+ = 1.5.19 (2014.04.30) =
448
+ * Updated image preview to recognize all variables.
449
+ * Updated "wordpress_default" images template to match WP 3.8.
450
+ * Clarified logging messages for IMAP/IMAP-SSL/POP3-SSL
451
+ * Removed POSTTITLE from templates since we don't know the actual title at template time.
452
+ * Verified WordPress 3.9 compatibility
453
+
454
  = 1.5.18 (2014.01.12) =
455
  * Reverted text encoding change in 1.5.17.
456
 
 
457
  = 1.5.17 (2013.12.19) =
458
  * Fixed date calculation in test screen.
459
  * Fixed text encoding issues for systems with PHP 5.4
templates/image_templates.php CHANGED
@@ -5,7 +5,7 @@ $robert_felty = '<div style="margin-right:10px;background:black;color:white;padd
5
  $no_wrappers = '<a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a>';
6
  $thumbnail_left = '<div style="float:left;margin-right:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
7
  $thumbnail_right = '<div style="float:right;margin-left:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
8
- $wordpress_default = '<div id="attachment_{ID}" class="wp-caption alignleft" style="width: {MEDIUMWIDTH};"><a rel="attachment wp-att-{ID}" href="{PAGELINK}"><img class="size-medium wp-image-{ID}" title="{TITLE}" alt="{CAPTION}" src="{MEDIUM}" /> </a><p class="wp-caption-text">{CAPTION}</p></div>';
9
  $postie_legacy = '<div class="postie-image-div"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{FILENAME}" title="{FILENAME}" style="border:none" class="postie-image" /></a></div>';
10
  $custom = isset($config) ? (array_key_exists('IMAGETEMPLATE', $config) ? $config['IMAGETEMPLATE'] : "") : "";
11
  $imageTemplates = compact('simple_link', 'no_wrappers', 'wordpress_default', 'thumbnail_left', 'thumbnail_right', 'robert_felty', 'postie_legacy', 'custom');
5
  $no_wrappers = '<a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a>';
6
  $thumbnail_left = '<div style="float:left;margin-right:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
7
  $thumbnail_right = '<div style="float:right;margin-left:10px;"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{CAPTION}" title="{CAPTION}" class="attachment" /></a></div>';
8
+ $wordpress_default = '<a href="{PAGELINK}"><img src="{MEDIUM}" alt="{CAPTION}" width="{MEDIUMWIDTH}" height="{MEDIUMHEIGHT}" class="alignnone size-medium wp-image-{ID}" /></a>';
9
  $postie_legacy = '<div class="postie-image-div"><a href="{IMAGE}"><img src="{THUMBNAIL}" alt="{FILENAME}" title="{FILENAME}" style="border:none" class="postie-image" /></a></div>';
10
  $custom = isset($config) ? (array_key_exists('IMAGETEMPLATE', $config) ? $config['IMAGETEMPLATE'] : "") : "";
11
  $imageTemplates = compact('simple_link', 'no_wrappers', 'wordpress_default', 'thumbnail_left', 'thumbnail_right', 'robert_felty', 'postie_legacy', 'custom');