mirror of
https://git.sindominio.net/estibadores/wordpress.git
synced 2024-11-14 23:21:07 +01:00
39 lines
902 B
PHP
39 lines
902 B
PHP
|
<?php
|
||
|
|
||
|
require_once __DIR__ . '/api-base.php';
|
||
|
require_once __DIR__ . '/api-search.php';
|
||
|
require_once __DIR__ . '/api-settings.php';
|
||
|
require_once __DIR__ . '/api-plugin.php';
|
||
|
|
||
|
define( 'SEARCHREGEX_API_NAMESPACE', 'search-regex/v1' );
|
||
|
|
||
|
class Search_Regex_Api {
|
||
|
/** @var Search_Regex_Api|null */
|
||
|
private static $instance = null;
|
||
|
/** @var Array */
|
||
|
private $routes = array();
|
||
|
|
||
|
/**
|
||
|
* Create API
|
||
|
*
|
||
|
* @return Search_Regex_Api
|
||
|
*/
|
||
|
public static function init() {
|
||
|
if ( is_null( self::$instance ) ) {
|
||
|
self::$instance = new Search_Regex_Api();
|
||
|
}
|
||
|
|
||
|
return self::$instance;
|
||
|
}
|
||
|
|
||
|
public function __construct() {
|
||
|
global $wpdb;
|
||
|
|
||
|
$wpdb->hide_errors();
|
||
|
|
||
|
$this->routes[] = new Search_Regex_Api_Search( SEARCHREGEX_API_NAMESPACE );
|
||
|
$this->routes[] = new Search_Regex_Api_Plugin( SEARCHREGEX_API_NAMESPACE );
|
||
|
$this->routes[] = new Search_Regex_Api_Settings( SEARCHREGEX_API_NAMESPACE );
|
||
|
}
|
||
|
}
|