Welcome, visitor! Log in
 

Source View: sanitize_user

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN  (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
297       $name = trim($name, '-');
298       return $name;
299  }
300  
301  function sanitize_user( $username, $strict = false ) {
302       $raw_username = $username;
303       $username = strip_tags($username);
304       // Kill octets
305       $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
306       $username = preg_replace('/&.+?;/', '', $username); // Kill entities
307  
308       // If strict, reduce to ASCII for max portability.
309       if ( $strict )
310            $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
311  
312       return apply_filters('sanitize_user', $username, $raw_username, $strict);
313  }
314  
315  function sanitize_title($title, $fallback_title = '') {
316       $title = strip_tags($title);
317       $title = apply_filters('sanitize_title', $title);
318  
319       if (empty($title)) {
320            $title = $fallback_title;
321       }
322  
323       return $title;
324  }
325  
326  function sanitize_title_with_dashes($title) {
327       $title = strip_tags($title);