Example #1
0
 public static function laze($projectDir = '../')
 {
     /** setting base include path */
     $laizDir = dirname(__FILE__) . '/';
     ini_set('include_path', $laizDir . PATH_SEPARATOR . ini_get('include_path'));
     /** autoload */
     require_once 'laiz/autoloader/BasicLoader.php';
     BasicLoader::init();
     /** get base setting */
     Configure::setProjectDir($projectDir);
     $configs = Configure::get('base');
     $appDir = rtrim($configs['APP_DIR'], '/');
     ini_set('include_path', $appDir . PATH_SEPARATOR . ini_get('include_path'));
     /** php.ini */
     $phpIniConfigs = Configure::get('ini');
     foreach ($phpIniConfigs as $key => $value) {
         ini_set($key, $value);
     }
     /** setting timezone by configure */
     date_default_timezone_set($configs['TIMEZONE']);
     /** error class used by laiz */
     /** not include by command line */
     if (!isset($_SERVER['argv']) && $configs['USING_LAIZ_ERROR_UTILS']) {
         require_once 'laiz/error/Creator.php';
         Creator::register();
     }
     /* start controller of laiz framework */
     $controller = new Controller();
     try {
         $controller->execute();
     } catch (Exception $e) {
         trigger_error($e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine(), E_USER_ERROR);
     }
 }
Example #2
0
 /**
  * Start MVC controller.
  *
  * @access public
  */
 public function execute()
 {
     // create container with configure
     $container = Container::getInstance();
     // setup autoload
     BasicLoader::walk($container->getComponents('laiz.autoloader.Register'));
     // create request object
     $req = $container->get('laiz.action.Request');
     // run action
     // view is action component and run in action runner
     $actionName = $req->initActionName()->getActionName();
     $actionRunner = $container->create('laiz.action.Runner');
     $actionRunner->run($actionName);
 }