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