[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Revisions_Controller class

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

Defines 1 class

WP_REST_Revisions_Controller:: (16 methods):
  __construct()
  register_routes()
  get_parent()
  get_items_permissions_check()
  get_revision()
  get_items()
  get_item_permissions_check()
  get_item()
  delete_item_permissions_check()
  delete_item()
  prepare_items_query()
  prepare_item_for_response()
  prepare_date_response()
  get_item_schema()
  get_collection_params()
  prepare_excerpt_response()


Class: WP_REST_Revisions_Controller  - X-Ref

Core class used to access revisions via the REST API.

__construct( $parent_post_type )   X-Ref
Constructor.

param: string $parent_post_type Post type of the parent.

register_routes()   X-Ref
Registers the routes for revisions based on post types supporting revisions.


get_parent( $parent_post_id )   X-Ref
Get the parent post, if the ID is valid.

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

get_items_permissions_check( $request )   X-Ref
Checks if a given request has access to get revisions.

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.

get_revision( $id )   X-Ref
Get the revision, if the ID is valid.

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

get_items( $request )   X-Ref
Gets a collection of revisions.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to get a specific revision.

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_item( $request )   X-Ref
Retrieves one revision from the collection.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

delete_item_permissions_check( $request )   X-Ref
Checks if a given request has access to delete a revision.

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

delete_item( $request )   X-Ref
Deletes a single revision.

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

prepare_items_query( $prepared_args = array()   X-Ref
Determines the allowed query_vars for a get_items() response and prepares
them for WP_Query.

return: array Items query arguments.
param: array           $prepared_args Optional. Prepared WP_Query arguments. Default empty array.
param: WP_REST_Request $request       Optional. Full details about the request.

prepare_item_for_response( $item, $request )   X-Ref
Prepares the revision for the REST response.

return: WP_REST_Response Response object.
param: WP_Post         $item    Post revision object.
param: WP_REST_Request $request Request object.

prepare_date_response( $date_gmt, $date = null )   X-Ref
Checks the post_date_gmt or modified_gmt and prepare any post or
modified date for single post output.

return: string|null ISO8601/RFC3339 formatted datetime, otherwise null.
param: string      $date_gmt GMT publication time.
param: string|null $date     Optional. Local publication time. Default null.

get_item_schema()   X-Ref
Retrieves the revision's schema, conforming to JSON Schema.

return: array Item schema data.

get_collection_params()   X-Ref
Retrieves the query params for collections.

return: array Collection parameters.

prepare_excerpt_response( $excerpt, $post )   X-Ref
Checks the post excerpt and prepare it for single post output.

return: string Prepared excerpt or empty string.
param: string  $excerpt The post excerpt.
param: WP_Post $post    Post revision object.



Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref