Skip to content

Commit

Permalink
Coding Standards: Use strict type check for in_array() in `wp_get_g…
Browse files Browse the repository at this point in the history
…lobal_stylesheet()`.

Use multi-line comment syntax for some comments, per the documentation standards.

Follow-up to [52675].

See #54782.

git-svn-id: https://develop.svn.wordpress.org/trunk@52676 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Feb 4, 2022
1 parent b7aa3a0 commit c6c3d9b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/wp-includes/global-styles-and-settings.php
Expand Up @@ -112,21 +112,25 @@ function wp_get_global_stylesheet( $types = array() ) {
$types = array( 'variables', 'styles', 'presets' );
}

// If variables are part of the stylesheet,
// we add them for all origins (default, theme, user).
// This is so themes without a theme.json still work as before 5.9:
// they can override the default presets.
// See https://core.trac.wordpress.org/ticket/54782
/*
* If variables are part of the stylesheet,
* we add them for all origins (default, theme, user).
* This is so themes without a theme.json still work as before 5.9:
* they can override the default presets.
* See https://core.trac.wordpress.org/ticket/54782
*/
$styles_variables = '';
if ( in_array( 'variables', $types ) ) {
if ( in_array( 'variables', $types, true ) ) {
$styles_variables = $tree->get_stylesheet( array( 'variables' ) );
$types = array_diff( $types, array( 'variables' ) );
}

// For the remaining types (presets, styles), we do consider origins:
//
// - themes without theme.json: only the classes for the presets defined by core
// - themes with theme.json: the presets and styles classes, both from core and the theme
/*
* For the remaining types (presets, styles), we do consider origins:
*
* - themes without theme.json: only the classes for the presets defined by core
* - themes with theme.json: the presets and styles classes, both from core and the theme
*/
$styles_rest = '';
if ( ! empty( $types ) ) {
$origins = array( 'default', 'theme', 'custom' );
Expand Down

0 comments on commit c6c3d9b

Please sign in to comment.