| 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_frontend = 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-widgets-controller.php', |
| 31 |
'class-lp-rest-addon-controller.php', |
| 32 |
'class-lp-rest-material-controller.php', |
| 33 |
'class-lp-rest-instructor-controller.php', |
| 34 |
'class-lp-rest-ajax-controller.php', |
| 35 |
'class-lp-rest-gateway-webhook-controller.php', |
| 36 |
); |
| 37 |
|
| 38 |
$path_version = $this->version . '/frontend/'; |
| 39 |
$path_rest_api = LP_PLUGIN_PATH . 'inc/rest-api/' . $path_version; |
| 40 |
|
| 41 |
foreach ( $list_rest_frontend as $rest_frontend ) { |
| 42 |
include_once realpath( $path_rest_api . $rest_frontend ); |
| 43 |
} |
| 44 |
|
| 45 |
do_action( 'learn-press/core-api/includes' ); |
| 46 |
} |
| 47 |
|
| 48 |
public function rest_api_register_routes() { |
| 49 |
$controllers = array( |
| 50 |
'LP_REST_Settings_Controller', |
| 51 |
'LP_REST_Users_Controller', |
| 52 |
'LP_REST_Courses_Controller', |
| 53 |
'LP_REST_Lazy_Load_Controller', |
| 54 |
'LP_REST_Profile_Controller', |
| 55 |
'LP_REST_Widgets_Controller', |
| 56 |
'LP_REST_Addon_Controller', |
| 57 |
'LP_Rest_Material_Controller', |
| 58 |
'LP_REST_Instructor_Controller', |
| 59 |
'LP_REST_AJAX_Controller', |
| 60 |
'LP_REST_Gateway_Webhook_Controller', |
| 61 |
); |
| 62 |
|
| 63 |
$this->controllers = apply_filters( 'learn-press/core-api/controllers', $controllers ); |
| 64 |
|
| 65 |
parent::rest_api_register_routes(); |
| 66 |
} |
| 67 |
} |
| 68 |
|