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


PHP Zend_Controller_Request_Http::setDispatched方法代码示例

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


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

示例1: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  *
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
     }
     if (!$condition->getContinue()) {
         return null;
     }
     $page = Mage::getModel('Mage_Cms_Model_Page');
     $pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
     if (!$pageId) {
         return null;
     }
     $request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return Mage::getControllerInstance('Mage_Core_Controller_Varien_Action_Forward', $request, Mage::app()->getFrontController()->getResponse());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:35,代码来源:Router.php

示例2: testDispatch

 /**
  * Test that Mage_Core_Controller_Varien_Action_Forward::dispatch() does not change dispatched flag
  */
 public function testDispatch()
 {
     $this->_request->setDispatched(true);
     $this->assertTrue($this->_request->isDispatched());
     $this->_object->dispatch('any action');
     $this->assertFalse($this->_request->isDispatched());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:ForwardTest.php

示例3: match

 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('magicproduct_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     if (!in_array($identifier, $this->router)) {
         return false;
     }
     $request->setModuleName('magicproduct')->setControllerName('index')->setActionName('product')->setParam('type', $identifier);
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return true;
 }
开发者ID:uibar,项目名称:laviniailies2,代码行数:25,代码来源:Router.php

示例4: match

 /**
  * Validate and Match Manufacturer Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $router = 'manufacturers';
     $identifier = trim(str_replace('/manufacturers/', '', $request->getPathInfo()), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('manufacturer_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     $manufacturer = Mage::getModel('zeon_manufacturer/manufacturer');
     $manufacturerId = $manufacturer->checkIdentifier($identifier, Mage::app()->getStore()->getId());
     if (trim($identifier) && $manufacturerId) {
         $request->setModuleName('manufacturers')->setControllerName('index')->setActionName('view')->setParam('manufacturer_id', $manufacturerId);
         $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $router . '/' . $identifier);
         return true;
     }
     return false;
 }
开发者ID:perseusl,项目名称:kingdavid,代码行数:34,代码来源:Router.php

示例5: match

 /**
  * Match the request
  *
  * @param Zend_Controller_Request_Http $request
  * @return boolean
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     //checking before even try to find out that current module
     //should use this router
     if (!$this->_beforeModuleMatch()) {
         return false;
     }
     $front = $this->getFront();
     $path = trim($request->getPathInfo(), '/');
     $p = explode('/', $path);
     if (count($p) == 0 || !$this->_pluarizeName($p[0])) {
         return false;
     } else {
         $module = $this->_pluarizeName($p[0]);
         $modules = $this->getModuleByFrontName($module);
         if ($modules === false) {
             return false;
         }
         // checks after we found out that this router should be used for current module
         if (!$this->_afterModuleMatch()) {
             return false;
         }
         // set values only after all the checks are done
         $request->setModuleName($module);
         $request->setControllerName('index');
         $action = $this->_getActionFromPathInfo($p);
         $request->setActionName($action);
         $realModule = 'Zefir_Dealers';
         $request->setControllerModule($realModule);
         $request->setRouteName('dealers');
         // dispatch action
         $request->setDispatched(true);
         /**
          * Set params for the request
          */
         if ($action == 'view') {
             $request->setParam('dealer_code', $p[1]);
         } else {
             // set parameters from pathinfo
             for ($i = 3, $l = sizeof($p); $i < $l; $i += 2) {
                 $request->setParam($p[$i], isset($p[$i + 1]) ? urldecode($p[$i + 1]) : '');
             }
         }
         // instantiate controller class and dispatch action
         $controllerClassName = $this->_validateControllerClassName($realModule, 'index');
         $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
         $controllerInstance->dispatch($action);
         return true;
     }
 }
开发者ID:kalburgimanjunath,项目名称:magento-dealers,代码行数:56,代码来源:Router.php

