[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

REST API: WP_REST_Revisions_Controller class

File Size: 837 lines (25 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.

since: 4.7.0
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.

since: 4.7.0

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

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

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

since: 4.7.0
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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

since: 4.7.0
since: 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
param: WP_Post         $item    Post revision object.
param: WP_REST_Request $request Request object.
return: WP_REST_Response Response 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.

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

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

since: 4.7.0
return: array Item schema data.

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

since: 4.7.0
return: array Collection parameters.

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

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



Generated: Sun Oct 13 01:00:02 2024 Cross-referenced by PHPXref 0.7.1