PHP Class WC_REST_System_Status_Tools_Controller

Inheritance: extends WC_REST_Controller
显示文件 Open project: woocommerce/woocommerce Class Usage Examples

Protected Properties

Property Type Description
$namespace string Endpoint namespace.
$rest_base string Route base.

Public Methods

Method Description
execute_tool ( string $tool ) : array Actually executes a a tool.
get_collection_params ( ) : array Get any query params needed.
get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Return a single tool.
get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Check whether a given request has permission to view a specific system status tool.
get_item_schema ( ) : array Get the system status tools schema, conforming to JSON Schema.
get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Get a list of system status tools.
get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Check whether a given request has permission to view system status tools.
get_tools ( ) : array A list of avaiable tools for use in the system status section.
prepare_item_for_response ( array $item, WP_REST_Request $request ) : WP_REST_Response Prepare a tool item for serialization.
register_routes ( ) Register the routes for /system_status/tools/*.
update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response Update (execute) a tool.
update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Check whether a given request has permission to execute a specific system status tool.

Protected Methods

Method Description
prepare_links ( string $id ) : array Prepare links for the request.

Method Details

execute_tool() public method

Actually executes a a tool.
public execute_tool ( string $tool ) : array
$tool string
return array

get_collection_params() public method

Get any query params needed.
public get_collection_params ( ) : array
return array

get_item() public method

Return a single tool.
public get_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request
return WP_Error | WP_REST_Response

get_item_permissions_check() public method

Check whether a given request has permission to view a specific system status tool.
public get_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
return WP_Error | boolean

get_item_schema() public method

Get the system status tools schema, conforming to JSON Schema.
public get_item_schema ( ) : array
return array

get_items() public method

Get a list of system status tools.
public get_items ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request Full details about the request.
return WP_Error | WP_REST_Response

get_items_permissions_check() public method

Check whether a given request has permission to view system status tools.
public get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
return WP_Error | boolean

get_tools() public method

'button' becomes 'action' in the API.
public get_tools ( ) : array
return array

prepare_item_for_response() public method

Prepare a tool item for serialization.
public prepare_item_for_response ( array $item, WP_REST_Request $request ) : WP_REST_Response
$item array Object.
$request WP_REST_Request Request object.
return WP_REST_Response $response Response data.

register_routes() public method

Register the routes for /system_status/tools/*.
public register_routes ( )

update_item() public method

Update (execute) a tool.
public update_item ( WP_REST_Request $request ) : WP_Error | WP_REST_Response
$request WP_REST_Request
return WP_Error | WP_REST_Response

update_item_permissions_check() public method

Check whether a given request has permission to execute a specific system status tool.
public update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full details about the request.
return WP_Error | boolean

Property Details

$namespace protected_oe property

Endpoint namespace.
protected string $namespace
return string

$rest_base protected_oe property

Route base.
protected string $rest_base
return string