WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
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.
This hook occurs 2 times in this file.
Line | Code |
---|---|
679 | $filename = str_replace($special_chars, '', $filename); |
680 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
681 | $filename = trim($filename, '.-_'); |
682 |
|
683 | // Split the filename into a base and extension[s] |
684 | $parts = explode('.', $filename); |
685 |
|
686 | // Return if only one extension |
687 | if ( count($parts) <= 2 ) |
688 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
689 |
|
690 | // Process multiple extensions |
691 | $filename = array_shift($parts); |
692 | $extension = array_pop($parts); |
693 | $mimes = get_allowed_mime_types(); |
694 |
|
695 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
696 | // long alpha string not in the extension whitelist. |
697 | foreach ( (array) $parts as $part) { |
Line | Code |
706 | break; |
707 | } |
708 | } |
709 | if ( !$allowed ) |
710 | $filename .= '_'; |
711 | } |
712 | } |
713 | $filename .= '.' . $extension; |
714 |
|
715 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
716 | } |
717 |
|
718 | /** |
719 | * Sanitize username stripping out unsafe characters. |
720 | * |
721 | * If $strict is true, only alphanumeric characters (as well as _, space, ., -, |
722 | * @) are returned. |
723 | * Removes tags, octets, entities, and if strict is enabled, will remove all |
724 | * non-ASCII characters. After sanitizing, it passes the username, raw username |