mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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
This commit is contained in:
parent
1a168a199e
commit
ec47a8f85f
@ -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',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user