PHP Класс WP_REST_Revisions_Controller, wordpress

Наследование: extends WP_REST_Controller
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $parent_post_type ) Constructor.
delete_item ( WP_REST_Request $request ) : true | WP_Error Deletes a single revision.
delete_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a given request has access to delete a revision.
get_collection_params ( ) : array Retrieves the query params for collections.
get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Retrieves one revision from the collection.
get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error Checks if a given request has access to get a specific revision.
get_item_schema ( ) : array Retrieves the revision's schema, conforming to JSON Schema.
get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error Gets a collection of revisions.
get_items_permissions_check ( WP_REST_Request $request ) : true | WP_Error Checks if a given request has access to get revisions.
prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response Prepares the revision for the REST response.
register_routes ( ) Registers routes for revisions based on post types supporting revisions.

Защищенные методы

Метод Описание
prepare_date_response ( string $date_gmt, string | null $date = null ) : string | null Checks the post_date_gmt or modified_gmt and prepare any post or modified date for single post output.
prepare_excerpt_response ( string $excerpt, WP_Post $post ) : string Checks the post excerpt and prepare it for single post output.

Описание методов

__construct() публичный Метод

Constructor.
С версии: 4.7.0
public __construct ( string $parent_post_type )
$parent_post_type string Post type of the parent.

delete_item() публичный Метод

Deletes a single revision.
С версии: 4.7.0
public delete_item ( WP_REST_Request $request ) : true | WP_Error
$request WP_REST_Request Full details about the request.
Результат true | WP_Error True on success, or WP_Error object on failure.

delete_item_permissions_check() публичный Метод

Checks if a given request has access to delete a revision.
С версии: 4.7.0
public delete_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full details about the request.
Результат boolean | WP_Error True if the request has access to delete the item, WP_Error object otherwise.

get_collection_params() публичный Метод

Retrieves the query params for collections.
С версии: 4.7.0
public get_collection_params ( ) : array
Результат array Collection parameters.

get_item() публичный Метод

Retrieves one revision from the collection.
С версии: 4.7.0
public get_item ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full data about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

get_item_permissions_check() публичный Метод

Checks if a given request has access to get a specific revision.
С версии: 4.7.0
public get_item_permissions_check ( WP_REST_Request $request ) : boolean | WP_Error
$request WP_REST_Request Full data about the request.
Результат boolean | WP_Error True if the request has read access for the item, WP_Error object otherwise.

get_item_schema() публичный Метод

Retrieves the revision's schema, conforming to JSON Schema.
С версии: 4.7.0
public get_item_schema ( ) : array
Результат array Item schema data.

get_items() публичный Метод

Gets a collection of revisions.
С версии: 4.7.0
public get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error
$request WP_REST_Request Full data about the request.
Результат WP_REST_Response | WP_Error Response object on success, or WP_Error object on failure.

get_items_permissions_check() публичный Метод

Checks if a given request has access to get revisions.
С версии: 4.7.0
public get_items_permissions_check ( WP_REST_Request $request ) : true | WP_Error
$request WP_REST_Request Full data about the request.
Результат true | WP_Error True if the request has read access, WP_Error object otherwise.

prepare_date_response() защищенный Метод

Checks the post_date_gmt or modified_gmt and prepare any post or modified date for single post output.
С версии: 4.7.0
protected prepare_date_response ( string $date_gmt, string | null $date = null ) : string | null
$date_gmt string GMT publication time.
$date string | null Optional. Local publication time. Default null.
Результат string | null ISO8601/RFC3339 formatted datetime, otherwise null.

prepare_excerpt_response() защищенный Метод

Checks the post excerpt and prepare it for single post output.
С версии: 4.7.0
protected prepare_excerpt_response ( string $excerpt, WP_Post $post ) : string
$excerpt string The post excerpt.
$post WP_Post Post revision object.
Результат string Prepared excerpt or empty string.

prepare_item_for_response() публичный Метод

Prepares the revision for the REST response.
С версии: 4.7.0
public prepare_item_for_response ( WP_Post $post, WP_REST_Request $request ) : WP_REST_Response
$post WP_Post Post revision object.
$request WP_REST_Request Request object.
Результат WP_REST_Response Response object.

register_routes() публичный Метод

Registers routes for revisions based on post types supporting revisions.
См. также: register_rest_route()
С версии: 4.7.0
public register_routes ( )