/** * Initialize and do all configuration then start booting */ public function initialize() { /** * Set Environment for Application * Example: * <code> * define('DEVELOPMENT_ENVIRONMENT', 'development'); * define('DEVELOPMENT_ENVIRONMENT', 'production'); * </code> */ define('MODE', Config::get('global.config', 'environment')); global $event; if (MODE == 'development') { ini_set('display_errors', 1); error_reporting(E_ALL); } else { ini_set('display_error', 0); error_reporting(0); } $event->trigger("exception"); /** *-------------------------------------------------- * Turn on application if profiling is on * in configuration *-------------------------------------------------- */ if (Config::get('global.config', 'enable_profiling') == true) { Profiler::start(); } /** -------------------------------------------------- * Set Cygnite user defined encryption key * --------------------------------------------------- */ if (!is_null(Config::get('global.config', 'cf_encryption_key')) || in_array('encrypt', Config::get('config.autoload', 'helpers')) == true) { define('CF_ENCRYPT_KEY', Config::get('global.config', 'cf_encryption_key')); } /**---------------------------------------------------------------- * Get Session config and set it here * ---------------------------------------------------------------- */ define('SECURE_SESSION', Config::get('config.session', 'cf_session')); /**---------------------------------------------------------------- * Auto load Session library based on user configurations * ---------------------------------------------------------------- */ if (SECURE_SESSION === true) { Session::instance(); } /**------------------------------------------------------------------ * Throw Exception is default controller * has not been set in configuration * ------------------------------------------------------------------ */ if (is_null(Config::get('global.config', "default_controller"))) { trigger_error("Default controller not found ! Please set the default\n\t\t\t\t\t\t\tcontroller in configs/application" . EXT); } }