本文整理汇总了PHP中Zend_Controller_Request_Http::setModuleName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::setModuleName方法的具体用法?PHP Zend_Controller_Request_Http::setModuleName怎么用?PHP Zend_Controller_Request_Http::setModuleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::setModuleName方法的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
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;
}
示例3: testShouldAllowAccessForCorrectRole
public function testShouldAllowAccessForCorrectRole()
{
$request = $this->request->setModuleName('admin')->setControllerName('index')->setActionName('index');
$this->acl->addResource('admin_index');
$this->acl->allow(Acl::ROLE_GUEST, 'admin_index');
$plugin = new Acl($this->acl);
$plugin->setRequest($this->request);
$plugin->preDispatch();
$this->assertEquals('admin', $this->request->getModuleName());
$this->assertEquals('index', $this->request->getControllerName());
$this->assertEquals('index', $this->request->getActionName());
}
示例4: match
public function match(Zend_Controller_Request_Http $request)
{
//default route (404)
$d = explode('/', Mage::getStoreConfig('web/default/no_route'));
$request->setModuleName(isset($d[0]) ? $d[0] : 'core')->setControllerName(isset($d[1]) ? $d[1] : 'index')->setActionName(isset($d[2]) ? $d[2] : 'index');
return true;
}
示例5: testPassingDefaultModuleShouldNotRenderModuleNameInRedirectUrl
public function testPassingDefaultModuleShouldNotRenderModuleNameInRedirectUrl()
{
$this->request->setModuleName('admin')->setControllerName('class')->setActionName('view');
$this->redirector->gotoSimple('login', 'account', 'default');
$test = $this->redirector->getRedirectUrl();
$this->assertEquals('/account/login', $test, $test);
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
}
示例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(), '/');
$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;
}
示例10: 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;
}
示例11: testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag
public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferenceFlag()
{
$this->request->setModuleName('bar')
->setControllerName('index')
->setActionName('test');
$controller = new Bar_IndexController($this->request, $this->response, array());
$this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views');
require_once 'Zend/Filter/PregReplace.php';
require_once 'Zend/Filter/Word/UnderscoreToSeparator.php';
$inflector = new Zend_Filter_Inflector('test.phtml');
$inflector->addRules(array(
':module' => array('Word_CamelCaseToDash', 'stringToLower'),
':controller' => array('Word_CamelCaseToDash', new Zend_Filter_Word_UnderscoreToSeparator(DIRECTORY_SEPARATOR), 'StringToLower'),
':action' => array(
'Word_CamelCaseToDash',
new Zend_Filter_PregReplace('/[^a-z0-9]+/i', '-'),
'StringToLower'
),
));
$this->helper->setInflector($inflector, true);
$this->helper->render();
$body = $this->response->getBody();
$this->assertContains('Rendered index/test.phtml in bar module', $body);
}
示例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;
}
$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;
}
示例13: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$front = Zend_Controller_Front::getInstance();
// Front controller has error handler plugin
// if the request is an error request.
// If the error handler plugin is not registered,
// we will be unable which MCA to run, so do not continue.
$errorHandlerClass = 'Zend_Controller_Plugin_ErrorHandler';
if (!$front->hasPlugin($errorHandlerClass)) {
return false;
}
// Determine new error controller module_ErrorController_ErrorAction
$plugin = $front->getPlugin($errorHandlerClass);
$errorController = $plugin->getErrorHandlerController();
$errorAaction = $plugin->getErrorHandlerAction();
$module = $request->getModuleName();
// Create test request module_ErrorController_ErrorAction...
$testRequest = new Zend_Controller_Request_Http();
$testRequest->setModuleName($module)->setControllerName($errorController)->setActionName($errorAaction);
// Set new error controller if available
if ($front->getDispatcher()->isDispatchable($testRequest)) {
$plugin->setErrorHandlerModule($module);
} else {
return false;
}
return true;
}
示例14: 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;
}
示例15: testViewScriptNameDoesNotIncludeDisallowedCharacters
/**
* @group ZF-10725
* @dataProvider providerViewScriptNameDoesNotIncludeDisallowedCharacters
*/
public function testViewScriptNameDoesNotIncludeDisallowedCharacters($actionName)
{
$this->request->setModuleName('default')->setControllerName('foo')->setActionName($actionName);
$controller = new Bar_IndexController($this->request, $this->response, array());
$this->helper->setActionController($controller);
$scriptName = $this->helper->getViewScript();
$this->assertEquals('foo/my-bar.phtml', $scriptName);
}