PHP 클래스 WP_REST_Comments_Controller, wordpress

상속: extends WP_REST_Controller
파일 보기 프로젝트 열기: johnpbloch/wordpress 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$meta WP_REST_Comment_Meta_Fields Instance of a comment meta fields object.

공개 메소드들

메소드 설명
__construct ( ) Constructor.
create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Creates a comment.
create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Checks if a given request has access to create a comment.
delete_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Deletes a comment.
delete_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Checks if a given request has access to delete a comment.
get_collection_params ( ) : array Retrieves the query params for collections.
get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Retrieves a comment.
get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Checks if a given request has access to read the comment.
get_item_schema ( ) : array Retrieves the comment's schema, conforming to JSON Schema.
get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Retrieves a list of comment items.
get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Checks if a given request has access to read comments.
prepare_item_for_response ( WP_Comment $comment, WP_REST_Request $request ) : WP_REST_Response Prepares a single comment output for response.
register_routes ( ) Registers the routes for the objects of the controller.
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Updates a comment.
update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Checks if a given REST request has access to update a comment.

보호된 메소드들

메소드 설명
check_edit_permission ( object $comment ) : boolean Checks if a comment can be edited or deleted.
check_read_permission ( WP_Comment $comment, WP_REST_Request $request ) : boolean Checks if the comment can be read.
check_read_post_permission ( WP_Post $post, WP_REST_Request $request ) : boolean Checks if the post can be read.
handle_status_param ( string | integer $new_status, integer $comment_id ) : boolean Sets the comment_status of a given comment object when creating or updating a comment.
normalize_query_param ( string $query_param ) : string Prepends internal property prefix to query parameters to match our response fields.
prepare_item_for_database ( WP_REST_Request $request ) : array | WP_Error Prepares a single comment to be inserted into the database.
prepare_links ( WP_Comment $comment ) : array Prepares links for the request.
prepare_status_response ( string | integer $comment_approved ) : string Checks comment_approved to set comment status for single comment output.

메소드 상세

__construct() 공개 메소드

Constructor.
부터: 4.7.0
public __construct ( )

check_edit_permission() 보호된 메소드

Checks if a comment can be edited or deleted.
부터: 4.7.0
protected check_edit_permission ( object $comment ) : boolean
$comment object Comment object.
리턴 boolean Whether the comment can be edited or deleted.

check_read_permission() 보호된 메소드

Checks if the comment can be read.
부터: 4.7.0
protected check_read_permission ( WP_Comment $comment, WP_REST_Request $request ) : boolean
$comment WP_Comment Comment object.
$request WP_REST_Request Request data to check.
리턴 boolean Whether the comment can be read.

check_read_post_permission() 보호된 메소드

Correctly handles posts with the inherit status.
부터: 4.7.0
protected check_read_post_permission ( WP_Post $post, WP_REST_Request $request ) : boolean
$post WP_Post Post object.
$request WP_REST_Request Request data to check.
리턴 boolean Whether post can be read.

create_item() 공개 메소드

Creates a comment.
부터: 4.7.0
public create_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response Response object on success, or error object on failure.

create_item_permissions_check() 공개 메소드

Checks if a given request has access to create a comment.
부터: 4.7.0
public create_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
리턴 WP_Error | boolean True if the request has access to create items, error object otherwise.

delete_item() 공개 메소드

Deletes a comment.
부터: 4.7.0
public delete_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response Response object on success, or error object on failure.

delete_item_permissions_check() 공개 메소드

Checks if a given request has access to delete a comment.
부터: 4.7.0
public delete_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
리턴 WP_Error | boolean True if the request has access to delete the item, error object otherwise.

get_collection_params() 공개 메소드

Retrieves the query params for collections.
부터: 4.7.0
public get_collection_params ( ) : array
리턴 array Comments collection parameters.

get_item() 공개 메소드

Retrieves a comment.
부터: 4.7.0
public get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response Response object on success, or error object on failure.

get_item_permissions_check() 공개 메소드

Checks if a given request has access to read the comment.
부터: 4.7.0
public get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
리턴 WP_Error | boolean True if the request has read access for the item, error object otherwise.

get_item_schema() 공개 메소드

Retrieves the comment's schema, conforming to JSON Schema.
부터: 4.7.0
public get_item_schema ( ) : array
리턴 array

get_items() 공개 메소드

Retrieves a list of comment items.
부터: 4.7.0
public get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response Response object on success, or error object on failure.

get_items_permissions_check() 공개 메소드

Checks if a given request has access to read comments.
부터: 4.7.0
public get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
리턴 WP_Error | boolean True if the request has read access, error object otherwise.

handle_status_param() 보호된 메소드

Sets the comment_status of a given comment object when creating or updating a comment.
부터: 4.7.0
protected handle_status_param ( string | integer $new_status, integer $comment_id ) : boolean
$new_status string | integer New comment status.
$comment_id integer Comment ID.
리턴 boolean Whether the status was changed.

normalize_query_param() 보호된 메소드

Prepends internal property prefix to query parameters to match our response fields.
부터: 4.7.0
protected normalize_query_param ( string $query_param ) : string
$query_param string Query parameter.
리턴 string The normalized query parameter.

prepare_item_for_database() 보호된 메소드

Prepares a single comment to be inserted into the database.
부터: 4.7.0
protected prepare_item_for_database ( WP_REST_Request $request ) : array | WP_Error
$request WP_REST_Request Request object.
리턴 array | WP_Error Prepared comment, otherwise WP_Error object.

prepare_item_for_response() 공개 메소드

Prepares a single comment output for response.
부터: 4.7.0
public prepare_item_for_response ( WP_Comment $comment, WP_REST_Request $request ) : WP_REST_Response
$comment WP_Comment Comment object.
$request WP_REST_Request Request object.
리턴 WP_REST_Response Response object.

prepare_status_response() 보호된 메소드

Checks comment_approved to set comment status for single comment output.
부터: 4.7.0
protected prepare_status_response ( string | integer $comment_approved ) : string
$comment_approved string | integer comment status.
리턴 string Comment status.

register_routes() 공개 메소드

Registers the routes for the objects of the controller.
부터: 4.7.0
public register_routes ( )

update_item() 공개 메소드

Updates a comment.
부터: 4.7.0
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
리턴 WP_Error | WP_REST_Response Response object on success, or error object on failure.

update_item_permissions_check() 공개 메소드

Checks if a given REST request has access to update a comment.
부터: 4.7.0
public update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
리턴 WP_Error | boolean True if the request has access to update the item, error object otherwise.

프로퍼티 상세

$meta 보호되어 있는 프로퍼티

Instance of a comment meta fields object.
부터: 4.7.0
protected WP_REST_Comment_Meta_Fields $meta
리턴 WP_REST_Comment_Meta_Fields