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.
Built from https://develop.svn.wordpress.org/trunk@46131


git-svn-id: http://core.svn.wordpress.org/trunk@45943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-15 11:12:55 +00:00
parent 7093392099
commit 30fe3f5d4f
2 changed files with 2 additions and 4 deletions

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

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46130'; $wp_version = '5.3-alpha-46131';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.