REST API: quality tweaks to WP_REST_Global_Styles_Controller.

Removes redundant local variable and changes validate_custom_css() access modifier from private to protected.

Props ramonopoly, spacedmonkey.
Fixes #59296.


Built from https://develop.svn.wordpress.org/trunk@56575


git-svn-id: http://core.svn.wordpress.org/trunk@56087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
isabel_brison 2023-09-14 05:13:17 +00:00
parent 21ecbc3b0d
commit e1b622244d
2 changed files with 5 additions and 4 deletions

View File

@ -663,6 +663,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
* Returns the given theme global styles variations.
*
* @since 6.0.0
* @since 6.2.0 Returns parent theme variations, if they exist.
*
* @param WP_REST_Request $request The request instance.
*
@ -679,9 +680,8 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
}
$variations = WP_Theme_JSON_Resolver::get_style_variations();
$response = rest_ensure_response( $variations );
return $response;
return rest_ensure_response( $variations );
}
/**
@ -690,11 +690,12 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
* 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.
*/
private function validate_custom_css( $css ) {
protected function validate_custom_css( $css ) {
if ( preg_match( '#</?\w+#', $css ) ) {
return new WP_Error(
'rest_custom_css_illegal_markup',

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56574';
$wp_version = '6.4-alpha-56575';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.