mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Eliminate preg_replace with /e. Props tbaboon. fixes #8689
git-svn-id: https://develop.svn.wordpress.org/trunk@11098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1402,6 +1402,15 @@ class PHPMailer {
|
||||
return trim($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for converting to "=XX".
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function EncodeQ_callback ($matches) {
|
||||
return "=".sprintf("%02X", ord($matches[1]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode string to q encoding.
|
||||
* @access private
|
||||
@@ -1413,15 +1422,18 @@ class PHPMailer {
|
||||
|
||||
switch (strtolower($position)) {
|
||||
case 'phrase':
|
||||
$encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
$encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/",
|
||||
"EncodeQ_callback", $encoded);
|
||||
break;
|
||||
case 'comment':
|
||||
$encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
$encoded = preg_replace_callback("/([\(\)\"])/",
|
||||
"EncodeQ_callback", $encoded);
|
||||
break;
|
||||
case 'text':
|
||||
default:
|
||||
/* Replace every high ascii, control =, ? and _ characters */
|
||||
$encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
|
||||
"'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
$encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/',
|
||||
"EncodeQ_callback", $encoded);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user