Make WordPress Core

Changeset 44677


Ignore:
Timestamp:
01/21/2019 09:51:29 PM (6 years ago)
Author:
pento
Message:

Media: Add a $real_mime parameter to the wp_check_filetype_and_ext filter.

This allows more accurate filtering of the filename and extension given to uploaded files.

Props desrosj, Tkama.
Fixes #45707.

File:
1 edited

Legend:

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

    r44673 r44677  
    26392639     *
    26402640     * @since 3.0.0
    2641      *
    2642      * @param array  $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
    2643      *                                          'proper_filename' keys.
    2644      * @param string $file                      Full path to the file.
    2645      * @param string $filename                  The name of the file (may differ from $file due to
    2646      *                                          $file being in a tmp directory).
    2647      * @param array  $mimes                     Key is the file extension with value as the mime type.
     2641     * @since 5.1.0 The $real_mime parameter was added.
     2642     *
     2643     * @param array       $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
     2644     *                                               'proper_filename' keys.
     2645     * @param string      $file                      Full path to the file.
     2646     * @param string      $filename                  The name of the file (may differ from $file due to
     2647     *                                               $file being in a tmp directory).
     2648     * @param array       $mimes                     Key is the file extension with value as the mime type.
     2649     * @param string|bool $real_mime                 The actual mime type or false if the type cannot be determined.
    26482650     */
    2649     return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
     2651    return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );
    26502652}
    26512653
Note: See TracChangeset for help on using the changeset viewer.