Skip to content

Commit

Permalink
This commit: (#52819)
Browse files Browse the repository at this point in the history
- removes tests that have been ported to Core already as part of WP 6.3
- Adds tests for #52370
- Changes a private method to protected so it can be used in inherited classes
  • Loading branch information
ramonjd authored Jul 21, 2023
1 parent 50722cc commit 8234de4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 478 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,26 @@ protected function prepare_item_for_database( $request ) {
return $changes;
}

/**
* Validate style.css as valid CSS.
*
* Currently just checks for invalid markup.
*
* @since 6.2.0
* @since 6.4.0 Changed method visibility to protected.
*
* @param string $css CSS to validate.
* @return true|WP_Error True if the input was validated, otherwise WP_Error.
*/
protected function validate_custom_css( $css ) {
if ( preg_match( '#</?\w+#', $css ) ) {
return new WP_Error(
'rest_custom_css_illegal_markup',
__( 'Markup is not allowed in CSS.', 'gutenberg' ),
array( 'status' => 400 )
);
}
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Gutenberg_REST_Global_Styles_Revisions_Controller_6_4 extends Gutenberg_RE
* Prepares the revision for the REST response.
*
* @since 6.3.0
* @since 6.4.0 Added `behaviors` field to the response.
*
* @param WP_Post $post Post revision object.
* @param WP_REST_Request $request Request object.
Expand Down Expand Up @@ -87,6 +88,7 @@ public function prepare_item_for_response( $post, $request ) {
* Retrieves the revision's schema, conforming to JSON Schema.
*
* @since 6.3.0
* @since 6.4.0 Added `behaviors` field to the schema properties.
*
* @return array Item schema data.
*/
Expand Down
Loading

0 comments on commit 8234de4

Please sign in to comment.