| 1 |
<?php |
| 2 |
|
| 3 |
class Redirection_Api { |
| 4 |
/** |
| 5 |
* @var Redirection_Api|null |
| 6 |
*/ |
| 7 |
private static $instance = null; |
| 8 |
|
| 9 |
/** |
| 10 |
* @var array<int, Redirection_Api_Route> |
| 11 |
* @phpstan-ignore property.onlyWritten |
| 12 |
*/ |
| 13 |
private $routes = array(); |
| 14 |
|
| 15 |
/** |
| 16 |
* @return Redirection_Api |
| 17 |
*/ |
| 18 |
public static function init() { |
| 19 |
if ( is_null( self::$instance ) ) { |
| 20 |
self::$instance = new Redirection_Api(); |
| 21 |
} |
| 22 |
|
| 23 |
return self::$instance; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* @return void |
| 28 |
*/ |
| 29 |
public function __construct() { |
| 30 |
global $wpdb; |
| 31 |
|
| 32 |
$wpdb->hide_errors(); |
| 33 |
|
| 34 |
$this->routes[] = new Redirection_Api_Redirect( REDIRECTION_API_NAMESPACE ); |
| 35 |
$this->routes[] = new Redirection_Api_Group( REDIRECTION_API_NAMESPACE ); |
| 36 |
$this->routes[] = new Redirection_Api_Log( REDIRECTION_API_NAMESPACE ); |
| 37 |
$this->routes[] = new Redirection_Api_404( REDIRECTION_API_NAMESPACE ); |
| 38 |
$this->routes[] = new Redirection_Api_Settings( REDIRECTION_API_NAMESPACE ); |
| 39 |
$this->routes[] = new Redirection_Api_Plugin( REDIRECTION_API_NAMESPACE ); |
| 40 |
$this->routes[] = new Redirection_Api_Import( REDIRECTION_API_NAMESPACE ); |
| 41 |
$this->routes[] = new Redirection_Api_Export( REDIRECTION_API_NAMESPACE ); |
| 42 |
} |
| 43 |
} |
| 44 |
|