Ticket #16849: 16849.diff
File 16849.diff, 4.5 KB (added by , 4 years ago) |
---|
-
src/wp-admin/includes/file.php
725 725 * 726 726 * @param string[] $file Reference to a single element of `$_FILES`. 727 727 * 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 * } 730 742 * @param string $time Time formatted in 'yyyy/mm'. 731 743 * @param string $action Expected value for `$_POST['action']`. 732 744 * @return string[] On success, returns an associative array of file attributes. … … 745 757 * Filters the data for a file before it is uploaded to WordPress. 746 758 * 747 759 * 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` 748 764 * 749 765 * @since 2.9.0 as 'wp_handle_upload_prefilter'. 750 766 * @since 4.0.0 Converted to a dynamic hook with `$action`. 751 767 * 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`. 753 769 */ 754 770 $file = apply_filters( "{$action}_prefilter", $file ); 755 771 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 756 789 // You may define your own function and pass the name in $overrides['upload_error_handler']. 757 790 $upload_error_handler = 'wp_handle_upload_error'; 758 791 if ( isset( $overrides['upload_error_handler'] ) ) { -
src/wp-includes/functions.php
2791 2791 * @since 2.0.4 2792 2792 * 2793 2793 * @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. 2795 2795 * @return array { 2796 2796 * Values for the extension and mime type. 2797 2797 * … … 2833 2833 * @param string $file Full path to the file. 2834 2834 * @param string $filename The name of the file (may differ from $file due to $file being 2835 2835 * 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. 2837 2837 * @return array { 2838 2838 * Values for the extension, mime type, and corrected filename. 2839 2839 *