From 2b78a545715bad13c31be05f63001fc8aa9ef40b Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 17 Dec 2020 10:03:56 +0300 Subject: [PATCH] feat(core): Rest API endpoints should includes after plugins initialisation. #506 --- src/flextype/bootstrap.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/flextype/bootstrap.php b/src/flextype/bootstrap.php index 39b3bce3..7765d0fe 100755 --- a/src/flextype/bootstrap.php +++ b/src/flextype/bootstrap.php @@ -118,17 +118,6 @@ flextype('session')->setOptions(flextype('registry')->get('flextype.settings.ses */ flextype('session')->start(); -/** - * Include API ENDPOINTS - */ -include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/files.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/folders.php'; -include_once ROOT_DIR . '/src/flextype/Endpoints/images.php'; - /** * Set internal encoding */ @@ -180,6 +169,19 @@ foreach ($entryFields as $fieldName => $field) { */ flextype('plugins')->init(); +/** + * Include API ENDPOINTS + */ +if (flextype()->isApiRequest()) { + include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/files.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/folders.php'; + include_once ROOT_DIR . '/src/flextype/Endpoints/images.php'; +} + /** * Enable lazy CORS *