Exemple #1
0
 /**
  * Bootstrap the application and
  * call the other bootstrap classes
  * from the projects (if they exist)
  *
  * @return self
  */
 public function bootstrap($environment = Application::ENVIRONMENT_WEB)
 {
     static::$environment = $environment;
     // Setup application
     $this->setup();
     try {
         Buffer::start();
         // Call own bootstrap
         (new Bootstrap($this))->autoCall();
         // Call bootstrap of active project
         $project = ProjectManager::getActiveProject();
         if ($project) {
             // Save it in case for further use
             $bootstrap = $project->bootstrap($this);
         }
     } catch (\Exception $err) {
         switch (static::$environment) {
             case Application::ENVIRONMENT_WEB:
                 self::renderException(array($err));
                 break;
             case Application::ENVIRONMENT_CMD:
                 throw $err;
                 break;
         }
     }
     return $this;
 }
Exemple #2
0
    ob_end_clean();
}
ob_start();
if (Router::getAction()) {
    extract(Router::getParameters());
    require Router::getAction();
}
if (ob_get_contents()) {
    ob_end_flush();
    trigger_error('MindaPHP action "' . Router::getAction() . '" should not send output. Error raised ', E_USER_WARNING);
} else {
    ob_end_clean();
}
// End the session
Session::end();
// Close the database connection
DB::close();
if (Router::getTemplateView()) {
    Buffer::start('html');
    require Router::getView();
    // Show developer toolbar
    if (Debugger::$enabled) {
        Debugger::toolbar();
    }
    Buffer::end('html');
    // Load body into template
    require Router::getTemplateView();
} else {
    // Handle the 'none' template case
    require Router::getView();
}