PluginProbe
Gutenberg / 16.2.0
Gutenberg v16.2.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | lib/experimental/kses.php +20 -41 23.7.0 → 16.2.0 View file →
@@ -30,18 +30,12 @@
30 30 $decoded_data['isGlobalStylesUserThemeJSON']
31 31 ) {
32 32 unset( $decoded_data['isGlobalStylesUserThemeJSON'] );
33 33
34 - $data_to_encode = WP_Theme_JSON_Gutenberg::remove_insecure_properties( $decoded_data, 'custom' );
34 + $data_to_encode = WP_Theme_JSON_Gutenberg::remove_insecure_properties( $decoded_data );
35 35
36 36 $data_to_encode['isGlobalStylesUserThemeJSON'] = true;
37 - /**
38 - * JSON encode the data stored in post content.
39 - * Escape characters that are likely to be mangled by HTML filters: "<>&".
40 - *
41 - * This matches the escaping in {@see WP_REST_Global_Styles_Controller_Gutenberg::prepare_item_for_database()}.
42 - */
43 - return wp_slash( wp_json_encode( $data_to_encode, JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) );
37 + return wp_slash( wp_json_encode( $data_to_encode ) );
44 38 }
45 39 return $data;
46 40 }
47 41
@@ -65,46 +59,31 @@
65 59 if ( has_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post' ) ) {
66 60 remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
67 61 add_filter( 'content_filtered_save_pre', 'gutenberg_filter_global_styles_post', 9 );
68 62 }
63 +
69 64 }
70 65 // The 'kses_init_filters' is usually initialized with default priority. Use higher priority to override.
71 66 add_action( 'init', 'gutenberg_override_core_kses_init_filters', 20 );
72 67 add_action( 'set_current_user', 'gutenberg_override_core_kses_init_filters' );
73 68
74 -if ( ! function_exists( 'allow_filter_in_styles' ) ) {
75 - /**
76 - * See https://github.com/WordPress/wordpress-develop/pull/4108
77 - *
78 - * Mark CSS safe if it contains a "filter: url('#wp-duotone-...')" rule.
79 - *
80 - * This function should not be backported to core.
81 - *
82 - * @param bool $allow_css Whether the CSS is allowed.
83 - * @param string $css_test_string The CSS to test.
84 - * @return bool Whether the CSS is allowed.
85 - */
86 - function allow_filter_in_styles( $allow_css, $css_test_string ) {
87 - if ( preg_match(
88 - "/^filter:\s*url\((['\"]?)#wp-duotone-[-a-zA-Z0-9]+\\1\)(\s+!important)?$/",
89 - $css_test_string
90 - ) ) {
91 - return true;
92 - }
93 - return $allow_css;
94 - }
95 -}
96 -add_filter( 'safecss_filter_attr_allow_css', 'allow_filter_in_styles', 10, 2 );
97 -
98 69 /**
99 - * Update allowed inline style attributes list.
70 + * See https://github.com/WordPress/wordpress-develop/pull/4108
100 71 *
101 - * @param string[] $attrs Array of allowed CSS attributes.
102 - * @return string[] CSS attributes.
72 + * Mark CSS safe if it contains a "filter: url('#wp-duotone-...')" rule.
73 + *
74 + * This function should not be backported to core.
75 + *
76 + * @param bool $allow_css Whether the CSS is allowed.
77 + * @param string $css_test_string The CSS to test.
103 78 */
104 -function gutenberg_safe_grid_attrs( $attrs ) {
105 - $attrs[] = 'grid-column';
106 - $attrs[] = 'grid-row';
107 - $attrs[] = 'container-type';
108 - return $attrs;
79 +function allow_filter_in_styles( $allow_css, $css_test_string ) {
80 + if ( preg_match(
81 + "/^filter:\s*url\((['\"]?)#wp-duotone-[-a-zA-Z0-9]+\\1\)(\s+!important)?$/",
82 + $css_test_string
83 + ) ) {
84 + return true;
85 + }
86 + return $allow_css;
109 87 }
110 -add_filter( 'safe_style_css', 'gutenberg_safe_grid_attrs' );
88 +
89 +add_filter( 'safecss_filter_attr_allow_css', 'allow_filter_in_styles', 10, 2 );