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

param: string $parent_post_type Post type of the parent.
since: 4.7.0

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.

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

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

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

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

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

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

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

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

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

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.
since: 4.7.0
since: 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.

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

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

return: array Item schema data.
since: 4.7.0

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

return: array Collection parameters.
since: 4.7.0

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



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1