Changeset 47638 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 04/29/2020 03:38:43 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r47550 r47638 2006 2006 $filename_raw = $filename; 2007 2007 $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', chr( 0 ) ); 2008 2009 // Check for support for utf8 in the installed PCRE library once and store the result in a static. 2010 static $utf8_pcre = null; 2011 if ( ! isset( $utf8_pcre ) ) { 2012 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged 2013 $utf8_pcre = @preg_match( '/^./u', 'a' ); 2014 } 2015 2016 if ( ! seems_utf8( $filename ) ) { 2017 $_ext = pathinfo( $filename, PATHINFO_EXTENSION ); 2018 $_name = pathinfo( $filename, PATHINFO_FILENAME ); 2019 $filename = sanitize_title_with_dashes( $_name ) . '.' . $_ext; 2020 } 2021 2022 if ( $utf8_pcre ) { 2023 $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename ); 2024 } 2025 2008 2026 /** 2009 2027 * Filters the list of characters to remove from a filename. … … 2015 2033 */ 2016 2034 $special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw ); 2017 $filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );2018 2035 $filename = str_replace( $special_chars, '', $filename ); 2019 2036 $filename = str_replace( array( '%20', '+' ), '-', $filename );
Note: See TracChangeset
for help on using the changeset viewer.