PHP Class Jetpack_Core_API_Module_Toggle_Endpoint, jetpack

Inheritance: extends Jetpack_Core_API_XMLRPC_Consumer_Endpoint
Datei anzeigen Open project: automattic/jetpack Class Usage Examples

Public Methods

Method Description
activate_module ( string | WP_REST_Request $data ) : boolean | WP_Error If it's a valid Jetpack module, activate it.
can_request ( ) : boolean Check that the current user has permissions to manage Jetpack modules.
deactivate_module ( string | WP_REST_Request $data ) : boolean | WP_Error If it's a valid Jetpack module, deactivate it.
process ( WP_REST_Request $data ) : WP_REST_Response | WP_Error Check if the module requires the site to be publicly accessible from WPCOM.

Method Details

activate_module() public method

If it's a valid Jetpack module, activate it.
Since: 4.3.0
public activate_module ( string | WP_REST_Request $data ) : boolean | WP_Error
$data string | WP_REST_Request { Array of parameters received by request. @type string $slug Module slug. }
return boolean | WP_Error True if module was activated. Otherwise, a WP_Error instance with the corresponding error.

can_request() public method

Check that the current user has permissions to manage Jetpack modules.
Since: 4.3.0
public can_request ( ) : boolean
return boolean

deactivate_module() public method

If it's a valid Jetpack module, deactivate it.
Since: 4.3.0
public deactivate_module ( string | WP_REST_Request $data ) : boolean | WP_Error
$data string | WP_REST_Request { Array of parameters received by request. @type string $slug Module slug. }
return boolean | WP_Error True if module was activated. Otherwise, a WP_Error instance with the corresponding error.

process() public method

If the site meets this requirement, the module is activated. Otherwise an error is returned.
Since: 4.3.0
public process ( WP_REST_Request $data ) : WP_REST_Response | WP_Error
$data WP_REST_Request { Array of parameters received by request. @type string $slug Module slug. @type bool $active should module be activated. }
return WP_REST_Response | WP_Error A REST response if the request was served successfully, otherwise an error.