示例6: forwardShopby

 protected function forwardShopby()
 {
     $reservedKey = Mage::getStoreConfig('amshopby/seo/key');
     $realModule = 'Amasty_Shopby';
     $this->request->setPathInfo($reservedKey);
     $this->request->setModuleName('amshopby');
     $this->request->setRouteName('amshopby');
     $this->request->setControllerName('index');
     $this->request->setActionName('index');
     $this->request->setControllerModule($realModule);
     $file = Mage::getModuleDir('controllers', $realModule) . DS . 'IndexController.php';
     include $file;
     //compatibility with 1.3
     $class = $realModule . '_IndexController';
     $controllerInstance = new $class($this->request, $this->getFront()->getResponse());
     $this->request->setDispatched(true);
     $controllerInstance->dispatch('index');
 }
开发者ID:victorkho,项目名称:telor,代码行数:18,代码来源:Router.php

示例7: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     $page = Mage::getModel('searchlandingpage/page')->checkIdentifier($identifier);
     if (!$page) {
         return false;
     }
     $request->setModuleName('searchlandingpage')->setControllerName('page')->setActionName('view')->setParam('q', $page->getQueryText())->setParam('id', $page->getId());
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return true;
 }
开发者ID:guohuadeng,项目名称:aototechweb,代码行数:21,代码来源:Router.php

示例8: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     if ($identifier != Mage::helper('productquestions')->faqsPageUrlKey()) {
         return false;
     }
     $request->setModuleName('productquestions')->setControllerName('faq')->setActionName('index');
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return true;
 }
开发者ID:ramantalkin,项目名称:tmp01skin,代码行数:29,代码来源:Router.php

