Make WordPress Core

Ticket #10823: 10823.3.diff

File 10823.3.diff, 1.3 KB (added by SergeyBiryukov, 13 years ago)
  • wp-includes/formatting.php

     
    821821        $username = remove_accents( $username );
    822822        // Kill octets
    823823        $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    824         $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
     824        $username = preg_replace( '/&#?\w+;/', '', $username ); // Kill entities
    825825
    826826        // If strict, reduce to ASCII for max portability.
    827827        if ( $strict )
     
    905905        // Restore octets.
    906906        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
    907907
    908         if (seems_utf8($title)) {
    909                 if (function_exists('mb_strtolower')) {
    910                         $title = mb_strtolower($title, 'UTF-8');
    911                 }
    912                 $title = utf8_uri_encode($title, 200);
     908        if ( seems_utf8( $title ) ) {
     909                if ( function_exists( 'mb_strtolower' ) )
     910                        $title = mb_strtolower( $title, 'UTF-8' );
     911
     912                $title = utf8_uri_encode( $title, 200 );
    913913        }
    914914
    915         $title = strtolower($title);
    916         $title = preg_replace('/&.+?;/', '', $title); // kill entities
    917         $title = str_replace('.', '-', $title);
     915        $title = strtolower( $title );
     916        $title = preg_replace( '/&#?\w+;/', '', $title ); // kill entities
     917        $title = str_replace( '.', '-', $title );
    918918
    919919        if ( 'save' == $context ) {
    920920                // nbsp, ndash and mdash