本文整理汇总了PHP中Zend_Controller_Request_Abstract::getModuleKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getModuleKey方法的具体用法?PHP Zend_Controller_Request_Abstract::getModuleKey怎么用?PHP Zend_Controller_Request_Abstract::getModuleKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getModuleKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _changeDispatch
private function _changeDispatch(Zend_Controller_Request_Abstract &$request, Zend_Controller_Response_Abstract $response)
{
$module = $request->getParam($request->getModuleKey());
$controller = $request->getParam($request->getControllerKey());
$action = $request->getParam($request->getActionKey());
$submodule = '';
$subcontroller = '';
$subaction = '';
if ('admin' != $module) {
$submodule = $module;
$subcontroller = $controller ? $controller : 'index';
$subaction = $action ? $action : 'index';
$controller = 'index';
$action = 'subroute';
$module = 'default';
} else {
$submodule = $controller;
$subcontroller = $action ? $action : 'index';
//долно быть настроено в route
//$subaction = ( $action ) ? $action : 'index';
$controller = 'index';
$action = 'subroute';
}
$request->setParam($request->getModuleKey(), $module);
$request->setModuleName($module);
$request->setParam($request->getControllerKey(), $controller);
$request->setControllerName($controller);
$request->setParam($request->getActionKey(), $action);
$request->setActionName($action);
$request->setParam('submodule', $submodule);
$request->setParam('subcontroller', $subcontroller);
$request->setParam('subaction', $subaction);
}
示例2: init
/**
* 初始化
*
* @return void
*/
public function init()
{
//request和response对象获取
$this->request = $this->getRequest();
$this->response = $this->getResponse();
$this->modKey = $this->request->getModuleKey();
$this->modName = $this->request->getModuleName();
$this->ctlKey = $this->request->getControllerKey();
$this->ctlName = $this->request->getControllerName();
$this->actKey = $this->request->getActionKey();
$this->actName = $this->request->getActionName();
//smarty模板设置
$this->view = Common_View::getInstance();
//重新设置模板目录
$_viewBaseDir = implode(DS, array(APP_NOPUBLIC_MODULES_PATH, $this->modName, 'views'));
$params = array('template_dir' => $_viewBaseDir . DS . 'html', 'compile_dir' => $_viewBaseDir . DS . 'compile', 'cache_dir' => $_viewBaseDir . DS . 'cache');
$this->view->setViewParams($params);
unset($_viewBaseDir);
}
示例3: _setRequestKeys
/**
* Set request keys based on values in request object
*
* @return void
*/
protected function _setRequestKeys()
{
if (null !== $this->_request) {
$this->_moduleKey = $this->_request->getModuleKey();
$this->_controllerKey = $this->_request->getControllerKey();
$this->_actionKey = $this->_request->getActionKey();
}
if (null !== $this->_dispatcher) {
$this->_defaults += array($this->_controllerKey => $this->_dispatcher->getDefaultControllerName(), $this->_actionKey => $this->_dispatcher->getDefaultAction(), $this->_moduleKey => $this->_dispatcher->getDefaultModule());
}
$this->_keysSet = true;
}
示例4: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
try {
// Set Request Object
$_request[$request->getModuleKey()] = $request->getModuleName();
$_request[$request->getControllerKey()] = $request->getControllerName();
$_request[$request->getActionKey()] = $request->getActionName();
if (PHP_SAPI != 'cli' && $request->getModuleName() != 'cronjob') {
$_request['url'] = $_SERVER['REQUEST_URI'];
}
Monitor_Request::getInstance()->setRequest($_request);
} catch (Zend_Exception $e) {
throw $e;
}
}
示例5: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
$frontController = Zend_Controller_Front::getInstance();
// Request keys
$moduleKey = $request->getModuleKey();
$controllerKey = $request->getControllerKey();
$actionKey = $request->getActionKey();
// Defaults
$moduleName = $frontController->getDefaultModule();
$controllerName = $frontController->getDefaultControllerName();
$actionName = $frontController->getDefaultAction();
// Set a url path
$module = $request->getQuery($moduleKey, $moduleName);
$controller = $request->getQuery($controllerKey, $controllerName);
$action = $request->getQuery($actionKey, $actionName);
// Assemble
if ($request->getPathInfo() == '/') {
$modulePart = $module == $moduleName ? $module : '/' . $module;
$controllerPart = $controller == $controllerName && $action == $actionName ? '' : '/' . $controller;
$actionPart = $action == $actionName && $controller ? '' : '/' . $action;
$request->setPathInfo($modulePart . $controllerPart . $actionPart);
}
}
示例6: _setRequestParams
/**
* Sets parameters for request object
*
* Module name, controller name and action name
*
* @param Zend_Controller_Request_Abstract $request
* @param array $params
*/
protected function _setRequestParams($request, $params)
{
foreach ($params as $param => $value) {
$request->setParam($param, $value);
if ($param === $request->getModuleKey()) {
$request->setModuleName($value);
}
if ($param === $request->getControllerKey()) {
$request->setControllerName($value);
}
if ($param === $request->getActionKey()) {
$request->setActionName($value);
}
}
}
示例7: applyRequest
/**
* Filters a request for use with applyParameters.
*
* @param \Zend_Controller_Request_Abstract $request
* @param boolean $removePost Optional
* @param boolean $includeNumericFilters When true numeric filter keys (0, 1, 2...) are added to the filter as well
* @return \MUtil_Model_ModelAbstract
*/
public function applyRequest(\Zend_Controller_Request_Abstract $request, $removePost = true, $includeNumericFilters = false)
{
$parameters = $request->getParams();
// Remove MVC fields
unset($parameters[$request->getModuleKey()], $parameters[$request->getControllerKey()], $parameters[$request->getActionKey()]);
if ($removePost) {
// Do not use POST fields for filter
$parameters = array_diff_key($parameters, $_POST);
}
// Remove all empty values (but not arrays) from the filter
$parameters = array_filter($parameters, function ($i) {
return is_array($i) || strlen($i);
});
$this->applyParameters($parameters, $includeNumericFilters);
return $this;
}