示例9: match

 /**
  * Validate and Match News and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('magna_news_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     $news = Mage::getModel('magna_news/news');
     $newsId = $news->checkIdentifier($identifier, Mage::app()->getStore()->getId());
     if (!$newsId) {
         return false;
     }
     $request->setModuleName('magna_news')->setControllerName('view')->setActionName('show')->setParam('news_id', $newsId);
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return true;
 }
开发者ID:zmarius81,项目名称:Magento-News-Module,代码行数:29,代码来源:Router.php

示例10: match

 /**
  * Validate and Match FAQ Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $router = 'faq';
     $identifier = trim(str_replace('/faq/', '', $request->getPathInfo()), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     Mage::dispatchEvent('faq_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return true;
     }
     if (!$condition->getContinue()) {
         return false;
     }
     $category = Mage::getModel('zeon_faq/category');
     $categoryId = $category->checkIdentifier($identifier, Mage::app()->getStore()->getId());
     if (!$categoryId && $identifier == 'mfaq') {
         $request->setModuleName('faq')->setControllerName('index')->setActionName('index');
         if (Mage::helper('zeon_faq')->getIsDisplayMfaq()) {
             $request->setParam('mfaq', 1);
         }
         $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $router);
         return true;
     } elseif ($categoryId) {
         $request->setModuleName('faq')->setControllerName('index')->setActionName('index')->setParam('category_id', $categoryId);
         $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $router . '/' . $identifier);
         return true;
     } else {
         return false;
     }
     return false;
 }
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:42,代码来源:Router.php

示例11: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return false;
     }
     $sellerAtttributeName = Mage::getConfig()->getNode('default/seller_page/attribute_name');
     $seoDisplay = Mage::getConfig()->getNode('default/seller_page/seo_display');
     if (empty($sellerAtttributeName)) {
         //Seller attribute not configured
         return false;
     }
     $pageId = $request->getPathInfo();
     $param = explode('/', $pageId);
     $seller = '';
     if (count($param) > 1 and strtolower($param[1]) == $seoDisplay and !empty($param[2])) {
         //Identify Seller
         $sellerPage = $param[2];
         if (strpos($sellerPage, '.') !== false) {
             $sellerPage = urldecode(substr($sellerPage, 0, -5));
             if ($sellerPage) {
                 $seller = str_replace('-', ' ', $sellerPage);
             } else {
                 return false;
             }
         } else {
             $seller = $sellerPage;
         }
     } else {
         return false;
     }
     if ($seller) {
         Mage::register('seller_company', $seller);
         $realModule = 'Cybage_Marketplace';
         $request->setModuleName('marketplace');
         $request->setRouteName('marketplace');
         $request->setControllerName('seller');
         $request->setActionName('sellerinfo');
         $request->setControllerModule($realModule);
         $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getRequestString(), '/'));
         $file = Mage::getModuleDir('controllers', $realModule) . DS . 'SellerController.php';
         include $file;
         //compatibility with 1.3
         $class = $realModule . '_SellerController';
         $controllerInstance = new $class($request, $this->getFront()->getResponse());
         $request->setDispatched(true);
         $controllerInstance->dispatch('sellerinfo');
     }
     return true;
 }
开发者ID:DeveshKumarThakur,项目名称:cosmetics,代码行数:55,代码来源:Router.php

示例12: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $this->fetchDefault();
     $front = $this->getFront();
     $p = explode('/', trim($request->getPathInfo(), '/'));
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         $p = explode('/', trim($request->getPathInfo(), '/'));
         $module = !empty($p[0]) ? $p[0] : $this->getFront()->getDefault('module');
     }
     if (!$module) {
         return false;
     }
     $realModule = $this->getModuleByFrontName($module);
     if (!$realModule) {
         if ($moduleFrontName = array_search($module, $this->_modules)) {
             $realModule = $module;
             $module = $moduleFrontName;
         } else {
             return false;
         }
     }
     if (!Mage::app()->isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     if (Mage::app()->isInstalled() && !$request->isPost()) {
         $shouldBeSecure = substr(Mage::getStoreConfig('web/unsecure/base_url'), 0, 5) === 'https' || Mage::getStoreConfigFlag('web/secure/use_in_adminhtml') && substr(Mage::getStoreConfig('web/secure/base_url'), 0, 5) === 'https';
         if ($shouldBeSecure && !Mage::app()->getStore()->isCurrentlySecure()) {
             $url = Mage::getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
             Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();
             exit;
         }
     }
     // get controller name
     if ($request->getControllerName()) {
         $controller = $request->getControllerName();
     } else {
         $controller = !empty($p[1]) ? $p[1] : $front->getDefault('controller');
     }
     $controllerFileName = $this->getControllerFileName($realModule, $controller);
     if (!$controllerFileName || !is_readable($controllerFileName)) {
         $controller = 'index';
         $action = 'noroute';
         $controllerFileName = $this->getControllerFileName($realModule, $controller);
     }
     $controllerClassName = $this->getControllerClassName($realModule, $controller);
     if (!$controllerClassName) {
         $controller = 'index';
         $action = 'noroute';
         $controllerFileName = $this->getControllerFileName($realModule, $controller);
     }
     // get action name
     if (empty($action)) {
         if ($request->getActionName()) {
             $action = $request->getActionName();
         } else {
             $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
         }
     }
     // include controller file if needed
     if (!class_exists($controllerClassName, false)) {
         include $controllerFileName;
         if (!class_exists($controllerClassName)) {
             throw Mage::exception('Mage_Core', Mage::helper('core')->__('Controller file was loaded but class does not exist'));
         }
     }
     // instantiate controller class
     $controllerInstance = new $controllerClassName($request, $front->getResponse());
     if (!$controllerInstance->hasAction($action)) {
         return false;
     }
     // set values only after all the checks are done
     $request->setModuleName($module);
     $request->setControllerName($controller);
     $request->setActionName($action);
     // set parameters from pathinfo
     for ($i = 3, $l = sizeof($p); $i < $l; $i += 2) {
         $request->setParam($p[$i], isset($p[$i + 1]) ? $p[$i + 1] : '');
     }
     // dispatch action
     $request->setDispatched(true);
     $controllerInstance->dispatch($action);
     return true;
     #$request->isDispatched();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:88,代码来源:Admin.php

示例13: dispatch

 /**
  * Simulates the dispatch process of the action named $action.
  *
  * @param string $action
  */
 protected function dispatch($action)
 {
     $this->request->setDispatched(true);
     $actionMethod = $this->actionNameToMethod($action);
     $this->controller->dispatch($actionMethod);
 }
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:11,代码来源:ActionParameterTest.php

