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
319       $name = trim($name, '-');
320       return $name;
321  }
322  
323  function sanitize_user( $username, $strict = false ) {
324       $raw_username = $username;
325       $username = strip_tags($username);
326       // Kill octets
327       $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username);
328       $username = preg_replace('/&.+?;/', '', $username); // Kill entities
329  
330       // If strict, reduce to ASCII for max portability.
331       if ( $strict )
332            $username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
333  
334       return apply_filters('sanitize_user', $username, $raw_username, $strict);
335  }
336  
337  function sanitize_title($title, $fallback_title = '') {
338       $title = strip_tags($title);
339       $title = apply_filters('sanitize_title', $title);
340  
341       if ( '' === $title || false === $title )
342            $title = $fallback_title;
343  
344       return $title;
345  }
346  
347  function sanitize_title_with_dashes($title) {
348       $title = strip_tags($title);
349       // Preserve escaped octets.