Skip to content

Commit

Permalink
Centralize safe_style_css usages. (#36280)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Nov 8, 2021
1 parent 8e21746 commit b49b215
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 1 addition & 0 deletions lib/compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function gutenberg_safe_style_attrs( $attrs ) {
$attrs[] = 'border-top-right-radius';
$attrs[] = 'border-bottom-right-radius';
$attrs[] = 'border-bottom-left-radius';
$attrs[] = 'filter';

return $attrs;
}
Expand Down
13 changes: 0 additions & 13 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ function gutenberg_global_styles_filter_post( $content ) {
*/
function gutenberg_global_styles_kses_init_filters() {
add_filter( 'content_save_pre', 'gutenberg_global_styles_filter_post' );
add_filter( 'safe_style_css', 'gutenberg_global_styles_include_support_for_duotone', 10, 2 );
}

/**
Expand Down Expand Up @@ -289,18 +288,6 @@ function gutenberg_global_styles_include_support_for_wp_variables( $allow_css, $
return ! ! preg_match( '/^var\(--wp-[a-zA-Z0-9\-]+\)$/', trim( $parts[1] ) );
}

/**
* This is for using kses to test user data.
*
* @param array $atts Allowed CSS property names, according to kses.
*
* @return array The new allowed CSS property names.
*/
function gutenberg_global_styles_include_support_for_duotone( $atts ) {
$atts[] = 'filter';
return $atts;
}

// The else clause can be removed when plugin support requires WordPress 5.8.0+.
if ( function_exists( 'get_block_editor_settings' ) ) {
add_filter( 'block_editor_settings_all', 'gutenberg_experimental_global_styles_settings', PHP_INT_MAX );
Expand Down

0 comments on commit b49b215

Please sign in to comment.