Delivery setup
This commit is contained in:
@@ -8,12 +8,41 @@
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* API class
|
||||
*/
|
||||
class Wiaas_API {
|
||||
|
||||
public static function init() {
|
||||
|
||||
if ( ! class_exists( 'WP_REST_Server' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::_rest_api_includes();
|
||||
|
||||
// Init REST API routes.
|
||||
add_action( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ), 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include REST API classes
|
||||
*/
|
||||
private function rest_api_includes() {
|
||||
private static function _rest_api_includes() {
|
||||
|
||||
#Delivery process controller
|
||||
include_once dirname( __FILE__ ) . '/api/class-wiaas-rest-delivery-process-api.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function register_rest_routes() {
|
||||
$controllers = array(
|
||||
'Wiass_REST_Delivery_Process_API'
|
||||
);
|
||||
|
||||
foreach ( $controllers as $controller ) {
|
||||
call_user_func(array($controller, 'register_routes'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Wiaas_API::init();
|
||||
Reference in New Issue
Block a user