本文整理汇总了PHP中Mage_Core_Controller_Request_Http::setControllerName方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::setControllerName方法的具体用法?PHP Mage_Core_Controller_Request_Http::setControllerName怎么用?PHP Mage_Core_Controller_Request_Http::setControllerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::setControllerName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _forward
/**
* Forward current request
*
* @param string $action
* @param string $module
* @param string $controller
* @return void
*/
protected function _forward($action = 'denied', $module = null, $controller = null)
{
if ($this->_request->getActionName() === $action && (null === $module || $this->_request->getModuleName() === $module) && (null === $controller || $this->_request->getControllerName() === $controller)) {
return;
}
$this->_request->initForward();
if ($module) {
$this->_request->setModuleName($module);
}
if ($controller) {
$this->_request->setControllerName($controller);
}
$this->_request->setActionName($action)->setDispatched(false);
}
示例2: _forward
/**
* Forward current request
*
* @param string $action
* @param string $module
* @param string $controller
*/
protected function _forward($action = 'denied', $module = null, $controller = null)
{
$actionName = strtolower($this->_request->getActionName());
// avoid cycling
if ($actionName === $action && (null === $module || $this->_request->getModuleName() === $module) && (null === $controller || $this->_request->getControllerName() === $controller)) {
return;
}
$this->_request->initForward();
if ($module) {
$this->_request->setModuleName($module);
}
if ($controller) {
$this->_request->setControllerName($controller);
}
$this->_request->setActionName($action)->setDispatched(false);
$this->_isForwarded = true;
}
示例3: getDynamicBlockReplacement
/**
* Calls the diehard/load controller without spawning a new request
*
* @param array $params
* @return string
*/
public function getDynamicBlockReplacement($params)
{
// Append dynamic block content to end of page to be replaced by javascript, but not Ajax
if ($params['blocks'] || !empty($params['all_blocks'])) {
// Init store if it has not been yet (page served from cache)
if (!$this->helper()->isAppInited()) {
$this->helper()->initApp();
} else {
// Reset layout
Mage::unregister('_singleton/core/layout');
Mage::getSingleton('core/layout');
// TODO Mage::app()->getLayout() is not reset using the method above!
// TODO Consider resetting Magento entirely using Mage::reset();
}
// Create a sub-request to get JSON response
$uri = $this->getBaseUrl() . '/_diehard/load/ajax';
$request = new Mage_Core_Controller_Request_Http($uri);
$request->setRouteName('diehard');
$request->setModuleName('_diehard');
$request->setControllerName('load');
$request->setActionName('ajax');
$request->setControllerModule('Cm_Diehard');
$request->setParam('full_action_name', $params['full_action_name']);
if (!empty($params['all_blocks'])) {
$request->setParam('all_blocks', 1);
} else {
$request->setParam('blocks', $params['blocks']);
}
$request->setParam('params', $params['params']);
$request->setDispatched(true);
// Override parameters in request singleton (for Mage_Core_Block_Abstract#getRequest())
Mage::app()->getRequest()->clearParams();
Mage::app()->getRequest()->setParams($request->getParams());
Mage::app()->getRequest()->setParams($request->getParam('params'));
// Render sub-request into sub-response object
$response = new Mage_Core_Controller_Response_Http();
require_once Mage::getModuleDir('controllers', 'Cm_Diehard') . '/LoadController.php';
$controller = new Cm_Diehard_LoadController($request, $response);
$controller->dispatch('json');
$replacement = '';
if ($this->helper()->isDebug()) {
$replacement .= '<!-- Dynamic blocks rendered: ' . (empty($params['all_blocks']) ? implode(',', $params['blocks']) : 'ALL') . ' -->' . "\n";
}
$replacement .= "<script type=\"text/javascript\">/* <![CDATA[ */Diehard.replaceBlocks({$response->getBody()});/* ]]> */</script>";
return $replacement;
} else {
if ($this->helper()->isDebug()) {
return '<!-- No dynamic blocks -->';
} else {
return '';
}
}
}
示例4: testGetSecretKeyForwarded
/**
* @magentoConfigFixture global/helpers/core/encryption_model Mage_Core_Model_Encryption
* @magentoAppIsolation enabled
*/
public function testGetSecretKeyForwarded()
{
$request = new Mage_Core_Controller_Request_Http();
$request->setControllerName('controller')->setActionName('action');
$request->initForward()->setControllerName(uniqid())->setActionName(uniqid());
$this->_model->setRequest($request);
Mage::getSingleton('Mage_Core_Model_Session')->setData('_form_key', 'salt');
$this->assertEquals('c36d05473b54f437889608cbe8d50339', $this->_model->getSecretKey());
}