本文整理汇总了PHP中Zend_Controller_Request_Http::setAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::setAlias方法的具体用法?PHP Zend_Controller_Request_Http::setAlias怎么用?PHP Zend_Controller_Request_Http::setAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::setAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: testGetAliasedParamZF2455
public function testGetAliasedParamZF2455()
{
$this->_request->setParam('controller', 'value');
$this->_request->setAlias('var1', 'controller');
$this->assertEquals('value', $this->_request->getParam('controller'));
$this->assertEquals('value', $this->_request->getParam('var1'));
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: _rewriteDb
/**
* Implement logic of custom rewrites
*
* @return bool
*/
protected function _rewriteDb()
{
if (null === $this->_rewrite->getStoreId() || false === $this->_rewrite->getStoreId()) {
$this->_rewrite->setStoreId($this->_app->getStore()->getId());
}
$requestCases = $this->_getRequestCases();
$this->_rewrite->loadByRequestPath($requestCases);
$fromStore = $this->_request->getQuery('___from_store');
if (!$this->_rewrite->getId() && $fromStore) {
$stores = $this->_app->getStores(false, true);
if (!empty($stores[$fromStore])) {
/** @var $store Mage_Core_Model_Store */
$store = $stores[$fromStore];
$fromStoreId = $store->getId();
} else {
return false;
}
$this->_rewrite->setStoreId($fromStoreId)->loadByRequestPath($requestCases);
if (!$this->_rewrite->getId()) {
return false;
}
// Load rewrite by id_path
$currentStore = $this->_app->getStore();
$this->_rewrite->setStoreId($currentStore->getId())->loadByIdPath($this->_rewrite->getIdPath());
$this->_setStoreCodeCookie($currentStore->getCode());
$targetUrl = $currentStore->getBaseUrl() . $this->_rewrite->getRequestPath();
$this->_sendRedirectHeaders($targetUrl, true);
}
if (!$this->_rewrite->getId()) {
return false;
}
$this->_request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $this->_rewrite->getRequestPath());
$this->_processRedirectOptions();
return true;
}
示例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)
{
$this->_request = $request;
if ($this->_match() !== false) {
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getPathInfo(), '/'));
return true;
}
return false;
}
示例9: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::app()->isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
//echo '<pre>';print_r(Mage::app()->getRequest());exit;
$urlRoot = Mage::app()->getRequest()->getPathInfo();
if (!strstr($urlRoot . '/', "/blog/")) {
return true;
}
$route = Mage::helper('blog')->getRoute();
$uri = str_replace("/blog/", "", strstr(Mage::app()->getRequest()->getPathInfo(), "/blog/"));
if (!Mage::registry('request_path')) {
Mage::register('request_path', $uri);
}
$request->setAlias(self::REWRITE_REQUEST_PATH_ALIAS, 'blog/' . $uri);
if (trim($uri, "/") == "taglist") {
Mage::app()->getRequest()->setControllerName('tag');
Mage::app()->getRequest()->setActionName('taglist');
return true;
}
if ($uri) {
$requestInfo = trim($uri);
$tmp = explode("_", $requestInfo);
if ($tmp[0] == "adminhtml") {
return true;
}
$urlData = $this->analyticUrl($requestInfo);
if ($postId = $urlData->getPostId()) {
Mage::app()->getRequest()->setControllerName('post');
Mage::app()->getRequest()->setActionName('view');
Mage::app()->getRequest()->setParam('id', $postId);
$contentUrl = explode("/", $uri);
if (count($contentUrl) > 1) {
unset($contentUrl[count($contentUrl) - 1]);
Mage::app()->getRequest()->setParam('cat_id', $this->analyticUrl(implode('/', $contentUrl) . '.html')->getCategoryId());
}
return true;
} elseif ($tagId = $urlData->getTagId()) {
Mage::app()->getRequest()->setControllerName('tag');
Mage::app()->getRequest()->setActionName('view');
Mage::app()->getRequest()->setParam('tag_id', $tagId);
return true;
} elseif ($catId = $urlData->getCategoryId()) {
Mage::app()->getRequest()->setControllerName('category');
Mage::app()->getRequest()->setActionName('view');
Mage::app()->getRequest()->setParam('id', $catId);
return true;
}
}
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)
{
$this->_request = $request;
if (($requestUri = $this->_preparePathInfo($request->getPathInfo())) === false) {
return false;
}
if ($this->_match($requestUri) !== false) {
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $requestUri . Mage::getStoreConfig('attributeSplash/seo/url_suffix'));
Mage::helper('attributeSplash')->clearLayerRewrites();
return true;
}
return false;
}
示例11: match
/**
* Checks
*
*/
public function match(Zend_Controller_Request_Http $request)
{
$params = trim($request->getPathInfo(), '/');
$params = explode('/', $params);
$attribute_code = $params[0];
$identifier = null;
if (isset($params[1])) {
$identifier = $params[1];
}
$allowedAttributes = explode(',', Mage::getStoreConfig('dc_catalog/attributes/selectedattributes'));
$attributes = Mage::getModel('dc_catalog/manufacturer');
/* @var $attributes DC_Catalog_Model_Manufacturer */
if (in_array($attribute_code, $allowedAttributes)) {
//we have something here... try to match to one of the existing attributes
//first, search in attribute_pages for an existing match
if ($attributePageId = $attributes->checkIdentifierInPages($attribute_code, $identifier, Mage::app()->getStore()->getId())) {
//we have a winnnner!!!
$request->setModuleName('attributeinfo')->setControllerName('AttributeInfo')->setActionName('view')->setParam('attribute_page_id', $attributePageId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $attribute_code . '/' . $identifier);
return true;
}
//second, search in attributes for a possible match
if (($option_id = $attributes->getOptionIdFromIdentifier($attribute_code, $identifier, Mage::app()->getStore()->getId())) > 0) {
//if ($attributes->getData('attribute_code') > '') {
//we have another winnnner!!!
$request->setModuleName('attributeinfo')->setControllerName('AttributeInfo')->setActionName('view')->setParam('attribute_code', $attribute_code)->setParam('option_id', $option_id);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $attribute_code . '/' . $identifier);
return true;
//}
}
//well.. just display all the values
$request->setModuleName('attributeinfo')->setControllerName('AttributeInfo')->setActionName('viewAll')->setParam('attribute_code', $attribute_code);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $attribute_code . '/' . $identifier);
return true;
}
//we didn't find anything acceptable in this router, resume search in others
return false;
}
示例12: 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;
}
示例13: 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;
}
示例14: match
public function match(Zend_Controller_Request_Http $request)
{
if (!AO::isInstalled()) {
AO::app()->getFrontController()->getResponse()->setRedirect(AO::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
$page = AO::getModel('cms/page');
$pageId = $page->checkIdentifier($identifier, AO::app()->getStore()->getId());
if (!$pageId) {
return false;
}
$request->setModuleName(isset($d[0]) ? $d[0] : 'cms')->setControllerName(isset($d[1]) ? $d[1] : 'page')->setActionName(isset($d[2]) ? $d[2] : 'view')->setParam('page_id', $pageId);
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
return true;
}
示例15: 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)
{
$urlKey = trim($request->getPathInfo(), '/');
if ($urlKey === 'splash-sitemap.xml') {
$request->setModuleName($this->_getFrontName())->setControllerName('sitemap')->setActionName('index');
return true;
}
$page = Mage::getModel('splash/page')->setStoreId(Mage::app()->getStore()->getId())->loadByUrlKey($urlKey);
if (!$page->getId() || !$page->isEnabled()) {
return false;
}
Mage::getConfig()->setNode('mageworx_seo/seosuite/disable_layered_rewrites', true, true);
Mage::app()->getStore()->setConfig('mageworx_seo/seosuite/disable_layered_rewrites', true);
Mage::register('splash_page', $page);
$request->setModuleName($this->_getFrontName())->setControllerName('page')->setActionName('view')->setParam('page_id', $page->getId());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $urlKey);
return true;
}