/** * Init JaguarEngine * @param Integer $mode The engine mode * @access Public * @return Boolean */ public static function init(int $mode = 0) : bool { // Remove headers header_remove('X-Powered-By'); header_remove('Server'); /** * Mode Setup */ self::$mode = $mode; // Development Setup if (self::$mode === self::MODE_DEVELOPMENT) { // Enable the error reporting error_reporting(-1); ini_set('display_errors', 'on'); // Disable the OPCACHE plugin $opVars = opcache_get_configuration(); if ($opVars['directives']['opcache.enable'] == true) { opcache_reset(); } } // Production Setup if (self::$mode === self::MODE_PRODUCTION) { // Disable error reporting error_reporting(0); ini_set('display_errors', 'off'); } // Initialisation self::setDefines(); self::addFiles(); self::setupEventSystem(); // Setup error handling set_exception_handler(array('JEError', 'handleException')); set_error_handler(array('JEError', 'handleError')); register_shutdown_function(array('JEError', 'handleFatal')); // Register tests if (self::getFlag(self::FLAG_USE_VALIDATOR)) { JEValidate::register('email', new JETestEmail()); JEValidate::register('id', new JETestID()); } return true; }