api-base.php
5 years ago
api-plugin.php
6 years ago
api-preset.php
5 years ago
api-replace.php
6 years ago
api-search.php
5 years ago
api-settings.php
6 years ago
api-source.php
5 years ago
api.php
5 years ago
api-plugin.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * 'Plugin' functions for Search Regex |
| 5 | */ |
| 6 | class Search_Regex_Api_Plugin extends Search_Regex_Api_Route { |
| 7 | /** |
| 8 | * Plugin API endpoint constructor |
| 9 | * |
| 10 | * @param String $namespace Namespace. |
| 11 | */ |
| 12 | public function __construct( $namespace ) { |
| 13 | register_rest_route( $namespace, '/plugin/test', array( |
| 14 | $this->get_route( WP_REST_Server::ALLMETHODS, 'route_test', [ $this, 'permission_callback' ] ), |
| 15 | ) ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Test the API |
| 20 | * |
| 21 | * @param WP_REST_Request $request Request. |
| 22 | * @return Array |
| 23 | */ |
| 24 | public function route_test( WP_REST_Request $request ) { |
| 25 | return array( |
| 26 | 'success' => true, |
| 27 | ); |
| 28 | } |
| 29 | } |
| 30 |