PluginProbe ʕ •ᴥ•ʔ
Search Regex / trunk
Search Regex vtrunk
trunk 1.4.12 1.4.13 1.4.14 1.4.15 1.4.16 2.0 2.0.1 2.1 2.2 2.2.1 2.3 2.3.1 2.3.2 2.3.3 2.4 2.4.1 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1 3.1.1 3.1.2 3.2 3.3 3.3.0 3.3.1 3.4 3.4.1 3.4.2
search-regex / includes / api / route / class-plugin-route.php
search-regex / includes / api / route Last commit date
class-plugin-route.php 1 month ago class-preset-route.php 1 month ago class-search-route.php 1 month ago class-settings-route.php 1 month ago class-source-route.php 1 month ago
class-plugin-route.php
37 lines
1 <?php
2
3 namespace SearchRegex\Api\Route;
4
5 use SearchRegex\Api;
6 use WP_REST_Request;
7
8 /**
9 * 'Plugin' functions for Search Regex
10 */
11 class Plugin_Route extends Api\Route {
12 /**
13 * Plugin API endpoint constructor
14 *
15 * @param non-falsy-string $namespace Namespace.
16 */
17 public function __construct( $namespace ) {
18 register_rest_route(
19 $namespace, '/plugin/test', [
20 $this->get_route( \WP_REST_Server::ALLMETHODS, 'route_test', [ $this, 'permission_callback' ] ),
21 ]
22 );
23 }
24
25 /**
26 * Test the API
27 *
28 * @param WP_REST_Request<array<string, mixed>> $_request Request.
29 * @return array{success: bool}
30 */
31 public function route_test( WP_REST_Request $_request ) {
32 return [
33 'success' => true,
34 ];
35 }
36 }
37