Changeset 47659 for branches/4.0/src/wp-includes/formatting.php
- Timestamp:
- 04/29/2020 04:53:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/src/wp-includes/formatting.php
r37819 r47659 1162 1162 $filename_raw = $filename; 1163 1163 $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0)); 1164 1165 // Check for support for utf8 in the installed PCRE library once and store the result in a static. 1166 static $utf8_pcre = null; 1167 if ( ! isset( $utf8_pcre ) ) { 1168 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 1169 $utf8_pcre = @preg_match( '/^./u', 'a' ); 1170 } 1171 1172 if ( ! seems_utf8( $filename ) ) { 1173 $_ext = pathinfo( $filename, PATHINFO_EXTENSION ); 1174 $_name = pathinfo( $filename, PATHINFO_FILENAME ); 1175 $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext; 1176 } 1177 1178 if ( $utf8_pcre ) { 1179 $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); 1180 } 1181 1164 1182 /** 1165 1183 * Filter the list of characters to remove from a filename. … … 1171 1189 */ 1172 1190 $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); 1173 $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );1174 1191 $filename = str_replace($special_chars, '', $filename); 1175 1192 $filename = str_replace( array( '%20', '+' ), '-', $filename );
Note: See TracChangeset
for help on using the changeset viewer.