Example #1
0
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 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);
 }
Example #3
0
 /**
  * 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';
 }
Example #4
0
 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);
 }