1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-05 04:37:43 +02:00

Flextype Core: General fixes and refactoring #117

This commit is contained in:
Awilum
2019-06-11 21:18:18 +03:00
parent e3e66e6ca7
commit bd1d938a60

View File

@@ -12,36 +12,57 @@
namespace Flextype;
// Define the application minimum supported PHP version.
/**
* Define the application minimum supported PHP version.
*/
define('FLEXTYPE_MINIMUM_PHP', '7.1.3');
// Define the path to the root directory (without trailing slash).
/**
* Define the PATH to the root directory (without trailing slash).
*/
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
// Define the PATH (without trailing slash).
define('PATH', ['site' => ROOT_DIR . '/site',
'plugins' => ROOT_DIR . '/site/plugins',
'themes' => ROOT_DIR . '/site/themes',
'entries' => ROOT_DIR . '/site/entries',
'snippets' => ROOT_DIR . '/site/snippets',
'menus' => ROOT_DIR . '/site/menus',
'config' => [
/**
* Define the PATH (without trailing slash).
*/
define('PATH', ['site' => ROOT_DIR . '/site',
'plugins' => ROOT_DIR . '/site/plugins',
'themes' => ROOT_DIR . '/site/themes',
'entries' => ROOT_DIR . '/site/entries',
'snippets' => ROOT_DIR . '/site/snippets',
'fieldsets' => ROOT_DIR . '/site/fieldsets',
'config' => [
'default' => ROOT_DIR . '/flextype/config',
'site' => ROOT_DIR . '/site/config'
],
'cache' => ROOT_DIR . '/site/cache']);
'cache' => ROOT_DIR . '/site/cache']);
// Define the path to the logs directory (without trailing slash).
define('LOGS_PATH', PATH['site'] . '/logs');
// Check PHP Version
/**
* Check PHP Version
*/
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
// Ensure vendor libraries exist
/**
* Ensure vendor libraries exist
*/
!is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit("Please run: <i>composer install</i>");
// Register The Auto Loader
/**
* Register The Auto Loader
*
* Composer provides a convenient, automatically generated class loader for
* our application. We just need to utilize it! We'll simply require it
* into the script here so that we don't have to worry about manual
* loading any of our classes later on. It feels nice to relax.
* Register The Auto Loader
*/
$loader = require_once $autoload;
// Get Flextype Bootstrap
/**
* Bootstraps the Flextype
*
* This bootstraps the Flextype and gets it ready for use, then it
* will load up this application so that we can run it and send
* the responses back to the browser and delight our users.
*/
include 'flextype/bootstrap.php';