Ticket #31328: 31328.2.patch
File 31328.2.patch, 2.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/formatting.php
785 785 $unicode .= chr($value); 786 786 $unicode_length++; 787 787 } else { 788 if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; 788 if ( count( $values ) == 0 ) { 789 if ( $value < 224 ) { 790 $num_octets = 2; 791 } elseif ( $value < 240 ) { 792 $num_octets = 3; 793 } else { 794 $num_octets = 4; 795 } 796 } 789 797 790 798 $values[] = $value; 791 799 … … 792 800 if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) 793 801 break; 794 802 if ( count( $values ) == $num_octets ) { 795 if ($num_octets == 3) { 796 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); 797 $unicode_length += 9; 798 } else { 799 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); 800 $unicode_length += 6; 803 for ( $j = 0; $j < $num_octets; $j++ ) { 804 $unicode .= '%' . dechex( $values[ $j ] ); 801 805 } 802 806 807 $unicode_length += $num_octets * 3; 808 803 809 $values = array(); 804 810 $num_octets = 1; 805 811 } … … 1266 1272 // Restore octets. 1267 1273 $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title); 1268 1274 1275 if ( 'save' === $context ) { 1276 // Strip Emoticons 1277 $title = preg_replace( '/[\x{1F600}-\x{1F64F}]/u', '', $title ); 1278 1279 // Strip Miscellaneous Symbols and Pictographs 1280 $title = preg_replace( '/[\x{1F300}-\x{1F5FF}]/u', '', $title ); 1281 1282 // Strip Transport And Map Symbols 1283 $title = preg_replace( '/[\x{1F680}-\x{1F6FF}]/u', '', $title ); 1284 1285 // Strip Miscellaneous Symbols 1286 $title = preg_replace( '/[\x{2600}-\x{26FF}]/u', '', $title ); 1287 1288 // Strip Dingbats 1289 $title = preg_replace( '/[\x{2700}-\x{27BF}]/u', '', $title ); 1290 } 1291 1269 1292 if (seems_utf8($title)) { 1270 1293 if (function_exists('mb_strtolower')) { 1271 1294 $title = mb_strtolower($title, 'UTF-8'); … … 1277 1300 $title = preg_replace('/&.+?;/', '', $title); // kill entities 1278 1301 $title = str_replace('.', '-', $title); 1279 1302 1280 if ( 'save' == $context ) {1303 if ( 'save' === $context ) { 1281 1304 // Convert nbsp, ndash and mdash to hyphens 1282 1305 $title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title ); 1283 1306