sanitize_user [ WordPress Function ]
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Sanitize username stripping out unsafe characters.
Removes tags, octets, entities, and if strict is enabled, will only keep alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, raw username (the username in the parameter), and the value of $strict as parameters for the 'sanitize_user' filter.
Source
<?php
function sanitize_user( $username, $strict = false ) {
$raw_username = $username;
$username = wp_strip_all_tags( $username );
$username = remove_accents( $username );
// Kill octets
$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
// If strict, reduce to ASCII for max portability.
if ( $strict )
$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );
$username = trim( $username );
// Consolidate contiguous whitespace
$username = preg_replace( '|\s+|', ' ', $username );
return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/sanitize user « WordPress Codex
Description. Sanitize username stripping out unsafe characters. If $strict is true, only alphanumeric characters plus these: _, space, ., -, *, and @ are returned.
codex.wordpress.org - sanitize_user function: security risks if relaxed/disabled? - WordPress
Hi,. I'm running a vBulletin forum and just launched a new WordPress-based web site. I've set things up so users can log in to the WordPress site using their vB ...
wordpress.org - Inconsistencies in sanitize_user and sanitize_key - WordPress Trac
It seems to me that sanitize_user can perform inconsistently by returning a different string compared to the input when passed a previously sanitized string.
core.trac.wordpress.org - sanitize_user Wordpress hook details -- Adam Brown, BYU Political ...
Applied to a user name by the sanitize_user function. Filter function arguments: user name (after some cleaning up), raw user name, strict (true or false to use ...
adambrown.info