Skip to content
Permalink
Browse files

Code Modernisation: Introduce the spread operator in `wp-admin/includ…

…es/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
  • Loading branch information
SergeyBiryukov committed Sep 15, 2019
1 parent 752c36b commit 49de2b73125b5eea6b24804ff9bef7063871568d
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/wp-admin/includes/media.php
@@ -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 */

0 comments on commit 49de2b7

Please sign in to comment.
You can’t perform that action at this time.