Code Modernisation: Introduce the spread operator in wp-admin/includes/media.php.

Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46131 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-15 11:11:14 +00:00
parent 752c36bbf4
commit 49de2b7312

View File

@ -520,7 +520,7 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
* @param callable $content_func Function that outputs the content.
* @param mixed ...$args Optional additional parameters to pass to the callback function when it's called.
*/
function wp_iframe( $content_func ) {
function wp_iframe( $content_func, ...$args ) {
_wp_admin_html_begin();
?>
<title><?php bloginfo( 'name' ); ?> &rsaquo; <?php _e( 'Uploads' ); ?> &#8212; <?php _e( 'WordPress' ); ?></title>
@ -606,8 +606,6 @@ function wp_iframe( $content_func ) {
</script>
<?php
$args = func_get_args();
$args = array_slice( $args, 1 );
call_user_func_array( $content_func, $args );
/** This action is documented in wp-admin/admin-footer.php */