[ 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`.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

Currently just checks for invalid markup.

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



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref