Example #1
0
 /**
  * function that launch the framework
  * @param void
  * @return bool
  **/
 public static function render() : bool
 {
     self::get('confs');
     self::get(DIR_MODELS);
     self::get(DIR_CONTROLLERS);
     // ------------------------------------------------------------------------
     // get arguments
     $args = array_merge($_GET, $_POST);
     if (empty($args['url'])) {
         $args['url'] = '/';
     }
     try {
         // ------------------------------------------------------------------------
         // load external librairies
         Server::loadLibs();
         // ------------------------------------------------------------------------
         // allow storage for all applications
         Storage::init();
         // ------------------------------------------------------------------------
         // allow access to database
         Database::autoConnect();
         // ------------------------------------------------------------------------
         // launch controller
         if (!empty($args['task'])) {
             Task::exec($args['task'], $args);
         } else {
             Route::run($args['url'], $args);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return true;
 }