/** * Initializes the core. * * @throws \Exception */ public static function init() { // Set the CWD for usage in the shutdown function self::$cwd = getcwd(); // Set the core dir for when the loading of classes is required self::$coreDir = dirname(__DIR__); // If the environment is not yet defined, use production settings if (!defined('ENVIRONMENT')) { define('ENVIRONMENT', 'PRODUCTION'); } // Defines the time the framework starts. Used for timing functions in the framework if (!defined('STARTTIME')) { define('STARTTIME', microtime(true)); define('DS', DIRECTORY_SEPARATOR); } // Load basics ignore_user_abort(true); register_shutdown_function(array('\\FuzeWorks\\Core', 'shutdown')); // Load core functionality new Factory(); // Load the config file of the FuzeWorks core $config = Config::get('core'); // Disable events if requested to do so if (!$config->enable_events) { Events::disable(); } // Build all the registers for correct operation, if modules are enabled if ($config->enable_modules) { Modules::buildRegister($config->registry_caching, $config->registry_caching_method, $config->registry_caching_time); } // And fire the coreStartEvent $event = Events::fireEvent('coreStartEvent'); if ($event->isCancelled()) { return true; } // And initialize multiple classes Layout::init(); Language::init(); }