Changeset 56709
- Timestamp:
- 09/26/2023 01:45:23 PM (18 months ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/background.php
r56614 r56709 59 59 } 60 60 61 $background_image_source = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundImage', 'source' ), null ); 62 $background_image_url = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundImage', 'url' ), null ); 63 $background_size = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundSize' ), 'cover' ); 61 $background_image_source = isset( $block_attributes['style']['background']['backgroundImage']['source'] ) 62 ? $block_attributes['style']['background']['backgroundImage']['source'] 63 : null; 64 $background_image_url = isset( $block_attributes['style']['background']['backgroundImage']['url'] ) 65 ? $block_attributes['style']['background']['backgroundImage']['url'] 66 : null; 67 $background_size = isset( $block_attributes['style']['background']['backgroundSize'] ) 68 ? $block_attributes['style']['background']['backgroundSize'] 69 : 'cover'; 64 70 65 71 $background_block_styles = array(); -
trunk/src/wp-includes/block-supports/border.php
r56382 r56709 103 103 ) { 104 104 $preset_border_color = array_key_exists( 'borderColor', $block_attributes ) ? "var:preset|color|{$block_attributes['borderColor']}" : null; 105 $custom_border_color = _wp_array_get( $block_attributes, array( 'style', 'border', 'color' ), null );105 $custom_border_color = isset( $block_attributes['style']['border']['color'] ) ? $block_attributes['style']['border']['color'] : null; 106 106 $border_block_styles['color'] = $preset_border_color ? $preset_border_color : $custom_border_color; 107 107 } … … 110 110 if ( $has_border_color_support || $has_border_width_support ) { 111 111 foreach ( array( 'top', 'right', 'bottom', 'left' ) as $side ) { 112 $border = _wp_array_get( $block_attributes, array( 'style', 'border', $side ), null );112 $border = isset( $block_attributes['style']['border'][ $side ] ) ? $block_attributes['style']['border'][ $side ] : null; 113 113 $border_side_values = array( 114 114 'width' => isset( $border['width'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'width' ) ? $border['width'] : null, … … 153 153 function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) { 154 154 // Check if all border support features have been opted into via `"__experimentalBorder": true`. 155 if ( 156 property_exists( $block_type, 'supports' ) && 157 ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default_value ) ) 158 ) { 159 return true; 155 if ( property_exists( $block_type, 'supports' ) ) { 156 $block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] ) 157 ? $block_type->supports['__experimentalBorder'] 158 : $default_value; 159 if ( true === $block_type_supports_border ) { 160 return true; 161 } 160 162 } 161 163 -
trunk/src/wp-includes/block-supports/colors.php
r56604 r56709 17 17 */ 18 18 function wp_register_colors_support( $block_type ) { 19 $color_support = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( 'color' ), false ) : false; 20 $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) ); 21 $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) ); 22 $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false ); 23 $has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false ); 24 $has_button_colors_support = _wp_array_get( $color_support, array( 'button' ), false ); 25 $has_heading_colors_support = _wp_array_get( $color_support, array( 'heading' ), false ); 19 $color_support = false; 20 if ( property_exists( $block_type, 'supports' ) ) { 21 $color_support = isset( $block_type->supports['color'] ) ? $block_type->supports['color'] : false; 22 } 23 $has_text_colors_support = true === $color_support || 24 ( isset( $color_support['text'] ) && $color_support['text'] ) || 25 ( is_array( $color_support ) && ! isset( $color_support['text'] ) ); 26 $has_background_colors_support = true === $color_support || 27 ( isset( $color_support['background'] ) && $color_support['background'] ) || 28 ( is_array( $color_support ) && ! isset( $color_support['background'] ) ); 29 $has_gradients_support = isset( $color_support['gradients'] ) ? $color_support['gradients'] : false; 30 $has_link_colors_support = isset( $color_support['link'] ) ? $color_support['link'] : false; 31 $has_button_colors_support = isset( $color_support['button'] ) ? $color_support['button'] : false; 32 $has_heading_colors_support = isset( $color_support['heading'] ) ? $color_support['heading'] : false; 26 33 $has_color_support = $has_text_colors_support || 27 34 $has_background_colors_support || … … 75 82 */ 76 83 function wp_apply_colors_support( $block_type, $block_attributes ) { 77 $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );84 $color_support = isset( $block_type->supports['color'] ) ? $block_type->supports['color'] : false; 78 85 79 86 if ( … … 84 91 } 85 92 86 $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) ); 87 $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) ); 88 $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false ); 93 $has_text_colors_support = true === $color_support || 94 ( isset( $color_support['text'] ) && $color_support['text'] ) || 95 ( is_array( $color_support ) && ! isset( $color_support['text'] ) ); 96 $has_background_colors_support = true === $color_support || 97 ( isset( $color_support['background'] ) && $color_support['background'] ) || 98 ( is_array( $color_support ) && ! isset( $color_support['background'] ) ); 99 $has_gradients_support = isset( $color_support['gradients'] ) ? $color_support['gradients'] : false; 89 100 $color_block_styles = array(); 90 101 … … 92 103 if ( $has_text_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'text' ) ) { 93 104 $preset_text_color = array_key_exists( 'textColor', $block_attributes ) ? "var:preset|color|{$block_attributes['textColor']}" : null; 94 $custom_text_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'text' ), null );105 $custom_text_color = isset( $block_attributes['style']['color']['text'] ) ? $block_attributes['style']['color']['text'] : null; 95 106 $color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color; 96 107 } … … 99 110 if ( $has_background_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'background' ) ) { 100 111 $preset_background_color = array_key_exists( 'backgroundColor', $block_attributes ) ? "var:preset|color|{$block_attributes['backgroundColor']}" : null; 101 $custom_background_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'background' ), null );112 $custom_background_color = isset( $block_attributes['style']['color']['background'] ) ? $block_attributes['style']['color']['background'] : null; 102 113 $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color; 103 114 } … … 106 117 if ( $has_gradients_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'gradients' ) ) { 107 118 $preset_gradient_color = array_key_exists( 'gradient', $block_attributes ) ? "var:preset|gradient|{$block_attributes['gradient']}" : null; 108 $custom_gradient_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'gradient' ), null );119 $custom_gradient_color = isset( $block_attributes['style']['color']['gradient'] ) ? $block_attributes['style']['color']['gradient'] : null; 109 120 $color_block_styles['gradient'] = $preset_gradient_color ? $preset_gradient_color : $custom_gradient_color; 110 121 } -
trunk/src/wp-includes/block-supports/dimensions.php
r56382 r56709 69 69 $skip_min_height = wp_should_skip_block_supports_serialization( $block_type, 'dimensions', 'minHeight' ); 70 70 $dimensions_block_styles = array(); 71 $dimensions_block_styles['minHeight'] = $has_min_height_support && ! $skip_min_height ? _wp_array_get( $block_styles, array( 'dimensions', 'minHeight' ), null ) : null; 72 $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) ); 71 $dimensions_block_styles['minHeight'] = null; 72 if ( $has_min_height_support && ! $skip_min_height ) { 73 $dimensions_block_styles['minHeight'] = isset( $block_styles['dimensions']['minHeight'] ) 74 ? $block_styles['dimensions']['minHeight'] 75 : null; 76 } 77 $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) ); 73 78 74 79 if ( ! empty( $styles['css'] ) ) { -
trunk/src/wp-includes/block-supports/elements.php
r56680 r56709 176 176 } 177 177 178 $element_style_object = _wp_array_get( $element_block_styles, array( $element_type ), null );178 $element_style_object = isset( $element_block_styles[ $element_type ] ) ? $element_block_styles[ $element_type ] : null; 179 179 180 180 // Process primary element type styles. … … 202 202 if ( isset( $element_config['elements'] ) ) { 203 203 foreach ( $element_config['elements'] as $element ) { 204 $element_style_object = _wp_array_get( $element_block_styles, array( $element ), null ); 204 $element_style_object = isset( $element_block_styles[ $element ] ) 205 ? $element_block_styles[ $element ] 206 : null; 205 207 206 208 if ( $element_style_object ) { -
trunk/src/wp-includes/block-supports/layout.php
r56700 r56709 415 415 416 416 foreach ( $gap_sides as $gap_side ) { 417 $process_value = is_string( $gap_value ) ? $gap_value : _wp_array_get( $gap_value, array( $gap_side ), $fallback_gap_value ); 417 $process_value = $gap_value; 418 if ( is_array( $gap_value ) ) { 419 $process_value = isset( $gap_value[ $gap_side ] ) ? $gap_value[ $gap_side ] : $fallback_gap_value; 420 } 418 421 // Get spacing CSS variable from preset value if provided. 419 422 if ( is_string( $process_value ) && str_contains( $process_value, 'var:preset|spacing|' ) ) { … … 496 499 497 500 foreach ( $gap_sides as $gap_side ) { 498 $process_value = is_string( $gap_value ) ? $gap_value : _wp_array_get( $gap_value, array( $gap_side ), $fallback_gap_value ); 501 $process_value = $gap_value; 502 if ( is_array( $gap_value ) ) { 503 $process_value = isset( $gap_value[ $gap_side ] ) ? $gap_value[ $gap_side ] : $fallback_gap_value; 504 } 499 505 // Get spacing CSS variable from preset value if provided. 500 506 if ( is_string( $process_value ) && str_contains( $process_value, 'var:preset|spacing|' ) ) { … … 613 619 614 620 $global_settings = wp_get_global_settings(); 615 $fallback_layout = ! empty( _wp_array_get( $block_type->supports, array( 'layout', 'default' ), array() ) ) ? _wp_array_get( $block_type->supports, array( 'layout', 'default' ), array() ) : _wp_array_get( $block_type->supports, array( '__experimentalLayout', 'default' ), array() ); 616 $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $fallback_layout; 621 $fallback_layout = isset( $block_type->supports['layout']['default'] ) 622 ? $block_type->supports['layout']['default'] 623 : array(); 624 if ( empty( $fallback_layout ) ) { 625 $fallback_layout = isset( $block_type->supports['__experimentalLayout']['default'] ) 626 ? $block_type->supports['__experimentalLayout']['default'] 627 : array(); 628 } 629 $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $fallback_layout; 617 630 618 631 $class_names = array(); … … 625 638 } 626 639 627 $root_padding_aware_alignments = _wp_array_get( $global_settings, array( 'useRootPaddingAwareAlignments' ), false ); 640 $root_padding_aware_alignments = isset( $global_settings['useRootPaddingAwareAlignments'] ) 641 ? $global_settings['useRootPaddingAwareAlignments'] 642 : false; 628 643 629 644 if ( … … 655 670 // Get classname for layout type. 656 671 if ( isset( $used_layout['type'] ) ) { 657 $layout_classname = _wp_array_get( $layout_definitions, array( $used_layout['type'], 'className' ), '' ); 672 $layout_classname = isset( $layout_definitions[ $used_layout['type'] ]['className'] ) 673 ? $layout_definitions[ $used_layout['type'] ]['className'] 674 : ''; 658 675 } else { 659 $layout_classname = _wp_array_get( $layout_definitions, array( 'default', 'className' ), '' ); 676 $layout_classname = isset( $layout_definitions['default']['className'] ) 677 ? $layout_definitions['default']['className'] 678 : ''; 660 679 } 661 680 … … 670 689 if ( ! current_theme_supports( 'disable-layout-styles' ) ) { 671 690 672 $gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) ); 691 $gap_value = isset( $block['attrs']['style']['spacing']['blockGap'] ) 692 ? $block['attrs']['style']['spacing']['blockGap'] 693 : null; 673 694 /* 674 695 * Skip if gap value contains unsupported characters. … … 684 705 } 685 706 686 $fallback_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), '0.5em' ); 687 $block_spacing = _wp_array_get( $block, array( 'attrs', 'style', 'spacing' ), null ); 707 $fallback_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) 708 ? $block_type->supports['spacing']['blockGap']['__experimentalDefault'] 709 : '0.5em'; 710 $block_spacing = isset( $block['attrs']['style']['spacing'] ) 711 ? $block['attrs']['style']['spacing'] 712 : null; 688 713 689 714 /* … … 693 718 $should_skip_gap_serialization = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'blockGap' ); 694 719 695 $block_gap = _wp_array_get( $global_settings, array( 'spacing', 'blockGap' ), null ); 720 $block_gap = isset( $global_settings['spacing']['blockGap'] ) 721 ? $global_settings['spacing']['blockGap'] 722 : null; 696 723 $has_block_gap_support = isset( $block_gap ); 697 724 -
trunk/src/wp-includes/block-supports/position.php
r56382 r56709 52 52 53 53 $global_settings = wp_get_global_settings(); 54 $theme_has_sticky_support = _wp_array_get( $global_settings, array( 'position', 'sticky' ), false );55 $theme_has_fixed_support = _wp_array_get( $global_settings, array( 'position', 'fixed' ), false );54 $theme_has_sticky_support = isset( $global_settings['position']['sticky'] ) ? $global_settings['position']['sticky'] : false; 55 $theme_has_fixed_support = isset( $global_settings['position']['fixed'] ) ? $global_settings['position']['fixed'] : false; 56 56 57 57 // Only allow output for position types that the theme supports. … … 64 64 } 65 65 66 $style_attribute = _wp_array_get( $block, array( 'attrs', 'style' ), null );66 $style_attribute = isset( $block['attrs']['style'] ) ? $block['attrs']['style'] : null; 67 67 $class_name = wp_unique_id( 'wp-container-' ); 68 68 $selector = ".$class_name"; 69 69 $position_styles = array(); 70 $position_type = _wp_array_get( $style_attribute, array( 'position', 'type' ), '' );70 $position_type = isset( $style_attribute['position']['type'] ) ? $style_attribute['position']['type'] : ''; 71 71 $wrapper_classes = array(); 72 72 … … 79 79 80 80 foreach ( $sides as $side ) { 81 $side_value = _wp_array_get( $style_attribute, array( 'position', $side ) );81 $side_value = isset( $style_attribute['position'][ $side ] ) ? $style_attribute['position'][ $side ] : null; 82 82 if ( null !== $side_value ) { 83 83 /* -
trunk/src/wp-includes/block-supports/settings.php
r56382 r56709 46 46 47 47 // return early if no settings are found on the block attributes. 48 $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );48 $block_settings = isset( $block['attrs']['settings'] ) ? $block['attrs']['settings'] : null; 49 49 if ( empty( $block_settings ) ) { 50 50 return $block_content; … … 83 83 84 84 // return early if no settings are found on the block attributes. 85 $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );85 $block_settings = isset( $block['attrs']['settings'] ) ? $block['attrs']['settings'] : null; 86 86 if ( empty( $block_settings ) ) { 87 87 return null; -
trunk/src/wp-includes/block-supports/spacing.php
r56382 r56709 59 59 } 60 60 61 $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' ); 62 $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' ); 63 $spacing_block_styles = array(); 64 $spacing_block_styles['padding'] = $has_padding_support && ! $skip_padding ? _wp_array_get( $block_styles, array( 'spacing', 'padding' ), null ) : null; 65 $spacing_block_styles['margin'] = $has_margin_support && ! $skip_margin ? _wp_array_get( $block_styles, array( 'spacing', 'margin' ), null ) : null; 66 $styles = wp_style_engine_get_styles( array( 'spacing' => $spacing_block_styles ) ); 61 $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' ); 62 $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' ); 63 $spacing_block_styles = array( 64 'padding' => null, 65 'margin' => null, 66 ); 67 if ( $has_padding_support && ! $skip_padding ) { 68 $spacing_block_styles['padding'] = isset( $block_styles['spacing']['padding'] ) ? $block_styles['spacing']['padding'] : null; 69 } 70 if ( $has_margin_support && ! $skip_margin ) { 71 $spacing_block_styles['margin'] = isset( $block_styles['spacing']['margin'] ) ? $block_styles['spacing']['margin'] : null; 72 } 73 $styles = wp_style_engine_get_styles( array( 'spacing' => $spacing_block_styles ) ); 67 74 68 75 if ( ! empty( $styles['css'] ) ) { -
trunk/src/wp-includes/block-supports/typography.php
r56605 r56709 21 21 } 22 22 23 $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false );23 $typography_supports = isset( $block_type->supports['typography'] ) ? $block_type->supports['typography'] : false; 24 24 if ( ! $typography_supports ) { 25 25 return; 26 26 } 27 27 28 $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );29 $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false );30 $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );31 $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false );32 $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );33 $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );34 $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );35 $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );36 $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );37 $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );28 $has_font_family_support = isset( $typography_supports['__experimentalFontFamily'] ) ? $typography_supports['__experimentalFontFamily'] : false; 29 $has_font_size_support = isset( $typography_supports['fontSize'] ) ? $typography_supports['fontSize'] : false; 30 $has_font_style_support = isset( $typography_supports['__experimentalFontStyle'] ) ? $typography_supports['__experimentalFontStyle'] : false; 31 $has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false; 32 $has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false; 33 $has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false; 34 $has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false; 35 $has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false; 36 $has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false; 37 $has_writing_mode_support = isset( $typography_supports['__experimentalWritingMode'] ) ? $typography_supports['__experimentalWritingMode'] : false; 38 38 39 39 $has_typography_support = $has_font_family_support … … 90 90 } 91 91 92 $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false ); 92 $typography_supports = isset( $block_type->supports['typography'] ) 93 ? $block_type->supports['typography'] 94 : false; 93 95 if ( ! $typography_supports ) { 94 96 return array(); … … 99 101 } 100 102 101 $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );102 $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false );103 $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );104 $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false );105 $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );106 $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );107 $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );108 $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );109 $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );110 $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );103 $has_font_family_support = isset( $typography_supports['__experimentalFontFamily'] ) ? $typography_supports['__experimentalFontFamily'] : false; 104 $has_font_size_support = isset( $typography_supports['fontSize'] ) ? $typography_supports['fontSize'] : false; 105 $has_font_style_support = isset( $typography_supports['__experimentalFontStyle'] ) ? $typography_supports['__experimentalFontStyle'] : false; 106 $has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false; 107 $has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false; 108 $has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false; 109 $has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false; 110 $has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false; 111 $has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false; 112 $has_writing_mode_support = isset( $typography_supports['__experimentalWritingMode'] ) ? $typography_supports['__experimentalWritingMode'] : false; 111 113 112 114 // Whether to skip individual block support features. … … 170 172 171 173 if ( $has_line_height_support && ! $should_skip_line_height ) { 172 $typography_block_styles['lineHeight'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'lineHeight' ) ); 174 $typography_block_styles['lineHeight'] = isset( $block_attributes['style']['typography']['lineHeight'] ) 175 ? $block_attributes['style']['typography']['lineHeight'] 176 : null; 173 177 } 174 178 175 179 if ( $has_text_columns_support && ! $should_skip_text_columns && isset( $block_attributes['style']['typography']['textColumns'] ) ) { 176 $typography_block_styles['textColumns'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'textColumns' ), null ); 180 $typography_block_styles['textColumns'] = isset( $block_attributes['style']['typography']['textColumns'] ) 181 ? $block_attributes['style']['typography']['textColumns'] 182 : null; 177 183 } 178 184 … … 214 220 isset( $block_attributes['style']['typography']['writingMode'] ) 215 221 ) { 216 $typography_block_styles['writingMode'] = _wp_array_get( 217 $block_attributes, 218 array( 'style', 'typography', 'writingMode' ), 219 null 220 ); 222 $typography_block_styles['writingMode'] = isset( $block_attributes['style']['typography']['writingMode'] ) 223 ? $block_attributes['style']['typography']['writingMode'] 224 : null; 221 225 } 222 226 -
trunk/src/wp-includes/blocks.php
r56704 r56709 1637 1637 1638 1638 foreach ( $typography_keys as $typography_key ) { 1639 $support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null );1639 $support_for_key = isset( $metadata['supports'][ $typography_key ] ) ? $metadata['supports'][ $typography_key ] : null; 1640 1640 1641 1641 if ( null !== $support_for_key ) { -
trunk/src/wp-includes/class-wp-duotone.php
r56226 r56709 972 972 * treated as a selector and requires scoping. 973 973 */ 974 $experimental_duotone = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), false ); 974 $experimental_duotone = isset( $block_type->supports['color']['__experimentalDuotone'] ) 975 ? $block_type->supports['color']['__experimentalDuotone'] 976 : false; 975 977 if ( $experimental_duotone ) { 976 978 $root_selector = wp_get_block_css_selector( $block_type ); … … 1001 1003 // Get the per block settings from the theme.json. 1002 1004 $tree = wp_get_global_settings(); 1003 $presets_by_origin = _wp_array_get( $tree, array( 'color', 'duotone' ), array());1005 $presets_by_origin = isset( $tree['color']['duotone'] ) ? $tree['color']['duotone'] : array(); 1004 1006 1005 1007 self::$global_styles_presets = array(); … … 1263 1265 */ 1264 1266 public static function migrate_experimental_duotone_support_flag( $settings, $metadata ) { 1265 $duotone_support = _wp_array_get( $metadata, array( 'supports', 'color', '__experimentalDuotone' ), null ); 1267 $duotone_support = isset( $metadata['supports']['color']['__experimentalDuotone'] ) 1268 ? $metadata['supports']['color']['__experimentalDuotone'] 1269 : null; 1266 1270 1267 1271 if ( ! isset( $settings['supports']['filter']['duotone'] ) && null !== $duotone_support ) { -
trunk/src/wp-includes/class-wp-theme-json-resolver.php
r56179 r56709 357 357 if ( 358 358 isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) && 359 null === _wp_array_get( $config, array( 'styles', 'blocks', $block_name, 'spacing', 'blockGap' ), null)359 ! isset( $config['styles']['blocks'][ $block_name ]['spacing']['blockGap'] ) 360 360 ) { 361 361 /* -
trunk/src/wp-includes/class-wp-theme-json.php
r56643 r56709 924 924 // Keep backwards compatibility for support.color.__experimentalDuotone. 925 925 if ( null === $duotone_selector ) { 926 $duotone_support = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), null ); 926 $duotone_support = isset( $block_type->supports['color']['__experimentalDuotone'] ) 927 ? $block_type->supports['color']['__experimentalDuotone'] 928 : null; 927 929 928 930 if ( $duotone_support ) { … … 1161 1163 public function get_custom_css() { 1162 1164 // Add the global styles root CSS. 1163 $stylesheet = _wp_array_get( $this->theme_json, array( 'styles', 'css' ), '' );1165 $stylesheet = isset( $this->theme_json['styles']['css'] ) ? $this->theme_json['styles']['css'] : ''; 1164 1166 1165 1167 // Add the global styles block CSS. 1166 1168 if ( isset( $this->theme_json['styles']['blocks'] ) ) { 1167 1169 foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) { 1168 $custom_block_css = _wp_array_get( $this->theme_json, array( 'styles', 'blocks', $name, 'css' ) ); 1170 $custom_block_css = isset( $this->theme_json['styles']['blocks'][ $name ]['css'] ) 1171 ? $this->theme_json['styles']['blocks'][ $name ]['css'] 1172 : null; 1169 1173 if ( $custom_block_css ) { 1170 1174 $selector = static::$blocks_metadata[ $name ]['selector']; … … 1285 1289 1286 1290 $selector = isset( $block_metadata['selector'] ) ? $block_metadata['selector'] : ''; 1287 $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;1291 $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] ); 1288 1292 $has_fallback_gap_support = ! $has_block_gap_support; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support. 1289 1293 $node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() ); … … 1301 1305 $block_gap_value = static::ROOT_BLOCK_SELECTOR === $selector ? '0.5em' : null; 1302 1306 if ( ! empty( $block_type ) ) { 1303 $block_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), null ); 1307 $block_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) 1308 ? $block_type->supports['spacing']['blockGap']['__experimentalDefault'] 1309 : null; 1304 1310 } 1305 1311 } else { … … 1327 1333 } 1328 1334 1329 $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );1330 $spacing_rules = _wp_array_get( $layout_definition, array( 'spacingStyles' ), array());1335 $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false; 1336 $spacing_rules = isset( $layout_definition['spacingStyles'] ) ? $layout_definition['spacingStyles'] : array(); 1331 1337 1332 1338 if ( … … 1384 1390 $valid_display_modes = array( 'block', 'flex', 'grid' ); 1385 1391 foreach ( $layout_definitions as $layout_definition ) { 1386 $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );1387 $base_style_rules = _wp_array_get( $layout_definition, array( 'baseStyles' ), array());1392 $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false; 1393 $base_style_rules = isset( $layout_definition['baseStyles'] ) ? $layout_definition['baseStyles'] : array(); 1388 1394 1389 1395 if ( … … 1813 1819 protected static function compute_theme_vars( $settings ) { 1814 1820 $declarations = array(); 1815 $custom_values = _wp_array_get( $settings, array( 'custom' ), array());1821 $custom_values = isset( $settings['custom'] ) ? $settings['custom'] : array(); 1816 1822 $css_vars = static::flatten_tree( $custom_values ); 1817 1823 foreach ( $css_vars as $key => $value ) { … … 2327 2333 $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments']; 2328 2334 $selector = $block_metadata['selector']; 2329 $settings = _wp_array_get( $this->theme_json, array( 'settings' ));2335 $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array(); 2330 2336 $feature_declarations = static::get_feature_declarations_for_node( $block_metadata, $node ); 2331 2337 … … 2467 2473 public function get_root_layout_rules( $selector, $block_metadata ) { 2468 2474 $css = ''; 2469 $settings = _wp_array_get( $this->theme_json, array( 'settings' ));2475 $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array(); 2470 2476 $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments']; 2471 2477 … … 2516 2522 $css .= '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'; 2517 2523 2518 $block_gap_value = _wp_array_get( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ), '0.5em' );2519 $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;2524 $block_gap_value = isset( $this->theme_json['styles']['spacing']['blockGap'] ) ? $this->theme_json['styles']['spacing']['blockGap'] : '0.5em'; 2525 $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] ); 2520 2526 if ( $has_block_gap_support ) { 2521 2527 $block_gap_value = static::get_property_value( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ) ); … … 3356 3362 */ 3357 3363 public function set_spacing_sizes() { 3358 $spacing_scale = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'spacingScale' ), array() ); 3364 $spacing_scale = isset( $this->theme_json['settings']['spacing']['spacingScale'] ) 3365 ? $this->theme_json['settings']['spacing']['spacingScale'] 3366 : array(); 3359 3367 3360 3368 if ( ! isset( $spacing_scale['steps'] ) … … 3595 3603 } 3596 3604 3597 $settings = _wp_array_get( $this->theme_json, array( 'settings' ) ); 3605 $settings = isset( $this->theme_json['settings'] ) 3606 ? $this->theme_json['settings'] 3607 : array(); 3598 3608 3599 3609 foreach ( $metadata['selectors'] as $feature => $feature_selectors ) { -
trunk/src/wp-includes/deprecated.php
r56690 r56709 4254 4254 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); 4255 4255 4256 $border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false ); 4256 $border_support = isset( $block_type->supports['__experimentalBorder'] ) 4257 ? $block_type->supports['__experimentalBorder'] 4258 : false; 4257 4259 4258 4260 return is_array( $border_support ) && … … 4276 4278 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); 4277 4279 4278 $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false ); 4280 $dimensions_support = isset( $block_type->supports['__experimentalDimensions'] ) 4281 ? $block_type->supports['__experimentalDimensions'] 4282 : false; 4279 4283 4280 4284 return is_array( $dimensions_support ) && … … 4298 4302 _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' ); 4299 4303 4300 $spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false ); 4304 $spacing_support = isset( $block_type->supports['spacing'] ) 4305 ? $block_type->supports['spacing'] 4306 : false; 4301 4307 4302 4308 return is_array( $spacing_support ) &&
Note: See TracChangeset
for help on using the changeset viewer.