Make WordPress Core

Changeset 54831


Ignore:
Timestamp:
11/13/2022 01:49:16 PM (17 months ago)
Author:
SergeyBiryukov
Message:

Docs: Document the usage of globals in some functions.

This affects:

  • the_block_editor_meta_boxes()
  • wp_generate_block_templates_export_file()
  • WP_oEmbed_Controller::get_proxy_item()

Follow-up to [44131], [48135], [51151], [53129].

Props krunal265.
Fixes #57082.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r54524 r54831  
    22112211 *
    22122212 * @since 5.0.0
     2213 *
     2214 * @global WP_Post   $post           Global post object.
     2215 * @global WP_Screen $current_screen WordPress current screen object.
     2216 * @global array     $wp_meta_boxes
    22132217 */
    22142218function the_block_editor_meta_boxes() {
  • trunk/src/wp-includes/block-template-utils.php

    r54817 r54831  
    12011201 * @since 6.0.0 Adds the whole theme to the export archive.
    12021202 *
     1203 * @global string $wp_version The WordPress version string.
     1204 *
    12031205 * @return WP_Error|string Path of the ZIP file or error on failure.
    12041206 */
    12051207function wp_generate_block_templates_export_file() {
     1208    global $wp_version;
     1209
    12061210    if ( ! class_exists( 'ZipArchive' ) ) {
    12071211        return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) );
     
    12711275    // If a version is defined, add a schema.
    12721276    if ( $theme_json_raw['version'] ) {
    1273         global $wp_version;
    12741277        $theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
    12751278        $schema             = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' );
  • trunk/src/wp-includes/class-wp-oembed-controller.php

    r54133 r54831  
    161161     *
    162162     * @see WP_oEmbed::get_html()
    163      * @global WP_Embed $wp_embed
     163     * @global WP_Embed   $wp_embed
     164     * @global WP_Scripts $wp_scripts
    164165     *
    165166     * @param WP_REST_Request $request Full data about the request.
     
    167168     */
    168169    public function get_proxy_item( $request ) {
    169         global $wp_embed;
     170        global $wp_embed, $wp_scripts;
    170171
    171172        $args = $request->get_params();
     
    205206
    206207            if ( $html ) {
    207                 global $wp_scripts;
    208208                // Check if any scripts were enqueued by the shortcode, and include them in the response.
    209209                $enqueued_scripts = array();
Note: See TracChangeset for help on using the changeset viewer.