Ticket #10823: 10823.4.diff
File 10823.4.diff, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-includes/formatting.php
1145 1145 $username = remove_accents( $username ); 1146 1146 // Kill octets 1147 1147 $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username ); 1148 $username = preg_replace( '/& .+?;/', '', $username ); // Kill entities1148 $username = preg_replace( '/&#?\w+;/', '', $username ); // Kill entities 1149 1149 1150 1150 // If strict, reduce to ASCII for max portability. 1151 if ( $strict ) 1151 if ( $strict ) { 1152 1152 $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username ); 1153 } 1153 1154 1154 1155 $username = trim( $username ); 1155 1156 // Consolidate contiguous whitespace … … 1258 1259 * @return string The sanitized title. 1259 1260 */ 1260 1261 function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) { 1261 $title = strip_tags( $title);1262 $title = strip_tags( $title ); 1262 1263 // Preserve escaped octets. 1263 $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);1264 $title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title ); 1264 1265 // Remove percent signs that are not part of an octet. 1265 $title = str_replace( '%', '', $title);1266 $title = str_replace( '%', '', $title); 1266 1267 // Restore octets. 1267 $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);1268 $title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title ); 1268 1269 1269 if ( seems_utf8($title)) {1270 if ( function_exists('mb_strtolower')) {1271 $title = mb_strtolower( $title, 'UTF-8');1270 if ( seems_utf8( $title ) ) { 1271 if ( function_exists( 'mb_strtolower' ) ) { 1272 $title = mb_strtolower( $title, 'UTF-8' ); 1272 1273 } 1273 $title = utf8_uri_encode( $title, 200);1274 $title = utf8_uri_encode( $title, 200 ); 1274 1275 } 1275 1276 1276 $title = strtolower( $title);1277 $title = preg_replace( '/&.+?;/', '', $title); // kill entities1278 $title = str_replace( '.', '-', $title);1277 $title = strtolower( $title ); 1278 $title = preg_replace( '/&#?\w+;/', '', $title ); // kill entities 1279 $title = str_replace( '.', '-', $title ); 1279 1280 1280 1281 if ( 'save' == $context ) { 1281 1282 // Convert nbsp, ndash and mdash to hyphens