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


git-svn-id: http://core.svn.wordpress.org/trunk@54383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-11-13 13:51:20 +00:00
parent 243fdb8da2
commit 7836738bd9
4 changed files with 12 additions and 5 deletions

View File

@ -2210,6 +2210,10 @@ function get_block_editor_server_block_settings() {
* Renders the meta boxes forms.
*
* @since 5.0.0
*
* @global WP_Post $post Global post object.
* @global WP_Screen $current_screen WordPress current screen object.
* @global array $wp_meta_boxes
*/
function the_block_editor_meta_boxes() {
global $post, $current_screen, $wp_meta_boxes;

View File

@ -1200,9 +1200,13 @@ function wp_is_theme_directory_ignored( $path ) {
* @since 5.9.0
* @since 6.0.0 Adds the whole theme to the export archive.
*
* @global string $wp_version The WordPress version string.
*
* @return WP_Error|string Path of the ZIP file or error on failure.
*/
function wp_generate_block_templates_export_file() {
global $wp_version;
if ( ! class_exists( 'ZipArchive' ) ) {
return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) );
}
@ -1270,7 +1274,6 @@ function wp_generate_block_templates_export_file() {
$theme_json_raw = $tree->get_data();
// If a version is defined, add a schema.
if ( $theme_json_raw['version'] ) {
global $wp_version;
$theme_json_version = 'wp/' . substr( $wp_version, 0, 3 );
$schema = array( '$schema' => 'https://schemas.wp.org/' . $theme_json_version . '/theme.json' );
$theme_json_raw = array_merge( $schema, $theme_json_raw );

View File

@ -160,13 +160,14 @@ final class WP_oEmbed_Controller {
* @since 4.8.0
*
* @see WP_oEmbed::get_html()
* @global WP_Embed $wp_embed
* @global WP_Embed $wp_embed
* @global WP_Scripts $wp_scripts
*
* @param WP_REST_Request $request Full data about the request.
* @return object|WP_Error oEmbed response data or WP_Error on failure.
*/
public function get_proxy_item( $request ) {
global $wp_embed;
global $wp_embed, $wp_scripts;
$args = $request->get_params();
@ -204,7 +205,6 @@ final class WP_oEmbed_Controller {
$html = $wp_embed->get_embed_handler_html( $args, $url );
if ( $html ) {
global $wp_scripts;
// Check if any scripts were enqueued by the shortcode, and include them in the response.
$enqueued_scripts = array();

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-54829';
$wp_version = '6.2-alpha-54831';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.