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 |
---|---|
719 | $filename = str_replace($special_chars, '', $filename); |
720 | $filename = preg_replace('/[\s-]+/', '-', $filename); |
721 | $filename = trim($filename, '.-_'); |
722 |
|
723 | // Split the filename into a base and extension[s] |
724 | $parts = explode('.', $filename); |
725 |
|
726 | // Return if only one extension |
727 | if ( count($parts) <= 2 ) |
728 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
729 |
|
730 | // Process multiple extensions |
731 | $filename = array_shift($parts); |
732 | $extension = array_pop($parts); |
733 | $mimes = get_allowed_mime_types(); |
734 |
|
735 | // Loop over any intermediate extensions. Munge them with a trailing underscore if they are a 2 - 5 character |
736 | // long alpha string not in the extension whitelist. |
737 | foreach ( (array) $parts as $part) { |
Line | Code |
746 | break; |
747 | } |
748 | } |
749 | if ( !$allowed ) |
750 | $filename .= '_'; |
751 | } |
752 | } |
753 | $filename .= '.' . $extension; |
754 |
|
755 | return apply_filters('sanitize_file_name', $filename, $filename_raw); |
756 | } |
757 |
|
758 | /** |
759 | * Sanitize username stripping out unsafe characters. |
760 | * |
761 | * Removes tags, octets, entities, and if strict is enabled, will only keep |
762 | * alphanumeric, _, space, ., -, @. After sanitizing, it passes the username, |
763 | * raw username (the username in the parameter), and the value of $strict as |
764 | * parameters for the 'sanitize_user' filter. |