| @@ 40-64 (lines=25) @@ | ||
| 37 | /** |
|
| 38 | * Register the routes for /system_status and /system_status/modes |
|
| 39 | */ |
|
| 40 | public function register_routes() { |
|
| 41 | register_rest_route( $this->namespace, '/' . $this->rest_base, array( |
|
| 42 | array( |
|
| 43 | 'methods' => WP_REST_Server::READABLE, |
|
| 44 | 'callback' => array( $this, 'get_items' ), |
|
| 45 | 'permission_callback' => array( $this, 'get_items_permissions_check' ), |
|
| 46 | 'args' => $this->get_collection_params(), |
|
| 47 | ), |
|
| 48 | 'schema' => array( $this, 'get_public_item_schema' ), |
|
| 49 | ) ); |
|
| 50 | register_rest_route( $this->namespace, '/' . $this->rest_base . '/modes', array( |
|
| 51 | array( |
|
| 52 | 'methods' => WP_REST_Server::READABLE, |
|
| 53 | 'callback' => array( $this, 'get_modes' ), |
|
| 54 | 'permission_callback' => array( $this, 'get_modes_permissions_check' ), |
|
| 55 | ), |
|
| 56 | array( |
|
| 57 | 'methods' => WP_REST_Server::EDITABLE, |
|
| 58 | 'callback' => array( $this, 'update_modes' ), |
|
| 59 | 'permission_callback' => array( $this, 'update_modes_permissions_check' ), |
|
| 60 | 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ), |
|
| 61 | ), |
|
| 62 | 'schema' => array( $this, 'get_mode_item_schema' ), |
|
| 63 | ) ); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Check whether a given request has permission to view system status. |
|
| @@ 40-65 (lines=26) @@ | ||
| 37 | /** |
|
| 38 | * Register the routes for /system_status/tools/*. |
|
| 39 | */ |
|
| 40 | public function register_routes() { |
|
| 41 | register_rest_route( $this->namespace, '/' . $this->rest_base, array( |
|
| 42 | array( |
|
| 43 | 'methods' => WP_REST_Server::READABLE, |
|
| 44 | 'callback' => array( $this, 'get_items' ), |
|
| 45 | 'permission_callback' => array( $this, 'get_items_permissions_check' ), |
|
| 46 | 'args' => $this->get_collection_params(), |
|
| 47 | ), |
|
| 48 | 'schema' => array( $this, 'get_public_item_schema' ), |
|
| 49 | ) ); |
|
| 50 | ||
| 51 | register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<id>[\w-]+)', array( |
|
| 52 | array( |
|
| 53 | 'methods' => WP_REST_Server::READABLE, |
|
| 54 | 'callback' => array( $this, 'get_item' ), |
|
| 55 | 'permission_callback' => array( $this, 'get_item_permissions_check' ), |
|
| 56 | ), |
|
| 57 | array( |
|
| 58 | 'methods' => WP_REST_Server::EDITABLE, |
|
| 59 | 'callback' => array( $this, 'update_item' ), |
|
| 60 | 'permission_callback' => array( $this, 'update_item_permissions_check' ), |
|
| 61 | 'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ), |
|
| 62 | ), |
|
| 63 | 'schema' => array( $this, 'get_public_item_schema' ), |
|
| 64 | ) ); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Check whether a given request has permission to view system status tools. |
|