Make WordPress Core

Changeset 51942 for trunk


Ignore:
Timestamp:
10/27/2021 06:20:58 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Document the usage of some globals in wp-includes/script-loader.php.

Follow-up to [44114], [44262], [49080], [50761], [51471].

See #53399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r51941 r51942  
    4040 * @since 5.0.0
    4141 *
     42 * @global string $tinymce_version
     43 * @global bool   $concatenate_scripts
     44 * @global bool   $compress_scripts
     45 *
    4246 * @param WP_Scripts $scripts            WP_Scripts object.
    4347 * @param bool       $force_uncompressed Whether to forcibly prevent gzip compression. Default false.
     
    4549function wp_register_tinymce_scripts( $scripts, $force_uncompressed = false ) {
    4650    global $tinymce_version, $concatenate_scripts, $compress_scripts;
     51
    4752    $suffix     = wp_scripts_get_suffix();
    4853    $dev_suffix = wp_scripts_get_suffix( 'dev' );
     
    7277 *
    7378 * @since 5.0.0
     79 *
     80 * @global WP_Locale $wp_locale WordPress date and time locale object.
    7481 *
    7582 * @param WP_Scripts $scripts WP_Scripts object.
     
    277284 *
    278285 * @since 5.0.0
     286 *
     287 * @global WP_Locale $wp_locale WordPress date and time locale object.
    279288 *
    280289 * @param WP_Scripts $scripts WP_Scripts object.
     
    13801389 * @since 2.6.0
    13811390 *
     1391 * @global array $editor_styles
     1392 *
    13821393 * @param WP_Styles $styles
    13831394 */
    13841395function wp_default_styles( $styles ) {
     1396    global $editor_styles;
     1397
    13851398    // Include an unmodified $wp_version.
    13861399    require ABSPATH . WPINC . '/version.php';
     
    15351548    }
    15361549
    1537     global $editor_styles;
    15381550    if ( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 ) {
    15391551        // Include opinionated block styles if no $editor_styles are declared, so the editor never appears broken.
     
    20332045 */
    20342046function wp_print_head_scripts() {
     2047    global $wp_scripts;
     2048
    20352049    if ( ! did_action( 'wp_print_scripts' ) ) {
    20362050        /** This action is documented in wp-includes/functions.wp-scripts.php */
     
    20382052    }
    20392053
    2040     global $wp_scripts;
    2041 
    20422054    if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
    20432055        return array(); // No need to run if nothing is queued.
    20442056    }
     2057
    20452058    return print_head_scripts();
    20462059}
     
    22442257 *
    22452258 * @since 5.0.0
    2246  *
    2247  * @global WP_Screen $current_screen WordPress current screen object.
    22482259 */
    22492260function wp_common_block_scripts_and_styles() {
     
    23332344 *
    23342345 * @since 5.6.0
     2346 *
     2347 * @global WP_Screen $current_screen WordPress current screen object.
    23352348 *
    23362349 * @return bool Whether scripts and styles should be enqueued.
     
    24372450 *
    24382451 * @since 5.3.0
     2452 *
     2453 * @global WP_Styles $wp_styles
    24392454 */
    24402455function enqueue_block_styles_assets() {
     2456    global $wp_styles;
     2457
    24412458    $block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered();
    24422459
     
    24662483                if ( wp_should_load_separate_core_block_assets() ) {
    24672484                    $block_stylesheet_handle = generate_block_asset_handle( $block_name, 'style' );
    2468                     global $wp_styles;
     2485
    24692486                    if ( isset( $wp_styles->registered[ $block_stylesheet_handle ] ) ) {
    24702487                        $handle = $block_stylesheet_handle;
Note: See TracChangeset for help on using the changeset viewer.