WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/24/2020 06:01:48 PM (15 months ago)
Author:
SergeyBiryukov
Message:

Media: Remove accents in sanitize_file_name().

This brings some consistency with sanitize_title() and sanitize_user().

Props tar.gz, NumidWasNotAvailable, juliobox, p_enrique, cristovaov, zodiac1978, mikeschroder, markoheijnen, chriscct7, swissspidy, DrProtocols, pento, gitlost, joemcgill, dustinbolton, programmin, Vayu, MaximeCulea, lucasbustamante, nilovelez, RavanH, audrasjb, SergeyBiryukov.
See #22363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r48596 r48603  
    19851985 */
    19861986function sanitize_file_name( $filename ) {
    1987     $filename_raw  = $filename;
     1987    $filename_raw = $filename;
     1988    $filename     = remove_accents( $filename );
     1989
    19881990    $special_chars = array( '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', '%', '+', '’', '«', '»', '”', '“', chr( 0 ) );
    19891991
     
    20142016     */
    20152017    $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, '.-_' );
    20202023
    20212024    if ( false === strpos( $filename, '.' ) ) {
     
    20692072        }
    20702073    }
     2074
    20712075    $filename .= '.' . $extension;
     2076
    20722077    /** This filter is documented in wp-includes/formatting.php */
    20732078    return apply_filters( 'sanitize_file_name', $filename, $filename_raw );
Note: See TracChangeset for help on using the changeset viewer.