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 |
---|---|
697 | $filename = str_replace($special_chars, '', $filename); |
698 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
699 | $filename = trim($filename, '.-_'); |
700 |
|
701 | // Split the filename into a base and extension[s] |
702 | $parts = explode('.', $filename); |
703 |
|
704 | // Return if only one extension |
705 | if ( count($parts) <= 2 ) |
706 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
707 |
|
708 | // Process multiple extensions |
709 | $filename = array_shift($parts); |
710 | $extension = array_pop($parts); |
711 | $mimes = get_allowed_mime_types(); |
712 |
|
713 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
714 | // long alpha string not in the extension whitelist. |
715 | foreach ( (array) $parts as $part) { |
Line | Code |
724 | break; |
725 | } |
726 | } |
727 | if ( !$allowed ) |
728 | $filename .= '_'; |
729 | } |
730 | } |
731 | $filename .= '.' . $extension; |
732 |
|
733 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
734 | } |
735 |
|
736 | /** |
737 | * Sanitize username stripping out unsafe characters. |
738 | * |
739 | * Removes tags, octets, entities, and if strict is enabled, will only keep |
740 | * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, |
741 | * raw username (the username in the parameter), and the value of $strict as |
742 | * parameters for the 'sanitize_user' filter. |