[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-global-styles-controller.php (summary)

REST API: WP_REST_Global_Styles_Controller class

File Size: 681 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Global_Styles_Controller:: (18 methods):
  __construct()
  register_routes()
  _sanitize_global_styles_callback()
  get_post()
  get_item_permissions_check()
  check_read_permission()
  update_item_permissions_check()
  prepare_item_for_database()
  prepare_item_for_response()
  prepare_links()
  get_available_actions()
  get_collection_params()
  get_item_schema()
  get_theme_item_permissions_check()
  get_theme_item()
  get_theme_items_permissions_check()
  get_theme_items()
  validate_custom_css()


Class: WP_REST_Global_Styles_Controller  - X-Ref

Base Global Styles REST API Controller.

__construct( $post_type = 'wp_global_styles' )   X-Ref
Constructor.

param: string $post_type Post type.

register_routes()   X-Ref
Registers the controllers routes.


_sanitize_global_styles_callback( $id_or_stylesheet )   X-Ref
Sanitize the global styles ID or stylesheet to decode endpoint.
For example, `wp/v2/global-styles/twentytwentytwo%200.4.0`
would be decoded to `twentytwentytwo 0.4.0`.

param: string $id_or_stylesheet Global styles ID or stylesheet.
return: string Sanitized global styles ID or stylesheet.

get_post( $id )   X-Ref
Get the post, if the ID is valid.

param: int $id Supplied ID.
return: WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to read a single global style.

param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has read access, WP_Error object otherwise.

check_read_permission( $post )   X-Ref
Checks if a global style can be read.

param: WP_Post $post Post object.
return: bool Whether the post can be read.

update_item_permissions_check( $request )   X-Ref
Checks if a given request has access to write a single global styles config.

param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has write access for the item, WP_Error object otherwise.

prepare_item_for_database( $request )   X-Ref
Prepares a single global styles config for update.

param: WP_REST_Request $request Request object.
return: stdClass|WP_Error Prepared item on success. WP_Error on when the custom CSS is not valid.

prepare_item_for_response( $post, $request )   X-Ref
Prepare a global styles config output for response.

param: WP_Post         $post    Global Styles post object.
param: WP_REST_Request $request Request object.
return: WP_REST_Response Response object.

prepare_links( $id )   X-Ref
Prepares links for the request.

param: integer $id ID.
return: array Links for the given post.

get_available_actions( $post, $request )   X-Ref
Get the link relations available for the post and current user.

param: WP_Post         $post    Post object.
param: WP_REST_Request $request Request object.
return: array List of link relations.

get_collection_params()   X-Ref
Retrieves the query params for the global styles collection.

return: array Collection parameters.

get_item_schema()   X-Ref
Retrieves the global styles type' schema, conforming to JSON Schema.

return: array Item schema data.

get_theme_item_permissions_check( $request )   X-Ref
Checks if a given request has access to read a single theme global styles config.

param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise.

get_theme_item( $request )   X-Ref
Returns the given theme global styles config.

param: WP_REST_Request $request The request instance.
return: WP_REST_Response|WP_Error

get_theme_items_permissions_check( $request )   X-Ref
Checks if a given request has access to read a single theme global styles config.

param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise.

get_theme_items( $request )   X-Ref
Returns the given theme global styles variations.

param: WP_REST_Request $request The request instance.
return: WP_REST_Response|WP_Error

validate_custom_css( $css )   X-Ref
Validate style.css as valid CSS.

Currently just checks for invalid markup.

param: string $css CSS to validate.
return: true|WP_Error True if the input was validated, otherwise WP_Error.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref