Make WordPress Core

Ticket #16849: 16849.diff

File 16849.diff, 4.5 KB (added by johnbillion, 4 years ago)
  • src/wp-admin/includes/file.php

     
    725725 *
    726726 * @param string[]       $file      Reference to a single element of `$_FILES`.
    727727 *                                  Call the function once for each uploaded file.
    728  * @param string[]|false $overrides An associative array of names => values
    729  *                                  to override default variables. Default false.
     728 * @param array|false    $overrides {
     729 *     An array of override parameters for this file, or boolean false if none are provided.
     730 *
     731 *     @type callable $upload_error_handler     Function to call when there is an error during the upload process.
     732 *                                              @see wp_handle_upload_error().
     733 *     @type callable $unique_filename_callback Function to call when determining a unique file name for the file.
     734 *                                              @see wp_unique_filename().
     735 *     @type string[] $upload_error_strings     The strings that describe the error indicated in
     736 *                                              `$_FILES[{form field}]['error']`.
     737 *     @type bool     $test_form                Whether to test that the `$_POST['action]` parameter is as expected.
     738 *     @type bool     $test_size                Whether to test that the file size is greater than zero bytes.
     739 *     @type bool     $test_type                Whether to test that the mime type of the file is as expected.
     740 *     @type string[] $mimes                    Array of allowed mime types keyed by their file extension regex.
     741 * }
    730742 * @param string         $time      Time formatted in 'yyyy/mm'.
    731743 * @param string         $action    Expected value for `$_POST['action']`.
    732744 * @return string[] On success, returns an associative array of file attributes.
     
    745757         * Filters the data for a file before it is uploaded to WordPress.
    746758         *
    747759         * The dynamic portion of the hook name, `$action`, refers to the post action.
     760         * Possible filter names include:
     761         *
     762         *  - `wp_handle_sideload_prefilter`
     763         *  - `wp_handle_upload_prefilter`
    748764         *
    749765         * @since 2.9.0 as 'wp_handle_upload_prefilter'.
    750766         * @since 4.0.0 Converted to a dynamic hook with `$action`.
    751767         *
    752          * @param string[] $file An array of data for a single file.
     768         * @param string[] $file An array of data for the file. Reference to a single element of `$_FILES`.
    753769         */
    754770        $file = apply_filters( "{$action}_prefilter", $file );
    755771
     772        /**
     773         * Filters the override parameters for a file before it is uploaded to WordPress.
     774         *
     775         * The dynamic portion of the hook name, `$action`, refers to the post action.
     776         * Possible filter names include:
     777         *
     778         *  - `wp_handle_sideload_overrides`
     779         *  - `wp_handle_upload_overrides`
     780         *
     781         * @since 5.7.0
     782         *
     783         * @param array|false $overrides An array of override parameters for this file. Boolean false if none are
     784         *                               provided. @see _wp_handle_upload().
     785         * @param string[]    $file      An array of data for the file. Reference to a single element of `$_FILES`.
     786         */
     787        $overrides = apply_filters( "{$action}_overrides", $overrides, $file );
     788
    756789        // You may define your own function and pass the name in $overrides['upload_error_handler'].
    757790        $upload_error_handler = 'wp_handle_upload_error';
    758791        if ( isset( $overrides['upload_error_handler'] ) ) {
  • src/wp-includes/functions.php

     
    27912791 * @since 2.0.4
    27922792 *
    27932793 * @param string   $filename File name or path.
    2794  * @param string[] $mimes    Optional. Array of mime types keyed by their file extension regex.
     2794 * @param string[] $mimes    Optional. Array of allowed mime types keyed by their file extension regex.
    27952795 * @return array {
    27962796 *     Values for the extension and mime type.
    27972797 *
     
    28332833 * @param string   $file     Full path to the file.
    28342834 * @param string   $filename The name of the file (may differ from $file due to $file being
    28352835 *                           in a tmp directory).
    2836  * @param string[] $mimes    Optional. Array of mime types keyed by their file extension regex.
     2836 * @param string[] $mimes    Optional. Array of allowed mime types keyed by their file extension regex.
    28372837 * @return array {
    28382838 *     Values for the extension, mime type, and corrected filename.
    28392839 *