PluginProbe
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more / 2.0.0
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more v2.0.0
2.0.2 trunk 0.2 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 2.0.0 2.0.1
texty / includes / Api / Status.php

Status.php in Texty – SMS Notification for WordPress, WooCommerce, Dokan and more 2.0.0, at includes/Api/Status.php

56 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Texty\Api;
4
5 use WP_REST_Server;
6
7 class Status extends Base {
8
9 /**
10 * Initialize
11 *
12 * @return void
13 */
14 public function __construct() {
15 $this->namespace = 'texty/v1';
16 $this->rest_base = 'status';
17 }
18
19 /**
20 * Registers the routes for the objects of the controller.
21 *
22 * @return void
23 */
24 public function register_routes() {
25 register_rest_route(
26 $this->namespace,
27 '/' . $this->rest_base,
28 [
29 [
30 'methods' => WP_REST_Server::READABLE,
31 'callback' => [ $this, 'status' ],
32 'permission_callback' => [ $this, 'admin_permissions_check' ],
33 'args' => [],
34 ],
35 ]
36 );
37 }
38
39 /*
40 * Send a test.
41 *
42 * @param WP_Rest_Request $request
43 *
44 * @return WP_Rest_Response|WP_Error
45 */
46 public function status( $request ) {
47 $gateway = texty()->settings()->gateway();
48
49 $response = [
50 'success' => $gateway ? true : false,
51 ];
52
53 return rest_ensure_response( $response );
54 }
55 }
56