| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class LP_Core_API |
| 4 |
* |
| 5 |
* @author Thimpress |
| 6 |
* @editor tungnx, nhamdv |
| 7 |
* @version 1.0.1 |
| 8 |
* @since 4.0.0 |
| 9 |
*/ |
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
class LP_Core_API extends LP_Abstract_API { |
| 13 |
public function __construct() { |
| 14 |
|
| 15 |
parent::__construct(); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Includes files |
| 20 |
*/ |
| 21 |
public function rest_api_includes() { |
| 22 |
parent::rest_api_includes(); |
| 23 |
|
| 24 |
$list_rest_fontend = array( |
| 25 |
'class-lp-rest-settings-controller.php', |
| 26 |
'class-lp-rest-users-controller.php', |
| 27 |
'class-lp-rest-courses-controller.php', |
| 28 |
'class-lp-rest-lazy-load-controller.php', |
| 29 |
'class-lp-rest-profile-controller.php', |
| 30 |
'class-lp-rest-orders-controller.php', |
| 31 |
'class-lp-rest-widgets-controller.php', |
| 32 |
); |
| 33 |
|
| 34 |
$path_version = $this->version . '/frontend/'; |
| 35 |
$path_rest_api = LP_PLUGIN_PATH . 'inc/rest-api/' . $path_version; |
| 36 |
|
| 37 |
foreach ( $list_rest_fontend as $rest_frontend ) { |
| 38 |
include_once realpath( $path_rest_api . $rest_frontend ); |
| 39 |
} |
| 40 |
|
| 41 |
do_action( 'learn-press/core-api/includes' ); |
| 42 |
} |
| 43 |
|
| 44 |
public function rest_api_register_routes() { |
| 45 |
$controllers = array( |
| 46 |
'LP_REST_Settings_Controller', |
| 47 |
'LP_REST_Users_Controller', |
| 48 |
'LP_REST_Courses_Controller', |
| 49 |
'LP_REST_Lazy_Load_Controller', |
| 50 |
'LP_REST_Profile_Controller', |
| 51 |
'LP_REST_Orders_Controller', |
| 52 |
'LP_REST_Widgets_Controller', |
| 53 |
); |
| 54 |
|
| 55 |
$this->controllers = apply_filters( 'learn-press/core-api/controllers', $controllers ); |
| 56 |
|
| 57 |
parent::rest_api_register_routes(); |
| 58 |
} |
| 59 |
} |
| 60 |
|