コード例 #1
0
ファイル: Dispatcher.php プロジェクト: heromaeda/hayate
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: hayate/hayate
 public function forward($action, $controller = null, $module = null, array $params = array())
 {
     $dispatcher = Hayate_Dispatcher::getInstance();
     $dispatcher->action($action);
     $dispatcher->controller($controller);
     $dispatcher->module($module);
     $dispatcher->params($params);
     $this->request->dispatched(false);
 }
コード例 #3
0
ファイル: Native.php プロジェクト: hayate/hayate
 /**
  * If present return the template in the current module
  *
  * @param string $template
  * @return string
  */
 protected function template($template)
 {
     // retrieve current module
     $module = Hayate_Dispatcher::getInstance()->module();
     $template = ltrim($template, '\\//');
     $tplfile = MODPATH . $module . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $template . '.php';
     if (is_file($tplfile)) {
         return $tplfile;
     }
     return $template . '.php';
 }
コード例 #4
0
ファイル: Bootstrap.php プロジェクト: heromaeda/hayate
 public function run()
 {
     //$mem = ((memory_get_peak_usage(true) / 1024) / 1024) . 'Mb';
     //var_dump($mem);
     static $run;
     // there will be only one
     if (true === $run) {
         return;
     }
     $request = Hayate_Request::getInstance();
     $dispatcher = Hayate_Dispatcher::getInstance();
     Hayate_Event::run('hayate.pre_dispatch', array($dispatcher));
     do {
         $request->dispatched(true);
         $dispatcher->dispatch();
         if ($request->dispatched()) {
             Hayate_Event::run('hayate.post_dispatch', array($dispatcher, $request));
         }
     } while (false === $request->dispatched());
     Hayate_Event::run('hayate.send_headers');
     Hayate_Event::run('hayate.render');
     $run = true;
     Hayate_Event::run('hayate.shutdown');
     //$mem = ((memory_get_peak_usage(true) / 1024) / 1024) . 'Mb';
     //var_dump($mem);
 }