本文整理汇总了PHP中Zend_Controller_Request_Http::getPathInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getPathInfo方法的具体用法?PHP Zend_Controller_Request_Http::getPathInfo怎么用?PHP Zend_Controller_Request_Http::getPathInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getPathInfo方法的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());
}
示例2: matchForwardMultilevel
protected function matchForwardMultilevel()
{
$pageId = $this->request->getPathInfo();
$pageId = $this->getUrlHelper()->checkRemoveSuffix($pageId);
$pageId = trim($pageId, '/') . '/';
$cat = $this->matchMultilevel($pageId);
if ($cat !== false) {
if ($cat) {
// normal category
$result = $this->forwardCategory($cat);
} else {
// root category
$this->forwardShopby();
$result = true;
}
if ($result && $this->urlMode == Amasty_Shopby_Model_Source_Url_Mode::MODE_SHORT && Mage::getStoreConfig('amshopby/seo/redirects_enabled')) {
/** @var Amasty_Shopby_Model_Url_Builder $urlBuilder */
$urlBuilder = Mage::getModel('amshopby/url_builder');
$urlBuilder->reset();
$urlBuilder->mode = $this->urlMode;
$url = $urlBuilder->getUrl();
Mage::app()->getResponse()->setRedirect($url, 301);
}
return true;
}
}
示例3: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$route = "f";
$identifier = $request->getPathInfo();
if (substr(str_replace("/", "", $identifier), 0, strlen($route)) != $route) {
return false;
}
$identifier = substr_replace($request->getPathInfo(), '', 0, strlen("/" . $route . "/"));
$identifier = str_replace('.html', '', $identifier);
$identifier = str_replace('.htm', '', $identifier);
$identifier = str_replace('.php', '', $identifier);
if ($identifier[strlen($identifier) - 1] == "/") {
$identifier = substr($identifier, '', -1);
}
$identifier = explode('/', $identifier, 3);
if (isset($identifier[1]) && isset($identifier[0]) && !isset($identifier[2])) {
$request->setModuleName('f')->setControllerName('index')->setActionName('view')->setParam('id', $identifier[0])->setParam('v', $identifier[1]);
return true;
} else {
return false;
}
}
示例4: _match
/**
* Match the request against all enabled splash routes
*
* @return bool
*/
protected function _match()
{
$requestUri = trim($this->_request->getPathInfo(), '/');
Mage::dispatchEvent('attributeSplash_match_routes_before', array('router' => $this, 'request_uri' => $requestUri));
if ($this->getRequest()->getModuleName() === 'splash') {
return true;
}
$isDoubleBarrel = strpos($requestUri, '/') !== false;
$includeGroupUrlKey = Mage::getStoreConfigFlag('attributeSplash/page/include_group_url_key');
$urlSuffix = rtrim(Mage::getStoreConfig('attributeSplash/seo/url_suffix'), '/');
if ($urlSuffix) {
if (substr($requestUri, -strlen($urlSuffix)) !== $urlSuffix) {
return false;
}
$requestUri = substr($requestUri, 0, -strlen($urlSuffix));
}
if ($isDoubleBarrel) {
// Must be splash page
if (!$includeGroupUrlKey) {
// URL contains / but no group key so should be single
return false;
}
list($groupUrlKey, $pageUrlKey) = explode('/', $requestUri);
return $this->_loadSplashPage($pageUrlKey, $groupUrlKey);
} else {
if ($includeGroupUrlKey) {
return $this->_loadSplashGroup($requestUri);
}
}
if ($this->_loadSplashPage($requestUri)) {
return true;
}
return $this->_loadSplashGroup($requestUri);
}
示例5: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$route = Mage::helper('clnews')->getRoute();
$identifier = $request->getPathInfo();
if (substr(str_replace("/", "", $identifier), 0, strlen($route)) != $route) {
return false;
}
$identifier = substr_replace($request->getPathInfo(), '', 0, strlen("/" . $route . "/"));
$identifier = str_replace(Mage::helper('clnews')->getNewsitemUrlSuffix(), '', $identifier);
if (substr($request->getPathInfo(), 0, 7) !== '/clnews') {
if ($identifier == '') {
$request->setModuleName('clnews')->setControllerName('index')->setActionName('index');
return true;
} elseif (substr($identifier, 0, 9) === 'category/') {
$len = strcspn($identifier, '/');
$key = substr($identifier, $len + 1);
$request->setModuleName('clnews')->setControllerName('index')->setActionName('index')->setParam('category', $key);
return true;
} elseif (substr($identifier, 0, 4) === 'rss/') {
$request->setModuleName('clnews')->setControllerName('rss')->setActionName('index');
return true;
} elseif ($pos = strpos($identifier, '/print/article/')) {
$param = substr($identifier, $pos + 15);
$param = trim(str_replace('/', '', $param));
$request->setModuleName('clnews')->setControllerName('newsitem')->setActionName('print')->setParam('article', $param);
return true;
} elseif (substr($identifier, 0, 9) === 'newsitem/') {
$str = str_replace('newsitem/view/id/', '', $identifier);
$len = strcspn($identifier, '/');
$id = substr($identifier, 0, $len);
$request->setModuleName('clnews')->setControllerName('newsitem')->setActionName('view')->setParam('id', $id);
return true;
} elseif ($pos = strpos($identifier, '/q/')) {
$param = substr($identifier, $pos + 2);
$param = trim(str_replace('/', '', $param));
$request->setModuleName('clnews')->setControllerName('index')->setActionName('index')->setParam('q', $param);
return true;
} elseif (substr($identifier, 0, 15) !== 'adminhtml_news/' && strpos($identifier, '/') && substr($request->getPathInfo(), 0, strlen($route) + 2) === '/' . $route . '/' && strpos($identifier, 'category/') === false) {
$len = strcspn($identifier, '/');
$category = substr($identifier, 0, $len);
$key = substr($identifier, $len + 1);
$request->setModuleName('clnews')->setControllerName('newsitem')->setActionName('view')->setParams(array('category' => $category, 'key' => $key));
return true;
} elseif (substr($request->getPathInfo(), 0, strlen($route) + 2) === '/' . $route . '/') {
$request->setModuleName('clnews')->setControllerName('newsitem')->setActionName('view')->setParam('key', $identifier);
return true;
}
}
return false;
}
示例6: match
/**
* match the route
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function match(Zend_Controller_Request_Http $request)
{
//if magento is not installed redirect to install
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
//get the url key
$urlKey = trim($request->getPathInfo(), '/');
//explode by slash
$parts = explode('/', $urlKey);
//if there are not 2 parts (tag/something) in the url we don't care about it.
//return false and let the rest of the application take care of the url.
if (count($parts) != 2) {
return false;
}
//if the first part of the url key is not 'tag' we don't care about it
//return false and let the rest of the application take care of the url
if ($parts[0] != 'tag') {
return false;
}
$tagName = urldecode($parts[1]);
//tag name
//load the tag model
$tag = Mage::getModel('tag/tag')->loadByName($tagName);
//if there is no tag with this name available in the current store just do nothing
if (!$tag->getId() || !$tag->isAvailableInStore()) {
return false;
}
//but if the tag is valid
//say to magento that the request should be mapped to `tag/product/list/tagId/ID_HERE` - the original url
$request->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $tag->getId());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}
示例7: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
/* @var $core Mana_Core_Helper_Data */
$core = Mage::helper('mana_core');
if ($core->getRoutePath() != '//') {
return false;
}
/* @var $routerHelper Mana_Core_Helper_Router */
$routerHelper = Mage::helper('mana_core/router');
$path = ltrim($request->getPathInfo(), '/');
$urlKey = Mage::getStoreConfig('mana/ajax/url_key_filter');
$routeSeparator = Mage::getStoreConfig('mana/ajax/route_separator_filter');
if ($core->startsWith($path, $urlKey . '/') && ($pos = strpos($path, '/' . $routeSeparator . '/')) > strlen($urlKey . '/')) {
$this->_route = substr($path, strlen($urlKey . '/'), $pos - strlen($urlKey . '/'));
$path = substr($path, $pos + strlen('/' . $routeSeparator));
$routerHelper->changePath($path)->processWithoutRendering($this, 'render');
$baseUrl = parse_url(Mage::getUrl(null, array('_nosid' => true)));
Mage::register('m_original_request_uri', $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = $baseUrl['path'] . ($path ? ltrim($path, '/') : '/') . (($queryPos = strpos($_SERVER['REQUEST_URI'], '?')) !== false ? substr($_SERVER['REQUEST_URI'], $queryPos) : '');
Mage::register('manapro_filterajax_request', 1);
$this->getCatalogSession()->setData('manapro_filterajax_request', 1);
if ($core->isEnterpriseUrlRewriteInstalled()) {
$this->_getRequestRewriteController()->rewrite();
} else {
Mage::getModel('core/url_rewrite')->rewrite();
}
}
return false;
}
示例8: match
/**
* Rewritten function of the standard controller. Tries to match the pathinfo on url parameters.
*
* @see Mage_Core_Controller_Varien_Router_Standard::match()
* @param Zend_Controller_Request_Http $request The http request object that needs to be mapped on Action Controllers.
*/
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(), '/');
// try to gather url parameters from parser.
/* @var $parser Flagbit_FilterUrls_Model_Parser */
$parser = Mage::getModel('filterurls/parser');
$parsedRequestInfo = $parser->parseFilterInformationFromRequest($identifier, Mage::app()->getStore()->getId());
if (!$parsedRequestInfo) {
return false;
}
Mage::register('filterurls_active', true);
// if successfully gained url parameters, use them and dispatch ActionController action
$request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $parsedRequestInfo['categoryId']);
$pathInfo = 'catalog/category/view/id/' . $parsedRequestInfo['categoryId'];
$requestUri = '/' . $pathInfo . '?';
foreach ($parsedRequestInfo['additionalParams'] as $paramKey => $paramValue) {
$requestUri .= $paramKey . '=' . $paramValue . '&';
}
$controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category');
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setRequestUri(substr($requestUri, 0, -1));
$request->setPathInfo($pathInfo);
// dispatch action
$request->setDispatched(true);
$controllerInstance->dispatch('view');
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例9: 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(), '/');
/* @var $parser Hackathon_Layeredlanding_Model_Layeredlanding */
$landingPage = Mage::getModel('layeredlanding/layeredlanding')->loadByUrl($identifier);
if (!$landingPage->getId()) {
return false;
}
Mage::register('current_landingpage', $landingPage);
Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Category::XML_PATH_USE_CATEGORY_CANONICAL_TAG, 0);
// disable canonical tag
// if successfully gained url parameters, use them and dispatch ActionController action
$categoryIdsValue = $landingPage->getCategoryIds();
$categoryIds = explode(',', $categoryIdsValue);
$firstCategoryId = $categoryIds[0];
$request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $firstCategoryId);
/** @var $attribute Hackathon_Layeredlanding_Model_Attributes */
foreach ($landingPage->getAttributes() as $attribute) {
$attr = Mage::getModel('eav/entity_attribute')->load($attribute->getAttributeId());
$request->setParam($attr->getAttributeCode(), $attribute->getValue());
}
$controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category');
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
// dispatch action
$request->setDispatched(true);
$controllerInstance->dispatch('view');
return true;
}
示例10: 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;
}
$pathInfo = $request->getPathInfo();
// remove suffix if any
$suffix = Mage::helper('amlanding/url')->getSuffix();
if ($suffix && '/' != $suffix) {
$pathInfo = str_replace($suffix, '', $pathInfo);
}
$pathInfo = explode('/', trim($pathInfo, '/ '), 2);
$identifier = $pathInfo[0];
$params = isset($pathInfo[1]) ? $pathInfo[1] : '';
/* @var $page Amasty_Xlanding_Model_Page */
$page = Mage::getModel('amlanding/page');
$pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
if (!$pageId) {
return false;
}
$params = trim($params, '/ ');
if ($params) {
$params = explode('/', $params);
Mage::register('amshopby_current_params', $params);
}
$request->setModuleName('amlanding')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId)->setParam('am_landing', $identifier);
return true;
}
示例11: 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(), '/');
$parts = explode('/', $identifier);
if (isset($parts[1]) && $parts[1] == 'reviews') {
$product = Mage::getModel('catalog/product')->loadByAttribute('url_key', $parts[0]);
if (isset($parts[2])) {
$p = explode('-', $parts[2]);
$id = (int) end($p);
$request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('view')->setParam('id', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews');
return true;
} else {
if ($product) {
$request->setRouteName('review')->setModuleName('review')->setControllerName('product')->setActionName('list')->setParam('id', $product->getId())->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'reviews');
return true;
}
}
} elseif ($parts[0] == 'tag' && isset($parts[1])) {
$p = explode('-', $parts[1]);
$id = (int) end($p);
$request->setRouteName('tag')->setModuleName('tag')->setControllerName('product')->setActionName('list')->setParam('tagId', $id)->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, 'tags');
return true;
}
return false;
}
示例12: match
/**
* See if any product matches
*
* @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;
}
// Clear session to make sure users can add products and the shopping cart clears properly
if (isset($_GET['zipcode'])) {
Mage::helper('urls')->clearSession($_GET['zipcode']);
}
// Get basic data
$identifier = urldecode(strtolower(trim($request->getPathInfo(), '/')));
$vendorsCollection = Mage::helper('urls')->getVendors();
$vendorId = false;
$productSlug = '';
// Get vendor id
$vendorId = $this->_detectVendorId($identifier, $vendorsCollection);
// Get product slug
preg_match('/.*\\/(.*).html$/', $identifier, $matches);
$productSlug = $matches[1];
if ($vendorId) {
Mage::register('vendorId', $vendorId);
$productId = Mage::helper('urls')->getProductIdBySlug($productSlug, $vendorId);
if ('' == $productId || empty($productId)) {
return false;
}
// Point to correct product
$request->setModuleName('catalog')->setControllerName('product')->setActionName('view')->setParam('id', $productId);
return true;
}
return false;
}
示例13: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$pathInfo = trim($request->getPathInfo(), '/');
//echo $pathInfo;die();
$pathInfoAr = explode('/', $pathInfo);
if ($pathInfoAr[0] == Mage::getStoreConfig('vc_miniblog/blog/router')) {
if (isset($pathInfoAr[1])) {
switch ($pathInfoAr[1]) {
case 'tag':
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
$request->setParams(array('tag' => $pathInfoAr[2]));
$request->setParams(array('tag' => $pathInfoAr[2]));
break;
case 'cat':
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
$request->setParams(array('cat' => $pathInfoAr[2]));
break;
default:
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('postDetail');
$request->setParams(array('identifier' => $pathInfoAr[1]));
break;
}
} else {
$request->setModuleName('vc_miniblog')->setControllerName('index')->setActionName('index');
}
return true;
}
return false;
}
示例14: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$pathInfo = trim($request->getPathInfo(), '/');
$params = explode('/', $pathInfo);
if (isset($params[0]) && $params[0] == 'miembro' || isset($params[0]) && $params[0] == 'member') {
//redirect to mymodule/brands/index/brand_name/addidas
$request->setModuleName('member')->setControllerName('index')->setActionName('index');
if (isset($params[1])) {
$request->setParam('member_url', $params[1]);
}
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo);
return true;
}
if (isset($params[0]) && $params[0] == 'mwcon') {
$request->setModuleName('member')->setControllerName('index')->setActionName('signin');
if (isset($params[1])) {
$request->setParam('member_id', $params[1]);
}
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $pathInfo);
return true;
}
return false;
}
示例15: match
/**
* Validate and match entities and modify request
*
* @access public
* @param Zend_Controller_Request_Http $request
* @return bool
* @author Ultimate Module Creator
*/
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$urlKey = trim($request->getPathInfo(), '/');
$check = array();
$check['trainevent'] = new Varien_Object(array('prefix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_prefix'), 'suffix' => Mage::getStoreConfig('wage_trainevent/trainevent/url_suffix'), 'list_key' => Mage::getStoreConfig('wage_trainevent/trainevent/url_rewrite_list'), 'list_action' => 'index', 'model' => 'wage_trainevent/trainevent', 'controller' => 'trainevent', 'action' => 'view', 'param' => 'id', 'check_path' => 0));
foreach ($check as $key => $settings) {
if ($settings->getListKey()) {
if ($urlKey == $settings->getListKey()) {
$request->setModuleName('wage_trainevent')->setControllerName($settings->getController())->setActionName($settings->getListAction());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}
}
if ($settings['prefix']) {
$parts = explode('/', $urlKey);
if ($parts[0] != $settings['prefix'] || count($parts) != 2) {
continue;
}
$urlKey = $parts[1];
}
if ($settings['suffix']) {
$urlKey = substr($urlKey, 0, -strlen($settings['suffix']) - 1);
}
$model = Mage::getModel($settings->getModel());
}
return false;
}