<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56709] trunk/src/wp-includes: Editor: Reduce the use of the `_wp_array_get()` function to improve performance.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56709">56709</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56709","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-09-26 13:45:23 +0000 (Tue, 26 Sep 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Reduce the use of the `_wp_array_get()` function to improve performance.
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in <a href="https://core.trac.wordpress.org/ticket/58376">#58376</a>, it is still called more times than it should be.
This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116 <a href="https://core.trac.wordpress.org/ticket/51116">#51116</a> Performance improvement: Reduce the use of the _wp_array_get() function]
Follow-up to <a href="https://core.trac.wordpress.org/changeset/55851">[55851]</a>, <a href="https://core.trac.wordpress.org/changeset/56382">[56382]</a>.
Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes <a href="https://core.trac.wordpress.org/ticket/59405">#59405</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksupportsbackgroundphp">trunk/src/wp-includes/block-supports/background.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportsborderphp">trunk/src/wp-includes/block-supports/border.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportscolorsphp">trunk/src/wp-includes/block-supports/colors.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportsdimensionsphp">trunk/src/wp-includes/block-supports/dimensions.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportselementsphp">trunk/src/wp-includes/block-supports/elements.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportslayoutphp">trunk/src/wp-includes/block-supports/layout.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportspositionphp">trunk/src/wp-includes/block-supports/position.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportssettingsphp">trunk/src/wp-includes/block-supports/settings.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportsspacingphp">trunk/src/wp-includes/block-supports/spacing.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportstypographyphp">trunk/src/wp-includes/block-supports/typography.php</a></li>
<li><a href="#trunksrcwpincludesblocksphp">trunk/src/wp-includes/blocks.php</a></li>
<li><a href="#trunksrcwpincludesclasswpduotonephp">trunk/src/wp-includes/class-wp-duotone.php</a></li>
<li><a href="#trunksrcwpincludesclasswpthemejsonresolverphp">trunk/src/wp-includes/class-wp-theme-json-resolver.php</a></li>
<li><a href="#trunksrcwpincludesclasswpthemejsonphp">trunk/src/wp-includes/class-wp-theme-json.php</a></li>
<li><a href="#trunksrcwpincludesdeprecatedphp">trunk/src/wp-includes/deprecated.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksupportsbackgroundphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/background.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/background.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/background.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,9 +58,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $block_content;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $background_image_source = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundImage', 'source' ), null );
- $background_image_url = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundImage', 'url' ), null );
- $background_size = _wp_array_get( $block_attributes, array( 'style', 'background', 'backgroundSize' ), 'cover' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $background_image_source = isset( $block_attributes['style']['background']['backgroundImage']['source'] )
+ ? $block_attributes['style']['background']['backgroundImage']['source']
+ : null;
+ $background_image_url = isset( $block_attributes['style']['background']['backgroundImage']['url'] )
+ ? $block_attributes['style']['background']['backgroundImage']['url']
+ : null;
+ $background_size = isset( $block_attributes['style']['background']['backgroundSize'] )
+ ? $block_attributes['style']['background']['backgroundSize']
+ : 'cover';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $background_block_styles = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportsborderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/border.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/border.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/border.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,7 +102,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $preset_border_color = array_key_exists( 'borderColor', $block_attributes ) ? "var:preset|color|{$block_attributes['borderColor']}" : null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_border_color = _wp_array_get( $block_attributes, array( 'style', 'border', 'color' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_border_color = isset( $block_attributes['style']['border']['color'] ) ? $block_attributes['style']['border']['color'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $border_block_styles['color'] = $preset_border_color ? $preset_border_color : $custom_border_color;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -109,7 +109,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Generates styles for individual border sides.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_border_color_support || $has_border_width_support ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( array( 'top', 'right', 'bottom', 'left' ) as $side ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $border = _wp_array_get( $block_attributes, array( 'style', 'border', $side ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border = isset( $block_attributes['style']['border'][ $side ] ) ? $block_attributes['style']['border'][ $side ] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $border_side_values = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'width' => isset( $border['width'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'width' ) ? $border['width'] : null,
</span><span class="cx" style="display: block; padding: 0 10px"> 'color' => isset( $border['color'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' ) ? $border['color'] : null,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,11 +152,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_has_border_feature_support( $block_type, $feature, $default_value = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if all border support features have been opted into via `"__experimentalBorder": true`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (
- property_exists( $block_type, 'supports' ) &&
- ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default_value ) )
- ) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( property_exists( $block_type, 'supports' ) ) {
+ $block_type_supports_border = isset( $block_type->supports['__experimentalBorder'] )
+ ? $block_type->supports['__experimentalBorder']
+ : $default_value;
+ if ( true === $block_type_supports_border ) {
+ return true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if the specific feature has been opted into individually
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportscolorsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/colors.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/colors.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/colors.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,13 +16,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block Type.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_register_colors_support( $block_type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $color_support = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( 'color' ), false ) : false;
- $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
- $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
- $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
- $has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
- $has_button_colors_support = _wp_array_get( $color_support, array( 'button' ), false );
- $has_heading_colors_support = _wp_array_get( $color_support, array( 'heading' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $color_support = false;
+ if ( property_exists( $block_type, 'supports' ) ) {
+ $color_support = isset( $block_type->supports['color'] ) ? $block_type->supports['color'] : false;
+ }
+ $has_text_colors_support = true === $color_support ||
+ ( isset( $color_support['text'] ) && $color_support['text'] ) ||
+ ( is_array( $color_support ) && ! isset( $color_support['text'] ) );
+ $has_background_colors_support = true === $color_support ||
+ ( isset( $color_support['background'] ) && $color_support['background'] ) ||
+ ( is_array( $color_support ) && ! isset( $color_support['background'] ) );
+ $has_gradients_support = isset( $color_support['gradients'] ) ? $color_support['gradients'] : false;
+ $has_link_colors_support = isset( $color_support['link'] ) ? $color_support['link'] : false;
+ $has_button_colors_support = isset( $color_support['button'] ) ? $color_support['button'] : false;
+ $has_heading_colors_support = isset( $color_support['heading'] ) ? $color_support['heading'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_color_support = $has_text_colors_support ||
</span><span class="cx" style="display: block; padding: 0 10px"> $has_background_colors_support ||
</span><span class="cx" style="display: block; padding: 0 10px"> $has_gradients_support ||
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,7 +81,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array Colors CSS classes and inline styles.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_apply_colors_support( $block_type, $block_attributes ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $color_support = isset( $block_type->supports['color'] ) ? $block_type->supports['color'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> is_array( $color_support ) &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,15 +90,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
- $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
- $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_text_colors_support = true === $color_support ||
+ ( isset( $color_support['text'] ) && $color_support['text'] ) ||
+ ( is_array( $color_support ) && ! isset( $color_support['text'] ) );
+ $has_background_colors_support = true === $color_support ||
+ ( isset( $color_support['background'] ) && $color_support['background'] ) ||
+ ( is_array( $color_support ) && ! isset( $color_support['background'] ) );
+ $has_gradients_support = isset( $color_support['gradients'] ) ? $color_support['gradients'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> $color_block_styles = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Text colors.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_text_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'text' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $preset_text_color = array_key_exists( 'textColor', $block_attributes ) ? "var:preset|color|{$block_attributes['textColor']}" : null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_text_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'text' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_text_color = isset( $block_attributes['style']['color']['text'] ) ? $block_attributes['style']['color']['text'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,7 +109,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Background colors.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_background_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'background' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $preset_background_color = array_key_exists( 'backgroundColor', $block_attributes ) ? "var:preset|color|{$block_attributes['backgroundColor']}" : null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_background_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'background' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_background_color = isset( $block_attributes['style']['color']['background'] ) ? $block_attributes['style']['color']['background'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,7 +116,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Gradients.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_gradients_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'gradients' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $preset_gradient_color = array_key_exists( 'gradient', $block_attributes ) ? "var:preset|gradient|{$block_attributes['gradient']}" : null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_gradient_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'gradient' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_gradient_color = isset( $block_attributes['style']['color']['gradient'] ) ? $block_attributes['style']['color']['gradient'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $color_block_styles['gradient'] = $preset_gradient_color ? $preset_gradient_color : $custom_gradient_color;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportsdimensionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/dimensions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/dimensions.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/dimensions.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,8 +68,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $skip_min_height = wp_should_skip_block_supports_serialization( $block_type, 'dimensions', 'minHeight' );
</span><span class="cx" style="display: block; padding: 0 10px"> $dimensions_block_styles = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dimensions_block_styles['minHeight'] = $has_min_height_support && ! $skip_min_height ? _wp_array_get( $block_styles, array( 'dimensions', 'minHeight' ), null ) : null;
- $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $dimensions_block_styles['minHeight'] = null;
+ if ( $has_min_height_support && ! $skip_min_height ) {
+ $dimensions_block_styles['minHeight'] = isset( $block_styles['dimensions']['minHeight'] )
+ ? $block_styles['dimensions']['minHeight']
+ : null;
+ }
+ $styles = wp_style_engine_get_styles( array( 'dimensions' => $dimensions_block_styles ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $styles['css'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes['style'] = $styles['css'];
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportselementsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/elements.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/elements.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/elements.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -175,7 +175,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $element_style_object = _wp_array_get( $element_block_styles, array( $element_type ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $element_style_object = isset( $element_block_styles[ $element_type ] ) ? $element_block_styles[ $element_type ] : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Process primary element type styles.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $element_style_object ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -201,7 +201,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Process related elements e.g. h1-h6 for headings.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $element_config['elements'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $element_config['elements'] as $element ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $element_style_object = _wp_array_get( $element_block_styles, array( $element ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $element_style_object = isset( $element_block_styles[ $element ] )
+ ? $element_block_styles[ $element ]
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $element_style_object ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_style_engine_get_styles(
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportslayoutphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/layout.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/layout.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/layout.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -414,7 +414,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $gap_sides = is_array( $gap_value ) ? array( 'top', 'left' ) : array( 'top' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $gap_sides as $gap_side ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $process_value = is_string( $gap_value ) ? $gap_value : _wp_array_get( $gap_value, array( $gap_side ), $fallback_gap_value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $process_value = $gap_value;
+ if ( is_array( $gap_value ) ) {
+ $process_value = isset( $gap_value[ $gap_side ] ) ? $gap_value[ $gap_side ] : $fallback_gap_value;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> // Get spacing CSS variable from preset value if provided.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_string( $process_value ) && str_contains( $process_value, 'var:preset|spacing|' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $index_to_splice = strrpos( $process_value, '|' ) + 1;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -495,7 +498,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $gap_sides = is_array( $gap_value ) ? array( 'top', 'left' ) : array( 'top' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $gap_sides as $gap_side ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $process_value = is_string( $gap_value ) ? $gap_value : _wp_array_get( $gap_value, array( $gap_side ), $fallback_gap_value );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $process_value = $gap_value;
+ if ( is_array( $gap_value ) ) {
+ $process_value = isset( $gap_value[ $gap_side ] ) ? $gap_value[ $gap_side ] : $fallback_gap_value;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> // Get spacing CSS variable from preset value if provided.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_string( $process_value ) && str_contains( $process_value, 'var:preset|spacing|' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $index_to_splice = strrpos( $process_value, '|' ) + 1;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -612,8 +618,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $global_settings = wp_get_global_settings();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $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() );
- $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $fallback_layout;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $fallback_layout = isset( $block_type->supports['layout']['default'] )
+ ? $block_type->supports['layout']['default']
+ : array();
+ if ( empty( $fallback_layout ) ) {
+ $fallback_layout = isset( $block_type->supports['__experimentalLayout']['default'] )
+ ? $block_type->supports['__experimentalLayout']['default']
+ : array();
+ }
+ $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $fallback_layout;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $class_names = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $layout_definitions = wp_get_layout_definitions();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -624,7 +637,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $used_layout['type'] = 'constrained';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $root_padding_aware_alignments = _wp_array_get( $global_settings, array( 'useRootPaddingAwareAlignments' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $root_padding_aware_alignments = isset( $global_settings['useRootPaddingAwareAlignments'] )
+ ? $global_settings['useRootPaddingAwareAlignments']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> $root_padding_aware_alignments &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -654,9 +669,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Get classname for layout type.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $used_layout['type'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $layout_classname = _wp_array_get( $layout_definitions, array( $used_layout['type'], 'className' ), '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $layout_classname = isset( $layout_definitions[ $used_layout['type'] ]['className'] )
+ ? $layout_definitions[ $used_layout['type'] ]['className']
+ : '';
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $layout_classname = _wp_array_get( $layout_definitions, array( 'default', 'className' ), '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $layout_classname = isset( $layout_definitions['default']['className'] )
+ ? $layout_definitions['default']['className']
+ : '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $layout_classname && is_string( $layout_classname ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -669,7 +688,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! current_theme_supports( 'disable-layout-styles' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $gap_value = isset( $block['attrs']['style']['spacing']['blockGap'] )
+ ? $block['attrs']['style']['spacing']['blockGap']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * Skip if gap value contains unsupported characters.
</span><span class="cx" style="display: block; padding: 0 10px"> * Regex for CSS value borrowed from `safecss_filter_attr`, and used here
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -683,8 +704,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $gap_value = $gap_value && preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $fallback_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), '0.5em' );
- $block_spacing = _wp_array_get( $block, array( 'attrs', 'style', 'spacing' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $fallback_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] )
+ ? $block_type->supports['spacing']['blockGap']['__experimentalDefault']
+ : '0.5em';
+ $block_spacing = isset( $block['attrs']['style']['spacing'] )
+ ? $block['attrs']['style']['spacing']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * If a block's block.json skips serialization for spacing or spacing.blockGap,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -692,7 +717,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $should_skip_gap_serialization = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'blockGap' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_gap = _wp_array_get( $global_settings, array( 'spacing', 'blockGap' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_gap = isset( $global_settings['spacing']['blockGap'] )
+ ? $global_settings['spacing']['blockGap']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_block_gap_support = isset( $block_gap );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $style = wp_get_layout_style(
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportspositionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/position.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/position.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/position.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,8 +51,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $global_settings = wp_get_global_settings();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $theme_has_sticky_support = _wp_array_get( $global_settings, array( 'position', 'sticky' ), false );
- $theme_has_fixed_support = _wp_array_get( $global_settings, array( 'position', 'fixed' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $theme_has_sticky_support = isset( $global_settings['position']['sticky'] ) ? $global_settings['position']['sticky'] : false;
+ $theme_has_fixed_support = isset( $global_settings['position']['fixed'] ) ? $global_settings['position']['fixed'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Only allow output for position types that the theme supports.
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_position_types = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,11 +63,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $allowed_position_types[] = 'fixed';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $style_attribute = _wp_array_get( $block, array( 'attrs', 'style' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $style_attribute = isset( $block['attrs']['style'] ) ? $block['attrs']['style'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $class_name = wp_unique_id( 'wp-container-' );
</span><span class="cx" style="display: block; padding: 0 10px"> $selector = ".$class_name";
</span><span class="cx" style="display: block; padding: 0 10px"> $position_styles = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $position_type = _wp_array_get( $style_attribute, array( 'position', 'type' ), '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $position_type = isset( $style_attribute['position']['type'] ) ? $style_attribute['position']['type'] : '';
</ins><span class="cx" style="display: block; padding: 0 10px"> $wrapper_classes = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,7 +78,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $sides = array( 'top', 'right', 'bottom', 'left' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sides as $side ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $side_value = _wp_array_get( $style_attribute, array( 'position', $side ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $side_value = isset( $style_attribute['position'][ $side ] ) ? $style_attribute['position'][ $side ] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( null !== $side_value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * For fixed or sticky top positions,
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportssettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/settings.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/settings.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,7 +45,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // return early if no settings are found on the block attributes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_settings = isset( $block['attrs']['settings'] ) ? $block['attrs']['settings'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $block_settings ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $block_content;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,7 +82,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // return early if no settings are found on the block attributes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_settings = isset( $block['attrs']['settings'] ) ? $block['attrs']['settings'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $block_settings ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportsspacingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/spacing.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/spacing.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/spacing.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -58,12 +58,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $attributes;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' );
- $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' );
- $spacing_block_styles = array();
- $spacing_block_styles['padding'] = $has_padding_support && ! $skip_padding ? _wp_array_get( $block_styles, array( 'spacing', 'padding' ), null ) : null;
- $spacing_block_styles['margin'] = $has_margin_support && ! $skip_margin ? _wp_array_get( $block_styles, array( 'spacing', 'margin' ), null ) : null;
- $styles = wp_style_engine_get_styles( array( 'spacing' => $spacing_block_styles ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' );
+ $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' );
+ $spacing_block_styles = array(
+ 'padding' => null,
+ 'margin' => null,
+ );
+ if ( $has_padding_support && ! $skip_padding ) {
+ $spacing_block_styles['padding'] = isset( $block_styles['spacing']['padding'] ) ? $block_styles['spacing']['padding'] : null;
+ }
+ if ( $has_margin_support && ! $skip_margin ) {
+ $spacing_block_styles['margin'] = isset( $block_styles['spacing']['margin'] ) ? $block_styles['spacing']['margin'] : null;
+ }
+ $styles = wp_style_engine_get_styles( array( 'spacing' => $spacing_block_styles ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $styles['css'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes['style'] = $styles['css'];
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportstypographyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/block-supports/typography.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/typography.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/block-supports/typography.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,21 +20,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $typography_supports = isset( $block_type->supports['typography'] ) ? $block_type->supports['typography'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $typography_supports ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );
- $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false );
- $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );
- $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false );
- $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );
- $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );
- $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
- $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
- $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
- $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_font_family_support = isset( $typography_supports['__experimentalFontFamily'] ) ? $typography_supports['__experimentalFontFamily'] : false;
+ $has_font_size_support = isset( $typography_supports['fontSize'] ) ? $typography_supports['fontSize'] : false;
+ $has_font_style_support = isset( $typography_supports['__experimentalFontStyle'] ) ? $typography_supports['__experimentalFontStyle'] : false;
+ $has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false;
+ $has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false;
+ $has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false;
+ $has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false;
+ $has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false;
+ $has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false;
+ $has_writing_mode_support = isset( $typography_supports['__experimentalWritingMode'] ) ? $typography_supports['__experimentalWritingMode'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $has_typography_support = $has_font_family_support
</span><span class="cx" style="display: block; padding: 0 10px"> || $has_font_size_support
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -89,7 +89,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $typography_supports = _wp_array_get( $block_type->supports, array( 'typography' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $typography_supports = isset( $block_type->supports['typography'] )
+ ? $block_type->supports['typography']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $typography_supports ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -98,16 +100,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_font_family_support = _wp_array_get( $typography_supports, array( '__experimentalFontFamily' ), false );
- $has_font_size_support = _wp_array_get( $typography_supports, array( 'fontSize' ), false );
- $has_font_style_support = _wp_array_get( $typography_supports, array( '__experimentalFontStyle' ), false );
- $has_font_weight_support = _wp_array_get( $typography_supports, array( '__experimentalFontWeight' ), false );
- $has_letter_spacing_support = _wp_array_get( $typography_supports, array( '__experimentalLetterSpacing' ), false );
- $has_line_height_support = _wp_array_get( $typography_supports, array( 'lineHeight' ), false );
- $has_text_columns_support = _wp_array_get( $typography_supports, array( 'textColumns' ), false );
- $has_text_decoration_support = _wp_array_get( $typography_supports, array( '__experimentalTextDecoration' ), false );
- $has_text_transform_support = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
- $has_writing_mode_support = _wp_array_get( $typography_supports, array( '__experimentalWritingMode' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_font_family_support = isset( $typography_supports['__experimentalFontFamily'] ) ? $typography_supports['__experimentalFontFamily'] : false;
+ $has_font_size_support = isset( $typography_supports['fontSize'] ) ? $typography_supports['fontSize'] : false;
+ $has_font_style_support = isset( $typography_supports['__experimentalFontStyle'] ) ? $typography_supports['__experimentalFontStyle'] : false;
+ $has_font_weight_support = isset( $typography_supports['__experimentalFontWeight'] ) ? $typography_supports['__experimentalFontWeight'] : false;
+ $has_letter_spacing_support = isset( $typography_supports['__experimentalLetterSpacing'] ) ? $typography_supports['__experimentalLetterSpacing'] : false;
+ $has_line_height_support = isset( $typography_supports['lineHeight'] ) ? $typography_supports['lineHeight'] : false;
+ $has_text_columns_support = isset( $typography_supports['textColumns'] ) ? $typography_supports['textColumns'] : false;
+ $has_text_decoration_support = isset( $typography_supports['__experimentalTextDecoration'] ) ? $typography_supports['__experimentalTextDecoration'] : false;
+ $has_text_transform_support = isset( $typography_supports['__experimentalTextTransform'] ) ? $typography_supports['__experimentalTextTransform'] : false;
+ $has_writing_mode_support = isset( $typography_supports['__experimentalWritingMode'] ) ? $typography_supports['__experimentalWritingMode'] : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Whether to skip individual block support features.
</span><span class="cx" style="display: block; padding: 0 10px"> $should_skip_font_size = wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,11 +171,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_line_height_support && ! $should_skip_line_height ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $typography_block_styles['lineHeight'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'lineHeight' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $typography_block_styles['lineHeight'] = isset( $block_attributes['style']['typography']['lineHeight'] )
+ ? $block_attributes['style']['typography']['lineHeight']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_text_columns_support && ! $should_skip_text_columns && isset( $block_attributes['style']['typography']['textColumns'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $typography_block_styles['textColumns'] = _wp_array_get( $block_attributes, array( 'style', 'typography', 'textColumns' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $typography_block_styles['textColumns'] = isset( $block_attributes['style']['typography']['textColumns'] )
+ ? $block_attributes['style']['typography']['textColumns']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -213,11 +219,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ! $should_skip_writing_mode &&
</span><span class="cx" style="display: block; padding: 0 10px"> isset( $block_attributes['style']['typography']['writingMode'] )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $typography_block_styles['writingMode'] = _wp_array_get(
- $block_attributes,
- array( 'style', 'typography', 'writingMode' ),
- null
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $typography_block_styles['writingMode'] = isset( $block_attributes['style']['typography']['writingMode'] )
+ ? $block_attributes['style']['typography']['writingMode']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes = array();
</span></span></pre></div>
<a id="trunksrcwpincludesblocksphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/blocks.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/blocks.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/blocks.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1636,7 +1636,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $typography_keys as $typography_key ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $support_for_key = isset( $metadata['supports'][ $typography_key ] ) ? $metadata['supports'][ $typography_key ] : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( null !== $support_for_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _doing_it_wrong(
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpduotonephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-duotone.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-duotone.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/class-wp-duotone.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -971,7 +971,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If the experimental duotone support was set, that value is to be
</span><span class="cx" style="display: block; padding: 0 10px"> * treated as a selector and requires scoping.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $experimental_duotone = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $experimental_duotone = isset( $block_type->supports['color']['__experimentalDuotone'] )
+ ? $block_type->supports['color']['__experimentalDuotone']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $experimental_duotone ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $root_selector = wp_get_block_css_selector( $block_type );
</span><span class="cx" style="display: block; padding: 0 10px"> return is_string( $experimental_duotone )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1000,7 +1002,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> // Get the per block settings from the theme.json.
</span><span class="cx" style="display: block; padding: 0 10px"> $tree = wp_get_global_settings();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $presets_by_origin = _wp_array_get( $tree, array( 'color', 'duotone' ), array() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $presets_by_origin = isset( $tree['color']['duotone'] ) ? $tree['color']['duotone'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> self::$global_styles_presets = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $presets_by_origin as $presets ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1262,7 +1264,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array Filtered block type settings.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function migrate_experimental_duotone_support_flag( $settings, $metadata ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $duotone_support = _wp_array_get( $metadata, array( 'supports', 'color', '__experimentalDuotone' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $duotone_support = isset( $metadata['supports']['color']['__experimentalDuotone'] )
+ ? $metadata['supports']['color']['__experimentalDuotone']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $settings['supports']['filter']['duotone'] ) && null !== $duotone_support ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _wp_array_set( $settings, array( 'supports', 'filter', 'duotone' ), (bool) $duotone_support );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpthemejsonresolverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-theme-json-resolver.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-theme-json-resolver.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/class-wp-theme-json-resolver.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -356,7 +356,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] ) &&
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- null === _wp_array_get( $config, array( 'styles', 'blocks', $block_name, 'spacing', 'blockGap' ), null )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ! isset( $config['styles']['blocks'][ $block_name ]['spacing']['blockGap'] )
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * Ensure an empty placeholder value exists for the block, if it provides a default blockGap value.
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpthemejsonphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-theme-json.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-theme-json.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/class-wp-theme-json.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -923,7 +923,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Keep backwards compatibility for support.color.__experimentalDuotone.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( null === $duotone_selector ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $duotone_support = _wp_array_get( $block_type->supports, array( 'color', '__experimentalDuotone' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $duotone_support = isset( $block_type->supports['color']['__experimentalDuotone'] )
+ ? $block_type->supports['color']['__experimentalDuotone']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $duotone_support ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $root_selector = wp_get_block_css_selector( $block_type );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1160,12 +1162,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_custom_css() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Add the global styles root CSS.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $stylesheet = _wp_array_get( $this->theme_json, array( 'styles', 'css' ), '' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $stylesheet = isset( $this->theme_json['styles']['css'] ) ? $this->theme_json['styles']['css'] : '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Add the global styles block CSS.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->theme_json['styles']['blocks'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_block_css = _wp_array_get( $this->theme_json, array( 'styles', 'blocks', $name, 'css' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_block_css = isset( $this->theme_json['styles']['blocks'][ $name ]['css'] )
+ ? $this->theme_json['styles']['blocks'][ $name ]['css']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $custom_block_css ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $selector = static::$blocks_metadata[ $name ]['selector'];
</span><span class="cx" style="display: block; padding: 0 10px"> $stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1284,7 +1288,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $selector = isset( $block_metadata['selector'] ) ? $block_metadata['selector'] : '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> $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.
</span><span class="cx" style="display: block; padding: 0 10px"> $node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
</span><span class="cx" style="display: block; padding: 0 10px"> $layout_definitions = wp_get_layout_definitions();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1300,7 +1304,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $has_block_gap_support ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $block_gap_value = static::ROOT_BLOCK_SELECTOR === $selector ? '0.5em' : null;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $block_type ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_gap_value = _wp_array_get( $block_type->supports, array( 'spacing', 'blockGap', '__experimentalDefault' ), null );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_gap_value = isset( $block_type->supports['spacing']['blockGap']['__experimentalDefault'] )
+ ? $block_type->supports['spacing']['blockGap']['__experimentalDefault']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $block_gap_value = static::get_property_value( $node, array( 'spacing', 'blockGap' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1326,8 +1332,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );
- $spacing_rules = _wp_array_get( $layout_definition, array( 'spacingStyles' ), array() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false;
+ $spacing_rules = isset( $layout_definition['spacingStyles'] ) ? $layout_definition['spacingStyles'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> ! empty( $class_name ) &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1383,8 +1389,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $valid_display_modes = array( 'block', 'flex', 'grid' );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $layout_definitions as $layout_definition ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class_name = _wp_array_get( $layout_definition, array( 'className' ), false );
- $base_style_rules = _wp_array_get( $layout_definition, array( 'baseStyles' ), array() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $class_name = isset( $layout_definition['className'] ) ? $layout_definition['className'] : false;
+ $base_style_rules = isset( $layout_definition['baseStyles'] ) ? $layout_definition['baseStyles'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> ! empty( $class_name ) &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1812,7 +1818,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected static function compute_theme_vars( $settings ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $declarations = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $custom_values = _wp_array_get( $settings, array( 'custom' ), array() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $custom_values = isset( $settings['custom'] ) ? $settings['custom'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $css_vars = static::flatten_tree( $custom_values );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $css_vars as $key => $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $declarations[] = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2326,7 +2332,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
</span><span class="cx" style="display: block; padding: 0 10px"> $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments'];
</span><span class="cx" style="display: block; padding: 0 10px"> $selector = $block_metadata['selector'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $settings = _wp_array_get( $this->theme_json, array( 'settings' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $feature_declarations = static::get_feature_declarations_for_node( $block_metadata, $node );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // If there are style variations, generate the declarations for them, including any feature selectors the block may have.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2466,7 +2472,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_root_layout_rules( $selector, $block_metadata ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $css = '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $settings = _wp_array_get( $this->theme_json, array( 'settings' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $settings = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $use_root_padding = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2515,8 +2521,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $css .= '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
</span><span class="cx" style="display: block; padding: 0 10px"> $css .= '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_gap_value = _wp_array_get( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ), '0.5em' );
- $has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_gap_value = isset( $this->theme_json['styles']['spacing']['blockGap'] ) ? $this->theme_json['styles']['spacing']['blockGap'] : '0.5em';
+ $has_block_gap_support = isset( $this->theme_json['settings']['spacing']['blockGap'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $has_block_gap_support ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $block_gap_value = static::get_property_value( $this->theme_json, array( 'styles', 'spacing', 'blockGap' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $css .= ":where(.wp-site-blocks) > * { margin-block-start: $block_gap_value; margin-block-end: 0; }";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3355,7 +3361,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return null|void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set_spacing_sizes() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $spacing_scale = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'spacingScale' ), array() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $spacing_scale = isset( $this->theme_json['settings']['spacing']['spacingScale'] )
+ ? $this->theme_json['settings']['spacing']['spacingScale']
+ : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $spacing_scale['steps'] )
</span><span class="cx" style="display: block; padding: 0 10px"> || ! is_numeric( $spacing_scale['steps'] )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3594,7 +3602,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $declarations;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $settings = _wp_array_get( $this->theme_json, array( 'settings' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $settings = isset( $this->theme_json['settings'] )
+ ? $this->theme_json['settings']
+ : array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $metadata['selectors'] as $feature => $feature_selectors ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span></span></pre></div>
<a id="trunksrcwpincludesdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/deprecated.php 2023-09-26 12:40:36 UTC (rev 56708)
+++ trunk/src/wp-includes/deprecated.php 2023-09-26 13:45:23 UTC (rev 56709)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4253,7 +4253,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_skip_border_serialization( $block_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border_support = isset( $block_type->supports['__experimentalBorder'] )
+ ? $block_type->supports['__experimentalBorder']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return is_array( $border_support ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> array_key_exists( '__experimentalSkipSerialization', $border_support ) &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4275,7 +4277,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_skip_dimensions_serialization( $block_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $dimensions_support = isset( $block_type->supports['__experimentalDimensions'] )
+ ? $block_type->supports['__experimentalDimensions']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return is_array( $dimensions_support ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4297,7 +4301,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_skip_spacing_serialization( $block_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $spacing_support = isset( $block_type->supports['spacing'] )
+ ? $block_type->supports['spacing']
+ : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return is_array( $spacing_support ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
</span></span></pre>
</div>
</div>
</body>
</html>