From ec47a8f85ff0b7bb1eee423484f5ef67e9d4d929 Mon Sep 17 00:00:00 2001 From: Isabel Brison Date: Thu, 14 Sep 2023 05:11:50 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@56575 602fd350-edb4-49c9-b593-d223f7449a82 --- .../endpoints/class-wp-rest-global-styles-controller.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php index 0315cd23cf..4f4ce16b0a 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php @@ -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( '#