| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\App\Modules\ImportExportCustomization\Data; |
| 4 |
|
| 5 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Export; |
| 6 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Import; |
| 7 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Import_Runner; |
| 8 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Manager_Url; |
| 9 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Process_Media; |
| 10 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Revert; |
| 11 |
use Elementor\App\Modules\ImportExportCustomization\Data\Routes\Upload; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; // Exit if accessed directly. |
| 15 |
} |
| 16 |
|
| 17 |
class Controller { |
| 18 |
const API_NAMESPACE = 'elementor/v1'; |
| 19 |
const API_BASE = 'import-export-customization'; |
| 20 |
|
| 21 |
public static function register_hooks() { |
| 22 |
add_action( 'rest_api_init', fn() => self::register_routes() ); |
| 23 |
} |
| 24 |
|
| 25 |
public static function get_base_url() { |
| 26 |
return get_rest_url() . self::API_NAMESPACE . '/' . self::API_BASE; |
| 27 |
} |
| 28 |
|
| 29 |
private static function register_routes() { |
| 30 |
( new Export() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 31 |
( new Import() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 32 |
( new Import_Runner() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 33 |
( new Manager_Url() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 34 |
( new Process_Media() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 35 |
( new Revert() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 36 |
( new Upload() )->register_route( self::API_NAMESPACE, self::API_BASE ); |
| 37 |
} |
| 38 |
} |
| 39 |
|