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 |
---|---|
831 | $filename = str_replace($special_chars, '', $filename); |
832 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
833 | $filename = trim($filename, '.-_'); |
834 |
|
835 | // Split the filename into a base and extension[s] |
836 | $parts = explode('.', $filename); |
837 |
|
838 | // Return if only one extension |
839 | if ( count($parts) <= 2 ) |
840 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
841 |
|
842 | // Process multiple extensions |
843 | $filename = array_shift($parts); |
844 | $extension = array_pop($parts); |
845 | $mimes = get_allowed_mime_types(); |
846 |
|
847 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
848 | // long alpha string not in the extension whitelist. |
849 | foreach ( (array) $parts as $part) { |
Line | Code |
858 | break; |
859 | } |
860 | } |
861 | if ( !$allowed ) |
862 | $filename .= '_'; |
863 | } |
864 | } |
865 | $filename .= '.' . $extension; |
866 |
|
867 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
868 | } |
869 |
|
870 | /** |
871 | * Sanitize username stripping out unsafe characters. |
872 | * |
873 | * Removes tags, octets, entities, and if strict is enabled, will only keep |
874 | * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, |
875 | * raw username (the username in the parameter), and the value of $strict as |
876 | * parameters for the 'sanitize_user' filter. |