PluginProbe
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more / trunk
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more vtrunk
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.php

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

55 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Texty;
4
5 /**
6 * Manager Class
7 */
8 class Api {
9
10 /**
11 * All API Classes
12 *
13 * @var array
14 */
15 protected $classes;
16
17 /**
18 * Initialize
19 */
20 public function __construct() {
21 $this->classes = [
22 Api\Settings::class,
23 Api\Notifications::class,
24 Api\NotificationSettings::class,
25 Api\Tools::class,
26 Api\Status::class,
27 Api\Send::class,
28 Api\Metrics::class,
29 Api\SettingsController::class,
30 Api\Gateway::class,
31 Api\Logs::class,
32 ];
33
34 add_action( 'rest_api_init', [ $this, 'init_api' ] );
35 }
36
37 /**
38 * Register APIs
39 *
40 * @return void
41 */
42 public function init_api() {
43 $classes = apply_filters( 'texty_rest_api_class_map', $this->classes );
44
45 foreach ( $classes as $class ) {
46 $object = new $class();
47 // check if object is instance of WP_REST_Controller
48 if ( ! is_a( $object, 'WP_REST_Controller' ) ) {
49 continue;
50 }
51 $object->register_routes();
52 }
53 }
54 }
55