Changeset 11098
- Timestamp:
- 04/27/2009 04:17:24 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-phpmailer.php
r10459 r11098 1404 1404 1405 1405 /** 1406 * Callback for converting to "=XX". 1407 * @access private 1408 * @return string 1409 */ 1410 function EncodeQ_callback ($matches) { 1411 return "=".sprintf("%02X", ord($matches[1])); 1412 } 1413 1414 /** 1406 1415 * Encode string to q encoding. 1407 1416 * @access private … … 1414 1423 switch (strtolower($position)) { 1415 1424 case 'phrase': 1416 $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); 1425 $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/", 1426 "EncodeQ_callback", $encoded); 1417 1427 break; 1418 1428 case 'comment': 1419 $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); 1429 $encoded = preg_replace_callback("/([\(\)\"])/", 1430 "EncodeQ_callback", $encoded); 1431 break; 1420 1432 case 'text': 1421 1433 default: 1422 1434 /* Replace every high ascii, control =, ? and _ characters */ 1423 $encoded = preg_replace ('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',1424 "'='.sprintf('%02X', ord('\\1'))", $encoded);1435 $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/', 1436 "EncodeQ_callback", $encoded); 1425 1437 break; 1426 1438 } -
trunk/wp-includes/formatting.php
r11070 r11098 774 774 775 775 /** 776 * Callback used to change %uXXXX to &#YYY; syntax 777 * 778 * @since 2.8? 779 * 780 * @param array $matches Single Match 781 * @return string An HTML entity 782 */ 783 function funky_javascript_callback($matches) { 784 return "&#".base_convert($matches[1],16,10).";"; 785 } 786 787 /** 776 788 * Fixes javascript bugs in browsers. 777 789 * … … 789 801 global $is_macIE, $is_winIE; 790 802 791 /** @todo use preg_replace_callback() instead */792 803 if ( $is_winIE || $is_macIE ) 793 $text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text); 804 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", 805 "funky_javascript_callback", 806 $text); 794 807 795 808 return $text;
Note: See TracChangeset
for help on using the changeset viewer.