Skip to content

Commit

Permalink
= 1.0.4b =
Browse files Browse the repository at this point in the history
* Fixed bug where unicode characters weren't getting encoded correctly, and were truncating the post.
* Fixed bug where changing some settings on the admin screen didn't enable the "Save Changes" button.
  • Loading branch information
codebykat committed Nov 21, 2013
1 parent bb1b5b2 commit 6edbc3d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 38 deletions.
33 changes: 8 additions & 25 deletions class-post-by-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Post_By_Email {
*
* @var string
*/
protected $version = '1.0.4';
protected $version = '1.0.4b';

/**
* Unique identifier for the plugin.
Expand Down Expand Up @@ -678,30 +678,13 @@ protected function get_message_body( $uid ) {
$content = strip_tags( $content, '<img><p><br><i><b><u><em><strong><strike><font><span><div><style><a>' );
$content = trim( $content );

// fix up special characters which get turned into unicode and destroy everything
// via http://stackoverflow.com/questions/12007613/devilish-curly-quotes

// First, replace UTF-8 characters.
$content = str_replace(
array(
"\xe2\x80\x98",
"\xe2\x80\x99",
"\xe2\x80\x9c",
"\xe2\x80\x9d",
"\xe2\x80\x93",
"\xe2\x80\x94",
"\xe2\x80\xa6",
),
array( "'", "'", '"', '"', '-', '--', '...' ),
$content
);

// Next, replace their Windows-1252 equivalents... and non-breaking spaces
$content = str_replace(
array( chr( 145 ), chr( 146 ), chr( 147 ), chr( 148 ), chr( 150 ), chr( 151 ), chr( 133 ), chr( 0xA0 ) ),
array( "'", "'", '"', '"', '-', '--', '...', ' ' ),
$content
);
// encode to UTF-8; this fixes up unicode characters like smart quotes, accents, etc.
$charset = $body->getCharset();
if ( 'iso-8859-1' == $charset ) {
$content = utf8_encode( $content );
} elseif ( function_exists( 'iconv' ) ) {
$content = iconv( $charset, 'UTF-8', $content );
}

return $content;
}
Expand Down
28 changes: 16 additions & 12 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ jQuery( document ).ready( function() {
// submit buttons start out disabled until changes are made
jQuery( 'form#post-by-email-options input[type=submit]' ).attr( 'disabled', 'disabled' );

function settingsChanged() {
jQuery( 'form#post-by-email-options input[type=submit]' ).removeAttr( 'disabled' );

// alert on "Check Now" if settings have been changed but not saved yet
jQuery( 'a#post-by-email-check-now' ).click( function(e) {
message = jQuery( 'span#post-by-email-settings-changed' ).html();
if ( ! confirm( PostByEmailVars['settingsMessage'] ) ) {
e.preventDefault();
}
} );
}

jQuery( 'form#post-by-email-options input' ).change( settingsChanged );
jQuery( 'form#post-by-email-options select' ).change( settingsChanged );

// AJAX request to clear the log
jQuery( 'a#clearLog' ).click( function( e ) {
e.preventDefault();
Expand Down Expand Up @@ -49,6 +64,7 @@ jQuery( document ).ready( function() {
jQuery( 'input#post_by_email_options\\[mailserver_port\\]' ).val( 993 );
jQuery( 'input#post_by_email_options\\[delete_messages\\]' ).attr( 'checked', 'checked' );
jQuery( 'input#post_by_email_options\\[delete_messages\\]' ).attr( 'disabled', false );
settingsChanged();
} );

if ( 'POP3' == jQuery( 'select#post_by_email_options\\[mailserver_protocol\\]' ).val() ) {
Expand All @@ -74,16 +90,4 @@ jQuery( document ).ready( function() {
}
} );

// alert on "Check Now" if settings have been changed but not saved yet
jQuery( 'input' ).change( function() {
jQuery( 'form#post-by-email-options input[type=submit]' ).removeAttr( 'disabled' );

jQuery( 'a#post-by-email-check-now' ).click( function(e) {
message = jQuery( 'span#post-by-email-settings-changed' ).html();
if ( ! confirm( PostByEmailVars['settingsMessage'] ) ) {
e.preventDefault();
}
} );
} );

} );
2 changes: 1 addition & 1 deletion post-by-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Post By Email
* Plugin URI: http://codebykat.wordpress.com
* Description: Create new posts on your WordPress blog by sending email to a specific email address.
* Version: 1.0.4
* Version: 1.0.4b
* Author: Kat Hagan
* Author URI: http://profiles.wordpress.org/codebykat
* Text Domain: post-by-email
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ Then, provide as much of the following information as possible:

## Changelog ##

### 1.0.4b ###
* Fixed bug where unicode characters weren't getting encoded correctly, and were truncating the post.
* Fixed bug where changing some settings on the admin screen didn't enable the "Save Changes" button.

### 1.0.4 ###
* Added screenshots, expanded Readme and contextual help.
* Added support for user-included gallery shortcode (allows use of WP's gallery options).
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ Then, provide as much of the following information as possible:

== Changelog ==

= 1.0.4b =
* Fixed bug where unicode characters weren't getting encoded correctly, and were truncating the post.
* Fixed bug where changing some settings on the admin screen didn't enable the "Save Changes" button.

= 1.0.4 =
* Added screenshots, expanded Readme and contextual help.
* Added support for user-included gallery shortcode (allows use of WP's gallery options).
Expand Down

0 comments on commit 6edbc3d

Please sign in to comment.