Make WordPress Core


Ignore:
Timestamp:
01/25/2006 03:09:16 AM (20 years ago)
Author:
ryan
Message:

Username sanitization cleanups.

File:
1 edited

Legend:

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

    r3454 r3481  
    266266}
    267267
    268 function sanitize_user( $username ) {
     268function sanitize_user( $username, $strict = false ) {
    269269    $raw_username = $username;
    270270    $username = strip_tags($username);
     
    272272    $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
    273273    $username = preg_replace('/&.+?;/', '', $username); // Kill entities
    274     return apply_filters('sanitize_user', $username, $raw_username);
     274
     275    // If strict, reduce to ASCII for max portability.
     276    if ( $strict )
     277        $username = preg_replace('|[^a-z0-9 _.-@]|i', '', $username);
     278
     279    return apply_filters('sanitize_user', $username, $raw_username, $strict);
    275280}
    276281
Note: See TracChangeset for help on using the changeset viewer.