当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Front::getRouter方法代码示例

本文整理汇总了PHP中Zend_Controller_Front::getRouter方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Front::getRouter方法的具体用法?PHP Zend_Controller_Front::getRouter怎么用?PHP Zend_Controller_Front::getRouter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Controller_Front的用法示例。


在下文中一共展示了Zend_Controller_Front::getRouter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _initRoute

 protected function _initRoute()
 {
     $this->bootstrap('module');
     if (!empty($this->moduleSettings->routes) && $this->moduleSettings->routes->router instanceof Zend_Config) {
         $router = $this->frontController->getRouter();
         $router->addConfig($this->moduleSettings->routes->router, 'routes');
     }
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:8,代码来源:Bootstrap.php

示例2: _initRouter

 protected function _initRouter()
 {
     $facultyRouter = new Zend_Controller_Router_Route('faculty', array('controller' => 'page', 'action' => 'faculty', 'module' => 'default'));
     $certificationRouter = new Zend_Controller_Router_Route('certification', array('controller' => 'page', 'action' => 'certification', 'module' => 'default'));
     $outofauRouter = new Zend_Controller_Router_Route('out-of-australia', array('controller' => 'page', 'action' => 'outofau', 'module' => 'default'));
     $qigongRouter = new Zend_Controller_Router_Route('qigong', array('controller' => 'page', 'action' => 'qigong', 'module' => 'default'));
     $moxibustionRouter = new Zend_Controller_Router_Route('moxibustion', array('controller' => 'page', 'action' => 'moxibustion', 'module' => 'default'));
     $router = $this->_front->getRouter();
     $router->addRoute('faculty', $facultyRouter);
     $router->addRoute('certification', $certificationRouter);
     $router->addRoute('outofau', $outofauRouter);
     $router->addRoute('qigong', $qigongRouter);
     $router->addRoute('moxibustion', $moxibustionRouter);
 }
开发者ID:rocknoon,项目名称:TCVM,代码行数:14,代码来源:Bootstrap.php

示例3: _initRouter

 /**
  * init router
  * @return void
  */
 protected function _initRouter()
 {
     if ($this->routes->router != null) {
         $router = $this->frontController->getRouter();
         $router->addConfig($this->routes->router, 'routes');
     }
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:11,代码来源:Bootstrap.php

示例4: initRoutes

 /**
  * Initialize routes
  * 
  * @return void
  */
 public function initRoutes()
 {
     $news = array('module' => 'default', 'controller' => 'news', 'action' => 'topic');
     $tags = array('module' => 'default', 'controller' => 'blog', 'action' => 'tag');
     $milestones = array('module' => 'default', 'controller' => 'tracking', 'action' => 'milestone');
     $projects = array('module' => 'default', 'controller' => 'projects', 'action' => 'info');
     $tweets = array('module' => 'default', 'controller' => 'social', 'action' => 'tweets');
     $ticket = array('module' => 'default', 'controller' => 'tracking', 'action' => 'ticket');
     $tickets = array('module' => 'default', 'controller' => 'tracking', 'action' => 'tickets');
     $newsRoute = new Zend_Controller_Router_Route('/news/topic/:topic', $news);
     $tagsRoute = new Zend_Controller_Router_Route('/blog/tag/:tag', $tags);
     $milestonesRoute = new Zend_Controller_Router_Route('/tracking/milestone/:milestone', $milestones);
     $projectsRoute = new Zend_Controller_Router_Route('/projects/info/:project', $projects);
     $ticketRoute = new Zend_Controller_Router_Route('/tracking/milestone/:milestone/ticket/:ticket', $ticket);
     $ticketsRoute = new Zend_Controller_Router_Route('/tracking/milestone/:milestone/tickets', $tickets);
     $tweetsRoute = new Zend_Controller_Router_Route('/social/tweets/:tweet', $tweets);
     $router = $this->_front->getRouter();
     $router->addRoute('topic', $newsRoute);
     $router->addRoute('tag', $tagsRoute);
     $router->addRoute('milestone', $milestonesRoute);
     $router->addRoute('ticket', $ticketRoute);
     $router->addRoute('ticket-milestone', $ticketsRoute);
     $router->addRoute('project', $projectsRoute);
     $router->addRoute('tweet', $tweetsRoute);
     $this->_front->setRouter($router);
 }
开发者ID:baphled,项目名称:boodah,代码行数:31,代码来源:Initializer.php

示例5: initRoutes

 public function initRoutes()
 {
     $config = Zend_Registry::get('config');
     $this->_front->setBaseUrl($config->system->web->baseurl);
     $nl = array('content' => 'inhoud', 'news' => 'nieuws', 'events' => 'kalender', 'doctor' => 'team');
     $fr = array('content' => 'contenu', 'news' => 'nouvelles', 'events' => 'kalender', 'doctor' => 'team');
     $translator = new Zend_Translate('array', $nl, 'nl');
     $translator->addTranslation($fr, 'fr');
     $request = $this->getRequest();
     $languageTranslator = substr($request->getRequestUri(), 1, 2);
     $locales = $config->locale->list->toArray();
     if (!isset($locales[$languageTranslator])) {
         $languageTranslator = $config->locale->default;
     }
     $translator->setLocale($languageTranslator);
     Zend_Controller_Router_Route::setDefaultTranslator($translator);
     $router = $this->_front->getRouter();
     $localeRoute = new Zend_Controller_Router_Route(':lng', array('controller' => 'index', 'action' => 'content', 'module' => 'default', 'lng' => 'nl'), array('lng' => '(nl|fr)'));
     $router->addRoute('locale', $localeRoute);
     $contentRoute = new Zend_Controller_Router_Route_Regex('(.+)', array('controller' => 'index', 'action' => 'content', 'url' => null), array(1 => 'url'), '%s');
     $router->addRoute('content', $localeRoute->chain($contentRoute, '/'));
     $router->addRoute('events-index', $localeRoute->chain(new Zend_Controller_Router_Route('@events/*', array('controller' => 'events', 'action' => 'index')), '/'));
     $router->addRoute('events-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@events/:id/:title', array('controller' => 'events', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     $router->addRoute('contact', $localeRoute->chain(new Zend_Controller_Router_Route('@contact/*', array('controller' => 'contact', 'action' => 'form')), '/'));
     $router->addRoute('sitemap', $localeRoute->chain(new Zend_Controller_Router_Route('@sitemap/*', array('controller' => 'sitemap', 'action' => 'index')), '/'));
     $router->addRoute('doctor-index', $localeRoute->chain(new Zend_Controller_Router_Route('@doctor/*', array('controller' => 'doctor', 'action' => 'index')), '/'));
     $router->addRoute('doctor-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@doctor/:id/:title', array('controller' => 'doctor', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     $router->addRoute('ajax-captcha', $localeRoute->chain(new Zend_Controller_Router_Route('captcha', array('controller' => 'index', 'action' => 'ajaxcaptcha')), '/'));
     /* NEWS EXAMPLE */
     $router->addRoute('news-index', $localeRoute->chain(new Zend_Controller_Router_Route('@news/*', array('controller' => 'news', 'action' => 'index')), '/'));
     $router->addRoute('news-detail', $localeRoute->chain(new Zend_Controller_Router_Route('@news/:id/:title', array('controller' => 'news', 'action' => 'detail'), array('id' => '\\d+')), '/'));
     /* NEWS EXAMPLE END */
     $router->addRoute('admin', new Zend_Controller_Router_Route('admin/:controller/:action/*', array('controller' => 'index', 'action' => 'index', 'module' => 'admin')));
     $router->addRoute('file-download', new Zend_Controller_Router_Route_Regex('files/(.*)', array('controller' => 'file', 'action' => 'download'), array(1 => 'filename'), 'files%s'));
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:35,代码来源:Bootstrap.php

示例6: initRoutes

 /**
  * Initialize routes
  *
  * @return void
  */
 public function initRoutes()
 {
     $router = $this->_front->getRouter();
     if (method_exists($router, 'addRoute')) {
         $router->addRoute('group', new Zend_Controller_Router_Route("/group/view/:id", array("module" => 'default', 'controller' => 'group', 'action' => 'view')));
     }
 }
开发者ID:rdohms,项目名称:ugDirectory,代码行数:12,代码来源:Initializer.php

示例7: __construct

 /**
  * Sets up all the initial required pieces of the app.
  * 
  * @param string $environment
  * @param string $appPath
  * @param string $moduleDir
  */
 public function __construct($environment, $appPath = APPLICATION_PATH, $moduleDir = 'modules')
 {
     // set the environment
     $this->_environment = (string) $environment;
     // set the application path
     $this->_appPath = $appPath;
     // set the modules dir path
     $this->_moduleDir = $this->_appPath . DIRECTORY_SEPARATOR . $moduleDir;
     // initiate autoloader
     require_once 'Zend/Loader/Autoloader.php';
     $this->_autoloader = Zend_Loader_Autoloader::getInstance();
     // set up module autoloading
     $this->_autoloader->pushAutoloader(array($this, 'moduleAutoload'));
     // set front controller
     $this->_front = Zend_Controller_Front::getInstance();
     // add module directory
     $this->_front->addModuleDirectory($this->_moduleDir);
     // initiate request
     if ($this->_request === null) {
         $this->_request = new Zend_Controller_Request_Http();
     }
     // initiate response
     if ($this->_response === null) {
         $this->_response = new Zend_Controller_Response_Http();
     }
     // initiate router (Zend_Controller_Router_Rwrite)
     $this->_router = $this->_front->getRouter();
     // get application.ini options
     $appOptions = $this->_getApplicationOptions();
     // set routes in router from application.ini (if any)
     $this->_addRoutesFromConfig($appOptions);
     // update request with routes
     $this->_route($this->_request);
     // get module options
     $moduleOptions = $this->_getModuleOptions();
     // merge application and module options into one array
     $options = $this->mergeOptions($appOptions, $moduleOptions);
     // set options
     $this->setOptions($options);
     // update front controller request
     $this->_front->setRequest($this->_request);
     // update front controller response
     $this->_front->setResponse($this->_response);
     // to be used in dispatch
     $this->_front->setRouter($this->_router);
 }
开发者ID:riteshsahu1981,项目名称:Weadvance,代码行数:53,代码来源:App.php

示例8: initRoutes

 /**
  * Initialize routes
  *
  * @return void
  */
 public function initRoutes()
 {
     $archiveYearRoute = new Zend_Controller_Router_Route_Regex('archive/(\\d+)', array('module' => 'default', 'controller' => 'archive', 'action' => 'year'), array('1' => 'year'));
     $archiveYearMonthRoute = new Zend_Controller_Router_Route_Regex('archive/(\\d+)/(\\d{2})', array('module' => 'default', 'controller' => 'archive', 'action' => 'year-month'), array('1' => 'year', '2' => 'month'));
     $articleRoute = new Zend_Controller_Router_Route_Regex('archive/(\\d+)/(\\d{2})/(\\d{2})/(\\d+)-(.+)', array('module' => 'default', 'controller' => 'article', 'action' => 'index'), array('1' => 'year', '2' => 'month', '3' => 'day', '4' => 'articleId', '5' => 'articleURLName'));
     $this->_front->getRouter()->addRoute('article', $articleRoute);
     $this->_front->getRouter()->addRoute('archiveYear', $archiveYearRoute);
     $this->_front->getRouter()->addRoute('archiveYearMonth', $archiveYearMonthRoute);
 }
开发者ID:kruppi,项目名称:zfblog,代码行数:14,代码来源:Initializer.php

示例9: _initRouter

 protected function _initRouter()
 {
     $newsViewRouter = new Zend_Controller_Router_Route('news/:link', array('controller' => 'news', 'action' => 'view', 'module' => 'default'));
     $artistViewRouter = new Zend_Controller_Router_Route('artist/:link', array('controller' => 'artist', 'action' => 'view', 'module' => 'default'));
     $artistDiscographyRouter = new Zend_Controller_Router_Route('artist/discography/:link', array('controller' => 'artist', 'action' => 'discography', 'module' => 'default'));
     $artistVideoRouter = new Zend_Controller_Router_Route('artist/video/:link', array('controller' => 'artist', 'action' => 'video', 'module' => 'default'));
     $artistAudioRouter = new Zend_Controller_Router_Route('artist/audio/:link', array('controller' => 'artist', 'action' => 'audio', 'module' => 'default'));
     $artistAgendaRouter = new Zend_Controller_Router_Route('artist/agenda/:link', array('controller' => 'artist', 'action' => 'agenda', 'module' => 'default'));
     $artistRiderRouter = new Zend_Controller_Router_Route('artist/rider/:link', array('controller' => 'artist', 'action' => 'rider', 'module' => 'default'));
     $pageRouter = new Zend_Controller_Router_Route('page/:key', array('controller' => 'cms', 'action' => 'index', 'module' => 'default'));
     $router = $this->_front->getRouter();
     $router->addRoute('news-view', $newsViewRouter);
     $router->addRoute('artist-view', $artistViewRouter);
     $router->addRoute('artist-discography', $artistDiscographyRouter);
     $router->addRoute('artist-video', $artistVideoRouter);
     $router->addRoute('artist-audio', $artistAudioRouter);
     $router->addRoute('artist-rider', $artistRiderRouter);
     $router->addRoute('artist-agenda', $artistAgendaRouter);
     $router->addRoute('page', $pageRouter);
 }
开发者ID:rocknoon,项目名称:Stack,代码行数:20,代码来源:Bootstrap.php

示例10: testIsActiveIsChainedRouteAware

 /**
  * @group ZF-11442
  */
 public function testIsActiveIsChainedRouteAware()
 {
     // Create page
     $page = new Zend_Navigation_Page_Mvc(array('action' => 'myaction', 'route' => 'myroute', 'params' => array('page' => 1337, 'item' => 1234)));
     // Create chained route
     $chain = new Zend_Controller_Router_Route_Chain();
     $foo = new Zend_Controller_Router_Route('lolcat/:action', array('module' => 'default', 'controller' => 'foobar', 'action' => 'bazbat'));
     $bar = new Zend_Controller_Router_Route(':page/:item', array('page' => 1, 'item' => 1));
     $chain->chain($foo)->chain($bar);
     // Set up router
     $this->_front->getRouter()->addRoute('myroute', $chain);
     $this->_front->getRequest()->setParams(array('module' => 'default', 'controller' => 'foobar', 'action' => 'myaction', 'page' => 1337, 'item' => 1234));
     // Test
     $this->assertTrue($page->isActive());
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:18,代码来源:MvcTest.php

示例11: X_initRoutes

 /**
  * Add required routes to the router
  */
 protected function X_initRoutes()
 {
     $this->_logger->info('Bootstrap ' . __METHOD__);
     $this->bootstrap('frontController');
     $router = $this->frontController->getRouter();
     // Admin context route
     $route = new Zend_Controller_Router_Route('admin/:module/:controller/:action/*', array('action' => 'index', 'controller' => 'admin', 'module' => 'iads', 'isAdmin' => true));
     $router->addRoute('admin', $route);
     // catalog category product route
     $route = new Zend_Controller_Router_Route('catalog/:categoryIdent/:productIdent', array('action' => 'view', 'controller' => 'catalog', 'module' => 'iads', 'categoryIdent' => ''), array('categoryIdent' => '[a-zA-Z-_0-9]+', 'productIdent' => '[a-zA-Z-_0-9]+'));
     $router->addRoute('catalog_category_product', $route);
     // catalog category route
     $route = new Zend_Controller_Router_Route('catalog/:categoryIdent/:page', array('action' => 'index', 'controller' => 'catalog', 'module' => 'iads', 'categoryIdent' => '', 'page' => 1), array('categoryIdent' => '[a-zA-Z-_0-9]+', 'page' => '\\d+'));
     $router->addRoute('catalog_category', $route);
 }
开发者ID:shadobladez,项目名称:erp2,代码行数:18,代码来源:Bootstrap.php

示例12: init

 /**
  * Initialises the application
  *
  */
 public function init()
 {
     $__start = getmicrotime();
     if (isset($this->config['log_file'])) {
         $writer = new Zend_Log_Writer_Stream($this->config['log_file']);
         $this->logger = new Zend_Log($writer);
         if (isset($this->config['log_format'])) {
             $formatter = new Zend_Log_Formatter_Simple($this->config['log_format']);
             $writer->setFormatter($formatter);
         }
         // If not in debug mode, hide debug log messages
         if (!ifset($this->config, 'debug', false)) {
             $this->logger->addFilter(Zend_Log::NOTICE);
         }
     }
     $this->recordStat('za::initlog', getmicrotime() - $__start);
     $__start = getmicrotime();
     $mailServer = $this->getConfig('smtp_server');
     if (mb_strlen($mailServer)) {
         ini_set('SMTP', $mailServer);
     }
     // Create a new view object.
     $view = new CompositeView();
     Zend_Registry::set(self::$ZEND_VIEW, $view);
     /* @var Zend_Controller_Front $controller */
     $this->frontController = Zend_Controller_Front::getInstance();
     $this->frontController->setDispatcher(new InjectingDispatcher());
     $this->frontController->addControllerDirectory($this->getConfig('controller_dir', 'controllers'), 'default');
     $modules = ifset($this->config, 'modules', array());
     foreach ($modules as $module) {
         if (is_dir(APP_DIR . '/modules/' . $module)) {
             $this->frontController->addControllerDirectory('modules/' . $module, $module);
         }
     }
     $this->recordStat('za::initmodules', getmicrotime() - $__start);
     $__start = getmicrotime();
     $this->frontController->throwExceptions(ifset($this->config, 'debug', false) ? true : false);
     if (isset($this->config['route_config']) && php_sapi_name() != 'cli') {
         $router = $this->frontController->getRouter();
         /* @var $router Zend_Controller_Router_Rewrite */
         $config = new Zend_Config_Ini($this->config['route_config'], 'routes');
         $router->addConfig($config, 'routes');
     }
     Zend_Controller_Action_HelperBroker::removeHelper('viewRenderer');
     $this->frontController->setParam('noViewRenderer', true);
     /**
      * Set the session
      */
     $session_name = str_replace(' ', '_', $this->config['name']);
     Zend_Session::start(array('name' => $session_name));
     $this->injector->addAutoProperty('log', $this->logger);
     $__start = getmicrotime();
     // $services = $this->loadDefaultServices();
     $this->injector->addServiceDirectory(NOVEMBER_APP_DIR . '/services');
     // $this->injector->loadServices($this->config['services']);
     $this->recordStat('za::initdefaultservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     //
     //        foreach ($services as $defaultService) {
     //            $this->injector->inject($defaultService);
     //        }
     //
     $this->recordStat('za::initinjectdefaultservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     // Load extensions
     $this->loadExtensions();
     $this->injector->addServiceDirectory(ifset($this->config, 'services_dir', APP_DIR . '/services'));
     $this->recordStat('za::initloadext', getmicrotime() - $__start);
     $__start = getmicrotime();
     $this->injector->loadServices($this->config['services']);
     $this->recordStat('za::initloadservices', getmicrotime() - $__start);
     $__start = getmicrotime();
     // We know that there's definitely going to be an AuthService,
     // so we can now go and load the user if there was one in
     // the session.
     $auth = $this->injector->getService('AuthService');
     if (isset($this->getSession()->CURRENT_USER_TICKET) && mb_strlen($this->getSession()->CURRENT_USER_TICKET)) {
         $auth->validateTicket($this->getSession()->CURRENT_USER_NAME, $this->getSession()->CURRENT_USER_TICKET);
     }
     $this->recordStat('za::initvalidateauth', getmicrotime() - $__start);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:85,代码来源:NovemberApplication.php

示例13: initRoutes

 /**
  * Initialize routes
  *
  * @return void
  */
 public function initRoutes()
 {
     $router = $this->_front->getRouter();
     $router->addConfig(self::$_config, 'routes');
 }
开发者ID:ajbrown,项目名称:bitnotion,代码行数:10,代码来源:Initializer.php

示例14: setRoutes

 /**
  * Routes for URL friendly transforamtion
  */
 public function setRoutes()
 {
     Sydney_Tools_Friendlyurls::setDefaultRoutes($this->frontController->getRouter());
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:7,代码来源:Bootstrapper.php

示例15: run

 /**
  * Dispatches all requests. 
  *
  * @param  Zend_Controller_Front $controller
  * @return array|null Array of Response objects, or null if no tasks
  */
 public function run(Zend_Controller_Front $controller)
 {
     $router = $controller->getRouter();
     $returnResponse = $controller->returnResponse();
     $responses = array();
     foreach ($this->_requests as $request) {
         if ($request->getControllerName()) {
             // Use default router
             $controller->setRouter(new Zend_Controller_Router());
         }
         if ($returnResponse) {
             $responses[] = $controller->dispatch($request);
         }
         $controller->setRouter($router);
     }
     $this->_completed = true;
     return $responses;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:24,代码来源:Task.php


注:本文中的Zend_Controller_Front::getRouter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。