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


PHP Zend_Controller_Request_Http::getOriginalPathInfo方法代码示例

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


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

示例1: 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;
     }
     $this->fetchDefault();
     $front = $this->getFront();
     $path = trim($request->getPathInfo(), '/');
     if ($path) {
         $p = explode('/', $path);
     } else {
         $p = explode('/', $this->_getDefaultPath());
     }
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         if (!empty($p[0])) {
             $module = $p[0];
         } else {
             $module = $this->getFront()->getDefault('module');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, '');
         }
     }
     if (!$module) {
         if (Mage::app()->getStore()->isAdmin()) {
             $module = 'admin';
         } else {
             return false;
         }
     }
     /**
      * Searching router args by module name from route using it as key
      */
     $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;
     }
     /**
      * Going through modules to find appropriate controller
      */
     $found = false;
     foreach ($modules as $realModule) {
         $request->setRouteName($this->getRouteByFrontName($module));
         // get controller name
         if ($request->getControllerName()) {
             $controller = $request->getControllerName();
         } else {
             if (!empty($p[1])) {
                 $controller = $p[1];
             } else {
                 $controller = $front->getDefault('controller');
                 $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
             }
         }
         // get action name
         if (empty($action)) {
             if ($request->getActionName()) {
                 $action = $request->getActionName();
             } else {
                 $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
             }
         }
         //checking if this place should be secure
         $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
         $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
         if (!$controllerClassName) {
             continue;
         }
         // instantiate controller class
         $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
         if (!$controllerInstance->hasAction($action)) {
             continue;
         }
         $found = true;
         break;
     }
     /**
      * if we did not found any suitable
      */
     if (!$found) {
         if ($this->_noRouteShouldBeApplied()) {
             $controller = 'index';
             $action = 'noroute';
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 return false;
             }
//.........这里部分代码省略.........
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:101,代码来源:Standard.php

示例2: processRequestResponse

 /**
  * Process response body by specific request
  *
  * @param Zend_Controller_Request_Http $request
  * @param Zend_Controller_Response_Http $response
  * @return Enterprise_PageCache_Model_Processor
  */
 public function processRequestResponse(Zend_Controller_Request_Http $request, Zend_Controller_Response_Http $response)
 {
     // we should add original path info tag as another way we can't drop some entities from cron job
     $this->addRequestTag(Enterprise_PageCache_Helper_Url::prepareRequestPathTag($request->getOriginalPathInfo()));
     $cacheInstance = Enterprise_PageCache_Model_Cache::getCacheInstance();
     /**
      * Basic validation for request processing
      */
     if ($this->canProcessRequest($request)) {
         $processor = $this->getRequestProcessor($request);
         if ($processor && $processor->allowCache($request)) {
             $this->setMetadata('cache_subprocessor', get_class($processor));
             $cacheId = $this->prepareCacheId($processor->getPageIdInApp($this));
             $content = $processor->prepareContent($response);
             /**
              * Replace all occurrences of session_id with unique marker
              */
             Enterprise_PageCache_Helper_Url::replaceSid($content);
             Enterprise_PageCache_Helper_Form_Key::replaceFormKey($content);
             if (function_exists('gzcompress')) {
                 $content = gzcompress($content);
             }
             $contentSize = strlen($content);
             $currentStorageSize = (int) $cacheInstance->load(self::CACHE_SIZE_KEY);
             if (Mage::getStoreConfig(Enterprise_PageCache_Model_Processor::XML_PATH_CACHE_DEBUG)) {
                 $response->setBody(implode(', ', $this->getRequestTags()) . $response->getBody());
             }
             $maxSizeInBytes = Mage::getStoreConfig(self::XML_PATH_CACHE_MAX_SIZE) * 1024 * 1024;
             if ($currentStorageSize >= $maxSizeInBytes) {
                 Mage::app()->getCacheInstance()->invalidateType('full_page');
                 return $this;
             }
             $cacheInstance->save($content, $cacheId, $this->getRequestTags());
             $cacheInstance->save($currentStorageSize + $contentSize, self::CACHE_SIZE_KEY, $this->getRequestTags());
             /*
              * Save design change in cache
              */
             $designChange = Mage::getSingleton('core/design');
             if ($designChange->getData()) {
                 $cacheInstance->save(serialize($designChange->getData()), $this->getRequestCacheId() . self::DESIGN_CHANGE_CACHE_SUFFIX, $this->getRequestTags());
             }
             // save response headers
             $this->setMetadata('response_headers', $response->getHeaders());
             // save original routing info
             $this->setMetadata('routing_aliases', Mage::app()->getRequest()->getAliases());
             $this->setMetadata('routing_requested_route', Mage::app()->getRequest()->getRequestedRouteName());
             $this->setMetadata('routing_requested_controller', Mage::app()->getRequest()->getRequestedControllerName());
             $this->setMetadata('routing_requested_action', Mage::app()->getRequest()->getRequestedActionName());
             $this->setMetadata('sid_cookie_name', Mage::getSingleton('core/session')->getSessionName());
             Mage::dispatchEvent('pagecache_processor_metadata_before_save', array('processor' => $this));
             $this->_saveMetadata();
         }
         if (isset($_GET[Mage_Core_Model_Session_Abstract::SESSION_ID_QUERY_PARAM])) {
             Mage::getSingleton('enterprise_pagecache/cookie')->updateCustomerCookies();
             Mage::getModel('enterprise_pagecache/observer')->updateCustomerProductIndex();
         }
     }
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:66,代码来源:Processor.php

示例3: match

 public function match(Zend_Controller_Request_Http $request)
 {
     //checkings before even try to findout that current module should use this router
     if (!$this->_beforeModuleMatch()) {
         return false;
     }
     $this->fetchDefault();
     $front = $this->getFront();
     $p = explode('/', trim($request->getPathInfo(), '/'));
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         if (!empty($p[0])) {
             $module = $p[0];
         } else {
             $module = $this->getFront()->getDefault('module');
             $request->setAlias('rewrite_request_path', '');
         }
     }
     if (!$module) {
         if (App_Main::isAdmin()) {
             $module = 'admin';
         }
     }
     if (empty($module)) {
         return false;
     }
     // Searching router args by module name from route using it as key
     $modules = $this->getModuleByFrontName($module);
     // If we did not found anything  we searching exact this module name in array values
     if ($modules === false) {
         if ($moduleFrontName = $this->getModuleByName($module, $this->_modules)) {
             $modules = array($module);
             $module = $moduleFrontName;
         }
     }
     if (empty($modules)) {
         return false;
     }
     /**
      * Going through modules to find appropriate controller
      */
     $found = false;
     foreach ($modules as $realModule) {
         $request->setRouteName($this->getRouteByFrontName($module));
         // get controller name
         if ($request->getControllerName()) {
             $controller = $request->getControllerName();
         } else {
             if (!empty($p[1])) {
                 $controller = $p[1];
             } else {
                 $controller = $front->getDefault('controller');
                 $request->setAlias('rewrite_request_path', ltrim($request->getOriginalPathInfo(), '/'));
             }
         }
         // get action name
         if (empty($action)) {
             if ($request->getActionName()) {
                 $action = $request->getActionName();
             } else {
                 $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
             }
         }
         //checking if this place should be secure
         $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
         $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
         if (!$controllerClassName) {
             continue;
         }
         // instantiate controller class
         $controllerInstance = new $controllerClassName($request, $front->getResponse());
         if (!$controllerInstance->hasAction($action)) {
             continue;
         }
         $found = true;
         break;
     }
     /**
      * if we did not found any siutibul
      */
     if (!$found) {
         if ($this->_noRouteShouldBeApplied()) {
             $controller = 'index';
             $action = 'noroute';
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 return false;
             }
             // instantiate controller class
             $controllerInstance = new $controllerClassName($request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
         } else {
             return false;
         }
     }
     // set values only after all the checks are done
//.........这里部分代码省略.........
开发者ID:hettema,项目名称:Stages,代码行数:101,代码来源:Standard.php

示例4: match

 /**
  * Validate and Match shop view and modify request
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     $front = $this->getFront();
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $routerConfig = Mage::getStoreConfig('shopbybrand/general/router');
     $_end = Mage::getStoreConfig(Magestore_Shopbybrand_Helper_Data::XML_FRONTEND_LINK);
     $_path = urldecode(trim($request->getPathInfo(), '/'));
     if (strpos($_path, $_end)) {
         $_link_params = explode('/', str_replace($_end, '/', $_path), -1);
     } else {
         $_link_params = explode('/', $_path . '/', -1);
     }
     $_count_params = count($_link_params);
     $found = false;
     if (isset($_link_params[0])) {
         $router = $_link_params[0];
         if ($router == $routerConfig) {
             $request->setRouteName('shopbybrand')->setControllerModule('Magestore_Shopbybrand')->setModuleName('brand');
             $module = 'shopbybrand';
             if (isset($_link_params[1]) && $_link_params[1]) {
                 $request->setControllerName($_link_params[1]);
             }
             if (isset($_link_params[2]) && $_link_params[2]) {
                 $request->setActionName($_link_params[2]);
             }
             // get controller name
             if ($request->getControllerName()) {
                 $controller = $request->getControllerName();
             } else {
                 if (!empty($_link_params[1])) {
                     $controller = $_link_params[1];
                 } else {
                     $controller = $front->getDefault('controller');
                     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
                 }
             }
             // get action name
             if (empty($action)) {
                 if ($request->getActionName()) {
                     $action = $request->getActionName();
                 } else {
                     $action = !empty($_link_params[2]) ? $_link_params[2] : $front->getDefault('action');
                 }
             }
             //checking if this place should be secure
             $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
             $controllerClassName = $this->_validateControllerClassName('Magestore_Shopbybrand', $controller);
             if (!$controllerClassName) {
                 return false;
             }
             $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
             $found = true;
         }
     }
     if (!$found) {
         if ($this->_noRouteShouldBeApplied()) {
             $controller = 'index';
             $action = 'noroute';
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 return false;
             }
             // instantiate controller class
             $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:83,代码来源:Router.php

示例5: _matchControllerName

 /**
  * Match controller name
  *
  * @param Zend_Controller_Request_Http $request
  * @param string $param
  * @return string
  */
 protected function _matchControllerName(Zend_Controller_Request_Http $request, $param)
 {
     if ($request->getControllerName()) {
         $controller = $request->getControllerName();
     } else {
         if (!empty($param)) {
             $controller = $param;
         } else {
             $controller = $this->getFront()->getDefault('controller');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
         }
     }
     return $controller;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:21,代码来源:Base.php

示例6: match

 public function match(Zend_Controller_Request_Http $request)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         return false;
     }
     $this->fetchDefault();
     $front = $this->getFront();
     $p = explode('/', trim($request->getPathInfo(), '/'));
     // get module name
     if ($request->getModuleName()) {
         $module = $request->getModuleName();
     } else {
         if (!empty($p[0])) {
             $module = $p[0];
         } else {
             $module = $this->getFront()->getDefault('module');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, '');
         }
     }
     if (!$module) {
         return false;
     }
     $realModule = $this->getModuleByFrontName($module);
     if (!$realModule) {
         if ($moduleFrontName = array_search($module, $this->_modules)) {
             $realModule = $module;
             $module = $moduleFrontName;
         } else {
             return false;
         }
     }
     $request->setRouteName($this->getRouteByFrontName($module));
     // get controller name
     if ($request->getControllerName()) {
         $controller = $request->getControllerName();
     } else {
         if (!empty($p[1])) {
             $controller = $p[1];
         } else {
             $controller = $front->getDefault('controller');
             $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
         }
     }
     $controllerFileName = $this->getControllerFileName($realModule, $controller);
     if (!$this->validateControllerFileName($controllerFileName)) {
         return false;
     }
     $controllerClassName = $this->getControllerClassName($realModule, $controller);
     if (!$controllerClassName) {
         return false;
     }
     // get action name
     if (empty($action)) {
         if ($request->getActionName()) {
             $action = $request->getActionName();
         } else {
             $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
         }
     }
     $this->_checkShouldBeSecure($request, '/' . $module . '/' . $controller . '/' . $action);
     // include controller file if needed
     if (!class_exists($controllerClassName, false)) {
         if (!file_exists($controllerFileName)) {
             return false;
         }
         include $controllerFileName;
         if (!class_exists($controllerClassName, false)) {
             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:HelioFreitas,项目名称:magento-pt_br,代码行数:89,代码来源:Standard.php


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