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 / class-api.php
search-regex / includes / api Last commit date
route 3 weeks ago class-api.php 5 months ago class-route.php 5 months ago
class-api.php
46 lines
1 <?php
2
3 namespace SearchRegex\Api;
4
5 class Api {
6 const SEARCHREGEX_API_NAMESPACE = 'search-regex/v1';
7
8 /**
9 * Instance variable
10 */
11 private static ?Api $instance = null;
12
13 /**
14 * Array of endpoint routes
15 *
16 * @var Route[]
17 * @phpstan-ignore property.onlyWritten
18 */
19 private array $routes = [];
20
21 /**
22 * Create API
23 *
24 * @return Api
25 */
26 public static function init() {
27 if ( is_null( self::$instance ) ) {
28 self::$instance = new Api();
29 }
30
31 return self::$instance;
32 }
33
34 public function __construct() {
35 global $wpdb;
36
37 $wpdb->hide_errors();
38
39 $this->routes[] = new Route\Search_Route( self::SEARCHREGEX_API_NAMESPACE );
40 $this->routes[] = new Route\Source_Route( self::SEARCHREGEX_API_NAMESPACE );
41 $this->routes[] = new Route\Plugin_Route( self::SEARCHREGEX_API_NAMESPACE );
42 $this->routes[] = new Route\Settings_Route( self::SEARCHREGEX_API_NAMESPACE );
43 $this->routes[] = new Route\Preset_Route( self::SEARCHREGEX_API_NAMESPACE );
44 }
45 }
46