示例#1
0
 /**
  * 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);
     }
 }
示例#2
0
function show($resultArray = array(), $hasExit = "")
{
    echo '<pre>';
    print_r($resultArray);
    echo '</pre>';
    if ($hasExit === 'exit') {
        exit;
    }
}
global $event;
//create Event handler to attach all events
$event = new Event();
$event->attach("exception", '\\Cygnite\\Exception\\Handler@handleException');
$config = array();
//Get the configuration variables.
$config = array('app' => Config::load(), 'event' => $event);
//unset($config);
//Load application and Get application instance to boot up
$application = Application::instance(function ($app) use($config) {
    /**
     *---------------------------------------------------
     * Set Configurations and Events for boot-up process
     * --------------------------------------------------
     */
    return $app->setConfiguration($config)->boot();
});
//Response to browser
$application->run();
if (Config::get('global.config', 'enable_profiling') == true) {
    Profiler::end();
}