fixes to handle ISO-scrambled email subjects in wp-mail
git-svn-id: http://svn.automattic.com/wordpress/trunk@907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8091c63bff
commit
a6165937b1
|
@ -375,4 +375,18 @@ function strip_all_but_one_link($text, $mylink) {
|
|||
return $text;
|
||||
}
|
||||
|
||||
|
||||
// used by wp-mail to handle charsets in email subjects
|
||||
|
||||
function wp_iso_descrambler($string) {
|
||||
/* this may only work with iso-8859-1, I'm afraid */
|
||||
if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
|
||||
return $string;
|
||||
} else {
|
||||
$subject = str_replace('_', ' ', $matches[2]);
|
||||
$subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject);
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -73,6 +73,9 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
|
|||
if (preg_match('/Subject: /', $line)) {
|
||||
$subject = trim($line);
|
||||
$subject = substr($subject, 9, strlen($subject)-9);
|
||||
if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $subject)) {
|
||||
$subject = wp_iso_descrambler($subject);
|
||||
}
|
||||
if ($use_phoneemail) {
|
||||
$subject = explode($phoneemail_separator, $subject);
|
||||
$subject = trim($subject[0]);
|
||||
|
|
Loading…
Reference in New Issue