Editor: Remove additional calls to `WP_Theme_JSON::_construct`.
This improves performance of the `WP_Theme_JSON_Resolver` class by avoiding redundant construction of `WP_Theme_JSON` objects for each origin. Props thekt12, joemcgill, swissspidy, audrasjb, oandregal. Fixes #61112. Built from https://develop.svn.wordpress.org/trunk@58185 git-svn-id: http://core.svn.wordpress.org/trunk@57648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d6e7f33c4
commit
bdebc89143
|
@ -69,4 +69,15 @@ class WP_Theme_JSON_Data {
|
|||
public function get_data() {
|
||||
return $this->theme_json->get_raw_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns theme JSON object.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @return WP_Theme_JSON The theme JSON structure stored in this data object.
|
||||
*/
|
||||
public function get_theme_json() {
|
||||
return $this->theme_json;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,8 +173,7 @@ class WP_Theme_JSON_Resolver {
|
|||
* @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
|
||||
*/
|
||||
$theme_json = apply_filters( 'wp_theme_json_data_default', new WP_Theme_JSON_Data( $config, 'default' ) );
|
||||
$config = $theme_json->get_data();
|
||||
static::$core = new WP_Theme_JSON( $config, 'default' );
|
||||
static::$core = $theme_json->get_theme_json();
|
||||
|
||||
return static::$core;
|
||||
}
|
||||
|
@ -255,8 +254,7 @@ class WP_Theme_JSON_Resolver {
|
|||
* @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
|
||||
*/
|
||||
$theme_json = apply_filters( 'wp_theme_json_data_theme', new WP_Theme_JSON_Data( $theme_json_data, 'theme' ) );
|
||||
$theme_json_data = $theme_json->get_data();
|
||||
static::$theme = new WP_Theme_JSON( $theme_json_data );
|
||||
static::$theme = $theme_json->get_theme_json();
|
||||
|
||||
if ( $wp_theme->parent() ) {
|
||||
// Get parent theme.json.
|
||||
|
@ -387,9 +385,7 @@ class WP_Theme_JSON_Resolver {
|
|||
* @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
|
||||
*/
|
||||
$theme_json = apply_filters( 'wp_theme_json_data_blocks', new WP_Theme_JSON_Data( $config, 'blocks' ) );
|
||||
$config = $theme_json->get_data();
|
||||
|
||||
static::$blocks = new WP_Theme_JSON( $config, 'blocks' );
|
||||
static::$blocks = $theme_json->get_theme_json();
|
||||
return static::$blocks;
|
||||
}
|
||||
|
||||
|
@ -523,8 +519,7 @@ class WP_Theme_JSON_Resolver {
|
|||
* @param WP_Theme_JSON_Data $theme_json Class to access and update the underlying data.
|
||||
*/
|
||||
$theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
|
||||
$config = $theme_json->get_data();
|
||||
return new WP_Theme_JSON( $config, 'custom' );
|
||||
return $theme_json->get_theme_json();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -543,8 +538,7 @@ class WP_Theme_JSON_Resolver {
|
|||
|
||||
/** This filter is documented in wp-includes/class-wp-theme-json-resolver.php */
|
||||
$theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
|
||||
$config = $theme_json->get_data();
|
||||
static::$user = new WP_Theme_JSON( $config, 'custom' );
|
||||
static::$user = $theme_json->get_theme_json();
|
||||
|
||||
return static::$user;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-alpha-58184';
|
||||
$wp_version = '6.6-alpha-58185';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue