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 |
|---|---|
| 846 | $filename = str_replace($special_chars, '', $filename); |
| 847 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
| 848 | $filename = trim($filename, '.-_'); |
| 849 | |
| 850 | // Split the filename into a base and extension[s] |
| 851 | $parts = explode('.', $filename); |
| 852 | |
| 853 | // Return if only one extension |
| 854 | if ( count($parts) <= 2 ) |
| 855 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
| 856 | |
| 857 | // Process multiple extensions |
| 858 | $filename = array_shift($parts); |
| 859 | $extension = array_pop($parts); |
| 860 | $mimes = get_allowed_mime_types(); |
| 861 | |
| 862 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
| 863 | // long alpha string not in the extension whitelist. |
| 864 | foreach ( (array) $parts as $part) { |
| Line | Code |
| 873 | break; |
| 874 | } |
| 875 | } |
| 876 | if ( !$allowed ) |
| 877 | $filename .= '_'; |
| 878 | } |
| 879 | } |
| 880 | $filename .= '.' . $extension; |
| 881 | |
| 882 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
| 883 | } |
| 884 | |
| 885 | /** |
| 886 | * Sanitizes a username, stripping out unsafe characters. |
| 887 | * |
| 888 | * Removes tags, octets, entities, and if strict is enabled, will only keep |
| 889 | * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, |
| 890 | * raw username (the username in the parameter), and the value of $strict as |
| 891 | * parameters for the 'sanitize_user' filter. |