Changeset 55192 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 02/02/2023 06:50:54 PM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r55176 r55192 426 426 'textTransform' => null, 427 427 ), 428 'css' => null, 428 429 ); 429 430 … … 1001 1002 if ( in_array( 'presets', $types, true ) ) { 1002 1003 $stylesheet .= $this->get_preset_classes( $setting_nodes, $origins ); 1004 } 1005 1006 return $stylesheet; 1007 } 1008 1009 /** 1010 * Returns the global styles custom css. 1011 * 1012 * @since 6.2.0 1013 * 1014 * @return string 1015 */ 1016 public function get_custom_css() { 1017 // Add the global styles root CSS. 1018 $stylesheet = _wp_array_get( $this->theme_json, array( 'styles', 'css' ), '' ); 1019 1020 // Add the global styles block CSS. 1021 if ( isset( $this->theme_json['styles']['blocks'] ) ) { 1022 foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) { 1023 $custom_block_css = _wp_array_get( $this->theme_json, array( 'styles', 'blocks', $name, 'css' ) ); 1024 if ( $custom_block_css ) { 1025 $selector = static::$blocks_metadata[ $name ]['selector']; 1026 $stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector ); 1027 } 1028 } 1003 1029 } 1004 1030 … … 2741 2767 } 2742 2768 2743 $output = static::remove_insecure_styles( $input ); 2769 // The global styles custom CSS is not sanitized, but can only be edited by users with 'edit_css' capability. 2770 if ( isset( $input['css'] ) && current_user_can( 'edit_css' ) ) { 2771 $output = $input; 2772 } else { 2773 $output = static::remove_insecure_styles( $input ); 2774 } 2744 2775 2745 2776 /*
Note: See TracChangeset
for help on using the changeset viewer.