Exemplo n.º 1
0
 /**
  * 加载路由设置
  * @param \Yaf\Dispatcher $dispatcher
  */
 public function _initRoute(Yaf\Dispatcher $dispatcher)
 {
     if (defined('CONFIG_PATH') && is_file(CONFIG_PATH . 'routing.ini')) {
         $config = new Yaf\Config\Ini(CONFIG_PATH . 'routing.ini');
         $dispatcher->getRouter()->addConfig($config);
     }
 }
Exemplo n.º 2
0
 public function _initRoute(Yaf\Dispatcher $dispatcher)
 {
     $router = $dispatcher->getRouter();
     $config = new Yaf\Config\Ini(APPLICATION_PATH . "/config/routes.ini");
     if (!empty($config->routes)) {
         $router->addConfig($config->routes);
     }
 }
Exemplo n.º 3
0
 public function _initRoute(Yaf\Dispatcher $dispatcher)
 {
     $event = $this->profiler->startEvent('Init route');
     $config = new Yaf\Config\Ini(APPLICATION_PATH . '/configs/routes.ini');
     if (isset($config->routes)) {
         $dispatcher->getRouter()->addConfig($config->routes);
     }
     $this->profiler->endEvent($event);
 }
Exemplo n.º 4
0
 public function _initRest(Yaf\Dispatcher $dispatcher)
 {
     $dispatcher->disableView();
     //如果不是cli就调用rest路由
     if (!$dispatcher->getRequest()->isCli()) {
         $router = $dispatcher->getRouter();
         $route = new RestRoute();
         $router->addRoute("rest", $route);
         //设置模板目录
         $view_engine = new Yaf\View\Simple(APPLICATION_PATH . '/application/views');
         $dispatcher->setView($view_engine);
         //启用权限控制插件
         $auth = new AuthPlugin();
         $dispatcher->registerPlugin($auth);
     } else {
         $command = new CommandLinePlugin();
         $dispatcher->registerPlugin($command);
     }
 }
Exemplo n.º 5
0
 public function _initRoute(Yaf\Dispatcher $dispatcher)
 {
     $config = new Yaf\Config\Ini(APP_PATH . '/config/routing.ini');
     $dispatcher->getRouter()->addConfig($config);
 }
Exemplo n.º 6
0
 public function _initRoute(Yaf\Dispatcher $dispatcher)
 {
     $dispatcher->getRouter()->addConfig(Yaf\Registry::get('config')->routes);
 }