From 8ffcc0dbe647637dc95886cd28382dd6c30f9da3 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 15 May 2018 14:22:59 +0300 Subject: [PATCH] define CONSTANTS in PHP7 style --- composer.json | 3 --- index.php | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 1c964138..cb5d897c 100755 --- a/composer.json +++ b/composer.json @@ -44,9 +44,6 @@ "autoload": { "classmap": [ "flextype" - ], - "files": [ - "flextype/boot/defines.php" ] } } diff --git a/index.php b/index.php index 39414efe..1585223b 100755 --- a/index.php +++ b/index.php @@ -15,6 +15,23 @@ namespace Flextype; // 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('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', + 'pages' => ROOT_DIR . '/site/pages', + 'blocks' => ROOT_DIR . '/site/blocks', + 'data' => ROOT_DIR . '/site/data', + 'config' => ROOT_DIR . '/site/config', + 'cache' => ROOT_DIR . '/site/cache', + 'accounts' => ROOT_DIR . '/site/accounts']); + +// Define the path to the logs directory (without trailing slash). +define('LOGS_PATH', PATH['site'] . '/logs'); + // 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 PHP %s to run.', $ver, $req)); @@ -24,5 +41,5 @@ version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(s // Register The Auto Loader $loader = require_once $autoload; -// Init Flextype +// Init Flextype Application Flextype::instance();