Changeset 52376 for trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
- Timestamp:
- 12/14/2021 06:22:07 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r52374 r52376 42 42 register_rest_route( 43 43 $this->namespace, 44 '/' . $this->rest_base . '/themes/(?P<stylesheet>[ ^.\/]+(?:\/[^.\/]+)?)',44 '/' . $this->rest_base . '/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)', 45 45 array( 46 46 array( … … 50 50 'args' => array( 51 51 'stylesheet' => array( 52 'description' => __( 'The theme identifier' ), 53 'type' => 'string', 52 'description' => __( 'The theme identifier' ), 53 'type' => 'string', 54 'sanitize_callback' => array( $this, '_sanitize_global_styles_callback' ), 54 55 ), 55 56 ), … … 58 59 ); 59 60 60 // Lists/updates a single glo val style variation based on the given id.61 // Lists/updates a single global style variation based on the given id. 61 62 register_rest_route( 62 63 $this->namespace, 63 '/' . $this->rest_base . '/(?P<id>[\/\ w-]+)',64 '/' . $this->rest_base . '/(?P<id>[\/\s%\w\.\(\)\[\]\@_\-]+)', 64 65 array( 65 66 array( … … 69 70 'args' => array( 70 71 'id' => array( 71 'description' => __( 'The id of a template' ), 72 'type' => 'string', 72 'description' => __( 'The id of a template' ), 73 'type' => 'string', 74 'sanitize_callback' => array( $this, '_sanitize_global_styles_callback' ), 73 75 ), 74 76 ), … … 83 85 ) 84 86 ); 87 } 88 89 /** 90 * Sanitize the global styles ID or stylesheet to decode endpoint. 91 * For example, `wp/v2/global-styles/templatetwentytwo%200.4.0` 92 * would be decoded to `templatetwentytwo 0.4.0`. 93 * 94 * @since 5.9.0 95 * 96 * @param string $id_or_stylesheet Global styles ID or stylesheet. 97 * @return string Sanitized global styles ID or stylesheet. 98 */ 99 public function _sanitize_global_styles_callback( $id_or_stylesheet ) { 100 return urldecode( $id_or_stylesheet ); 85 101 } 86 102 … … 520 536 * 521 537 * @param WP_REST_Request $request The request instance. 522 *523 538 * @return WP_REST_Response|WP_Error 524 539 */
Note: See TracChangeset
for help on using the changeset viewer.