示例14: matchUrl

 public static function matchUrl(Zend_Controller_Request_Http $request)
 {
     if (AW_Kbase_Helper_Data::isModuleOutputDisabled() || !AW_Kbase_Helper_Data::getFrontendEnabled()) {
         return false;
     }
     $urlKey = self::getModuleUrlKey();
     $pathInfo = $request->getPathInfo();
     $requestUri = $request->getRequestUri();
     if ($request->getParam('___from_store')) {
         $_fromStore = Mage::app()->getSafeStore($request->getParam('___from_store'));
         if ($_fromStore->getData()) {
             $_oldUrlKey = self::getModuleUrlKeyFromConfig($_fromStore);
             if (strpos($pathInfo, '/' . $_oldUrlKey) === 0 && $_oldUrlKey != $urlKey) {
                 $_newUrl = self::secureUrl(Mage::getBaseUrl() . $urlKey . '/');
                 $response = Mage::app()->getResponse();
                 $response->setRedirect($_newUrl);
                 $response->sendHeaders();
                 $request->setDispatched(true);
                 return true;
             }
         }
     }
     if (0 !== strpos($pathInfo, '/' . $urlKey . '/')) {
         // if path does not begin with /kbase/
         return false;
     }
     $pathInfo = substr($pathInfo, strlen($urlKey) + 2);
     $request->setModuleName('kbase')->setControllerName('article');
     if (!strlen($pathInfo)) {
         $request->setActionName('index');
         return AW_Kbase_Helper_Data::getFrontendEnabled() && self::cacheRewrite($request->getPathInfo(), 'kbase/article/index');
     }
     $urlKeySuffix = self::getUrlKeySuffix();
     $isArticle = false;
     if (!$urlKeySuffix) {
         $_path = explode('/', $pathInfo);
         $_aUrl = false;
         if (count($_path) == 1) {
             $_aUrl = $_path[0];
         }
         if (count($_path) == 2) {
             $_aUrl = $_path[1];
         }
         if ($_aUrl) {
             $_aUrl = urldecode($_aUrl);
             $_aId = Mage::getModel('kbase/article')->getResource()->getIdByUrlKey($_aUrl);
             if (!$_aId) {
                 $_aId = Mage::getModel('kbase/article')->getResource()->getIdByUrlKey($_aUrl, true);
             }
             if ($_aId) {
                 $isArticle = true;
             }
         }
     }
     /**
      * Checking is customer comes from other store view
      * having various article suffix id in comparison
      * with current
      */
     if ($request->getParam('___from_store') && !$isArticle) {
         if (!isset($_fromStore)) {
             $_fromStore = Mage::app()->getSafeStore($request->getParam('___from_store'));
         }
         if ($_fromStore->getData()) {
             $_oldUrlSuffix = self::getUrlKeySuffixFromConfig($_fromStore);
             if ($urlKeySuffix != $_oldUrlSuffix) {
                 $_path = explode('/', $pathInfo);
                 $_aUrl = false;
                 if (count($_path) == 1) {
                     $_aUrl = $_path[0];
                 }
                 if (count($_path) == 2) {
                     $_aUrl = $_path[1];
                 }
                 if ($_aUrl) {
                     $_articleUrlKey = substr($_aUrl, 0, strpos($_aUrl, $_oldUrlSuffix));
                     $_aId = Mage::getModel('kbase/article')->getResource()->getIdByUrlKey($_articleUrlKey);
                     if (!$_aId) {
                         $_aId = Mage::getModel('kbase/article')->getResource()->getIdByUrlKey($_articleUrlKey, true);
                     }
                     if ($_aId) {
                         $_storeIds = Mage::getModel('kbase/article')->getResource()->getArticleStoreIds($_aId);
                         if (in_array(Mage::app()->getStore()->getId(), $_storeIds)) {
                             $_newUrl = self::secureUrl(Mage::getBaseUrl() . $urlKey . '/' . $_articleUrlKey . $urlKeySuffix);
                             $response = Mage::app()->getResponse();
                             $response->setRedirect($_newUrl);
                             $response->sendHeaders();
                             $request->setDispatched(true);
                             return true;
                         }
                     }
                 }
             }
         }
     }
     if ($urlKeySuffix && '/' != $urlKeySuffix && $urlKeySuffix == substr($pathInfo, -strlen($urlKeySuffix)) || $isArticle) {
         $pathInfo = substr($pathInfo, 0, strlen($pathInfo) - strlen($urlKeySuffix));
         $path = explode('/', $pathInfo);
         if (count($path) == 1) {
             $request->setActionName('article');
//.........这里部分代码省略.........
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:101,代码来源:Url.php

示例15: Dispatch

 /**
  * Allows the dispatching and processing of a separate 
  * controller request from inside an existing view. 
  * 
  * Should be used for read only stuff (please!)
  *
  * @param string $controller
  * @param string $action
  * @param array $params A list of parameters to bind into the new request
  * @param string $module
  * @param array $requestParams A list of parameters to pull from the current request
  */
 public function Dispatch($controller, $action, $params = array(), $module = null, $requestParams = array())
 {
     // If no module, use the current request module
     $oldRequest = null;
     $ctrl = Zend_Controller_Front::getInstance();
     $oldRequest = $ctrl->getRequest();
     if ($module == null) {
         /* @var $request Zend_Controller_Request_Abstract  */
         $name = null;
         if ($oldRequest) {
             $name = $oldRequest->getModuleName();
         }
         if ($name && $name != 'default') {
             $module = $name;
         }
     } else {
         if ($module == 'default') {
             $module = '';
         }
     }
     $key = $controller . '|' . $action . '|' . $module;
     if (isset(self::$__DISPATCHED[$key])) {
         za()->log("Recursive dispatch detected {$key} ", Zend_Log::ERR);
         return;
     }
     self::$__DISPATCHED[$key] = true;
     $request = new Zend_Controller_Request_Http();
     $response = new Zend_Controller_Response_Http();
     $request->setControllerName($controller);
     $request->setActionName($action);
     if ($params) {
         $request->setParams($params);
     }
     if (count($requestParams)) {
         foreach ($requestParams as $rp) {
             // get from the current request and stick into the new
             $value = $oldRequest->getParam($rp, '');
             $request->setParam($rp, $value);
         }
     }
     if ($module) {
         $request->setModuleName($module);
     }
     $oldView = Zend_Registry::get(NovemberApplication::$ZEND_VIEW);
     $allPaths = $oldView->getAllPaths();
     $newView = new CompositeView();
     foreach ($allPaths['script'] as $scriptPath) {
         $newView->addScriptPath($scriptPath);
     }
     foreach ($allPaths['helper'] as $prefix => $path) {
         $newView->addHelperPath($path, $prefix);
     }
     foreach ($allPaths['filter'] as $prefix => $path) {
         $newView->addFilterPath($path, $prefix);
     }
     Zend_Registry::set(NovemberApplication::$ZEND_VIEW, $newView);
     $dispatcher = new InjectingDispatcher();
     $dispatcher->addControllerDirectory('controllers', 'default');
     $dispatcher->setParams($params)->setResponse($response);
     $request->setDispatched(true);
     $dispatcher->dispatch($request, $response);
     $response->outputBody();
     Zend_Registry::set(NovemberApplication::$ZEND_VIEW, $oldView);
 }
开发者ID:nyeholt,项目名称:relapse,代码行数:76,代码来源:Dispatch.php


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