芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/wp-statistics/src/Abstracts/BaseRestAPI.php
endpoint) { return; } register_rest_route($this->namespace, '/' . $this->endpoint, [ [ 'methods' => $this->method, 'callback' => [$this, 'handle'], 'args' => $this->getArgs(), 'permission_callback' => [$this, 'permissionCallback'], ], ]); } /** * Permission callback for the REST API endpoint. * * @param WP_REST_Request $request The REST API request object. * @return true|WP_Error Returns true if the request is authorized, or WP_Error if not. */ public function permissionCallback(WP_REST_Request $request) { return true; } /** * Define expected request parameters for this endpoint. * * Should be overridden by child classes to validate input. * * @return array List of REST parameter definitions. * @see https://developer.wordpress.org/rest-api/extending-the-rest-api/#arguments */ protected function getArgs() { return []; } /** * Get the REST API endpoint slug. * * @return string */ public function getEndpoint() { return $this->endpoint; } /** * Handle the REST API request. * * Subclasses must implement this to provide the actual * endpoint behavior. * * @param WP_REST_Request $request The incoming REST request. * * @return WP_REST_Response * @throws Exception */ abstract public function handle(WP_REST_Request $request); }