Changeset 11178 for trunk/wp-includes/functions.php
- Timestamp:
- 05/04/2009 08:20:48 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r11170 r11178 2014 2014 */ 2015 2015 function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) { 2016 $filename = strtolower( $filename ); 2016 // sanitize the file name before we begin processing 2017 $filename = sanitize_file_name($filename); 2018 2017 2019 // separate the filename into a name and extension 2018 2020 $info = pathinfo($filename); 2019 2021 $ext = !empty($info['extension']) ? $info['extension'] : ''; 2020 2022 $name = basename($filename, ".{$ext}"); 2021 2023 2022 2024 // edge case: if file is named '.ext', treat as an empty name 2023 2025 if( $name === ".$ext" ) … … 2031 2033 2032 2034 if ( !empty( $ext ) ) 2033 $ext = strtolower( ".$ext" ); 2034 2035 $filename = str_replace( $ext, '', $filename ); 2036 // Strip % so the server doesn't try to decode entities. 2037 $filename = str_replace('%', '', sanitize_title_with_dashes( $filename ) ) . $ext; 2035 $ext = ".$ext"; 2038 2036 2039 2037 while ( file_exists( $dir . "/$filename" ) ) {
Note: See TracChangeset
for help on using the changeset viewer.