Changeset 58354 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 06/06/2024 08:00:08 AM (21 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-theme-json.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r58339 r58354 748 748 * @param array $theme_json A structure that follows the theme.json schema. 749 749 * @param string $origin Optional. What source of data this object represents. 750 * One of ' default', 'theme', or 'custom'. Default 'theme'.750 * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. 751 751 */ 752 752 public function __construct( $theme_json = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA ), $origin = 'theme' ) { … … 755 755 } 756 756 757 $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json );757 $this->theme_json = WP_Theme_JSON_Schema::migrate( $theme_json, $origin ); 758 758 $valid_block_names = array_keys( static::get_blocks_metadata() ); 759 759 $valid_element_names = array_keys( static::ELEMENTS ); … … 3243 3243 * @since 5.9.0 3244 3244 * @since 6.3.2 Preserves global styles block variations when securing styles. 3245 * @since 6.6.0 Updated to allow variation element styles .3245 * @since 6.6.0 Updated to allow variation element styles and $origin parameter. 3246 3246 * 3247 3247 * @param array $theme_json Structure to sanitize. 3248 * @param string $origin Optional. What source of data this object represents. 3249 * One of 'blocks', 'default', 'theme', or 'custom'. Default 'theme'. 3248 3250 * @return array Sanitized structure. 3249 3251 */ 3250 public static function remove_insecure_properties( $theme_json ) { 3252 public static function remove_insecure_properties( $theme_json, $origin = 'theme' ) { 3253 if ( ! in_array( $origin, static::VALID_ORIGINS, true ) ) { 3254 $origin = 'theme'; 3255 } 3256 3251 3257 $sanitized = array(); 3252 3258 3253 $theme_json = WP_Theme_JSON_Schema::migrate( $theme_json );3259 $theme_json = WP_Theme_JSON_Schema::migrate( $theme_json, $origin ); 3254 3260 3255 3261 $valid_block_names = array_keys( static::get_blocks_metadata() );
Note: See TracChangeset
for help on using the changeset viewer.