Make WordPress Core


Ignore:
Timestamp:
05/03/2010 11:46:42 PM (14 years ago)
Author:
ryan
Message:

Fix user validation feedback. Props sivel. fixes #13162

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/formatting.php

    r14412 r14428  
    736736function sanitize_user( $username, $strict = false ) {
    737737    $raw_username = $username;
    738     $username = wp_strip_all_tags($username);
     738    $username = wp_strip_all_tags( $username );
     739    $username = remove_accents( $username );
    739740    // Kill octets
    740     $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
    741     $username = preg_replace('/&.+?;/', '', $username); // Kill entities
     741    $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
     742    $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
    742743
    743744    // If strict, reduce to ASCII for max portability.
    744745    if ( $strict )
    745         $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
     746        $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
    746747
    747748    // Consolidate contiguous whitespace
    748     $username = preg_replace('|\s+|', ' ', $username);
    749 
    750     return apply_filters('sanitize_user', $username, $raw_username, $strict);
     749    $username = preg_replace( '|\s+|', ' ', $username );
     750
     751    return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
    751752}
    752753
Note: See TracChangeset for help on using the changeset viewer.