Make WordPress Core

Changeset 57181


Ignore:
Timestamp:
12/11/2023 12:09:42 PM (8 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r56549 r57181  
    528528 *              by adding it to the function signature.
    529529 *
    530  * @global int $body_id
     530 * @global string $body_id
    531531 *
    532532 * @param callable $content_func Function that outputs the content.
     
    534534 */
    535535function wp_iframe( $content_func, ...$args ) {
     536    global $body_id;
     537
    536538    _wp_admin_html_begin();
    537539    ?>
     
    604606    $body_id_attr = '';
    605607
    606     if ( isset( $GLOBALS['body_id'] ) ) {
    607         $body_id_attr = ' id="' . $GLOBALS['body_id'] . '"';
     608    if ( isset( $body_id ) ) {
     609        $body_id_attr = ' id="' . $body_id . '"';
    608610    }
    609611
  • trunk/src/wp-admin/includes/template.php

    r57128 r57181  
    21192119 * @global string    $hook_suffix
    21202120 * @global string    $admin_body_class
     2121 * @global string    $body_id
    21212122 * @global WP_Locale $wp_locale        WordPress date and time locale object.
    21222123 *
     
    21252126 */
    21262127function iframe_header( $title = '', $deprecated = false ) {
     2128    global $hook_suffix, $admin_body_class, $body_id, $wp_locale;
     2129
    21272130    show_admin_bar( false );
    2128     global $hook_suffix, $admin_body_class, $wp_locale;
     2131
    21292132    $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
    21302133
     
    21802183</head>
    21812184    <?php
    2182     /**
    2183      * @global string $body_id
    2184      */
    2185     $admin_body_id = isset( $GLOBALS['body_id'] ) ? 'id="' . $GLOBALS['body_id'] . '" ' : '';
     2185    $admin_body_id = isset( $body_id ) ? 'id="' . $body_id . '" ' : '';
    21862186
    21872187    /** This filter is documented in wp-admin/admin-header.php */
Note: See TracChangeset for help on using the changeset viewer.