Formatting: Use safecss_filter_attr in wp_get_layout_style().

Previously, `safecss_filter_attr` did not allow for `calc` and `var` in parsed CSS.  Because of this, `wp_strip_all_tags` was used in `wp_get_layout_style` to allow for the use of these CSS functions to account for responsive widths.  [50923] added support for both of these CSS functions in KSES, so `safecss_filter_attr` can now be used in `wp_get_layout_style` as originally intended.

Follow-up to [52069].

Props grapplerulrich.
Fixes .

git-svn-id: https://develop.svn.wordpress.org/trunk@52924 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2022-03-12 00:27:25 +00:00
parent 4374801beb
commit cc2712502c

@ -54,9 +54,8 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
$wide_max_width_value = $wide_size ? $wide_size : $content_size;
// Make sure there is a single CSS rule, and all tags are stripped for security.
// TODO: Use `safecss_filter_attr` instead - once https://core.trac.wordpress.org/ticket/46197 is patched.
$all_max_width_value = wp_strip_all_tags( explode( ';', $all_max_width_value )[0] );
$wide_max_width_value = wp_strip_all_tags( explode( ';', $wide_max_width_value )[0] );
$all_max_width_value = safecss_filter_attr( explode( ';', $all_max_width_value )[0] );
$wide_max_width_value = safecss_filter_attr( explode( ';', $wide_max_width_value )[0] );
$style = '';
if ( $content_size || $wide_size ) {