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 |
|---|---|
| 673 | $filename = str_replace($special_chars, '', $filename); |
| 674 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
| 675 | $filename = trim($filename, '.-_'); |
| 676 | |
| 677 | // Split the filename into a base and extension[s] |
| 678 | $parts = explode('.', $filename); |
| 679 | |
| 680 | // Return if only one extension |
| 681 | if ( count($parts) <= 2 ) |
| 682 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
| 683 | |
| 684 | // Process multiple extensions |
| 685 | $filename = array_shift($parts); |
| 686 | $extension = array_pop($parts); |
| 687 | $mimes = get_allowed_mime_types(); |
| 688 | |
| 689 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
| 690 | // long alpha string not in the extension whitelist. |
| 691 | foreach ( (array) $parts as $part) { |
| Line | Code |
| 700 | break; |
| 701 | } |
| 702 | } |
| 703 | if ( !$allowed ) |
| 704 | $filename .= '_'; |
| 705 | } |
| 706 | } |
| 707 | $filename .= '.' . $extension; |
| 708 | |
| 709 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
| 710 | } |
| 711 | |
| 712 | /** |
| 713 | * Sanitize username stripping out unsafe characters. |
| 714 | * |
| 715 | * If $strict is true, only alphanumeric characters (as well as _, space, ., -, |
| 716 | * @) are returned. |
| 717 | * Removes tags, octets, entities, and if strict is enabled, will remove all |
| 718 | * non-ASCII characters. After sanitizing, it passes the username, raw username |