Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
This commit:
- 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 committed Jul 21, 2023
commit 39acf7ebc406a8823b8b54ce3cb6ed5a59fd5f5f
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