Changeset 48603 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 07/24/2020 06:01:48 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r48596 r48603 1985 1985 */ 1986 1986 function sanitize_file_name( $filename ) { 1987 $filename_raw = $filename; 1987 $filename_raw = $filename; 1988 $filename = remove_accents( $filename ); 1989 1988 1990 $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) ); 1989 1991 … … 2014 2016 */ 2015 2017 $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); 2016 $filename = str_replace( $special_chars, '', $filename ); 2017 $filename = str_replace( array( '%20', '+' ), '-', $filename ); 2018 $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); 2019 $filename = trim( $filename, '.-_' ); 2018 2019 $filename = str_replace( $special_chars, '', $filename ); 2020 $filename = str_replace( array( '%20', '+' ), '-', $filename ); 2021 $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); 2022 $filename = trim( $filename, '.-_' ); 2020 2023 2021 2024 if ( false === strpos( $filename, '.' ) ) { … … 2069 2072 } 2070 2073 } 2074 2071 2075 $filename .= '.' . $extension; 2076 2072 2077 /** This filter is documented in wp-includes/formatting.php */ 2073 2078 return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
Note: See TracChangeset
for help on using the changeset viewer.