From a2bcc36278ea932406a3e0044a6d9f96c8493c10 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 11 Dec 2023 12:11:22 +0000 Subject: [PATCH] Docs: Consistently document the `$body_id` global as a string. Includes declaring the global at the beginning of `wp_iframe()` and `iframe_header()`. Follow-up to [32642], [32643]. Props mukesh27, upadalavipul. Fixes #60032. Built from https://develop.svn.wordpress.org/trunk@57181 git-svn-id: http://core.svn.wordpress.org/trunk@56692 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 8 +++++--- wp-admin/includes/template.php | 10 +++++----- wp-includes/version.php | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e7b4c10369..57df2bcbff 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -527,12 +527,14 @@ function media_handle_sideload( $file_array, $post_id = 0, $desc = null, $post_d * @since 5.3.0 Formalized the existing and already documented `...$args` parameter * by adding it to the function signature. * - * @global int $body_id + * @global string $body_id * * @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, ...$args ) { + global $body_id; + _wp_admin_html_begin(); ?> <?php bloginfo( 'name' ); ?> › <?php _e( 'Uploads' ); ?> — <?php _e( 'WordPress' ); ?> @@ -603,8 +605,8 @@ function wp_iframe( $content_func, ...$args ) { $body_id_attr = ''; - if ( isset( $GLOBALS['body_id'] ) ) { - $body_id_attr = ' id="' . $GLOBALS['body_id'] . '"'; + if ( isset( $body_id ) ) { + $body_id_attr = ' id="' . $body_id . '"'; } ?> diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 6b4a50752e..90b375e882 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -2118,14 +2118,17 @@ function _admin_search_query() { * * @global string $hook_suffix * @global string $admin_body_class + * @global string $body_id * @global WP_Locale $wp_locale WordPress date and time locale object. * * @param string $title Optional. Title of the Iframe page. Default empty. * @param bool $deprecated Not used. */ function iframe_header( $title = '', $deprecated = false ) { + global $hook_suffix, $admin_body_class, $body_id, $wp_locale; + show_admin_bar( false ); - global $hook_suffix, $admin_body_class, $wp_locale; + $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); $current_screen = get_current_screen(); @@ -2179,10 +2182,7 @@ var ajaxurl = '