mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
fix(core): fix issue with Rest API endpoints detection. #522
BREAKING CHANGES - method isApiRequest() removed.
This commit is contained in:
@@ -88,16 +88,6 @@ final class Flextype extends App
|
||||
return self::$instances[$cls];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine API Request
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isApiRequest(): bool
|
||||
{
|
||||
return explode('/', Uri::createFromEnvironment(new Environment($_SERVER))->getPath())[0] === 'api';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current Flextype version
|
||||
*/
|
||||
|
@@ -57,7 +57,6 @@ $flextype = Flextype::getInstance([
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* Display Errors
|
||||
*/
|
||||
@@ -172,14 +171,12 @@ 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/media.php';
|
||||
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
|
||||
}
|
||||
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/media.php';
|
||||
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
|
||||
|
||||
/**
|
||||
* Enable lazy CORS
|
||||
@@ -190,6 +187,11 @@ if (flextype()->isApiRequest()) {
|
||||
*/
|
||||
flextype('cors')->init();
|
||||
|
||||
/**
|
||||
* Run high priority event: onFlextypeBeforeRun before Flextype Application starts.
|
||||
*/
|
||||
flextype('emitter')->emit('onFlextypeBeforeRun');
|
||||
|
||||
/**
|
||||
* Run application
|
||||
*/
|
||||
|
Reference in New Issue
Block a user