本文整理汇总了PHP中Zend_Controller_Request_Abstract::getMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::getMethod方法的具体用法?PHP Zend_Controller_Request_Abstract::getMethod怎么用?PHP Zend_Controller_Request_Abstract::getMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::getMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routeStartup
public function routeStartup(Zend_Controller_Request_Abstract $req)
{
$this->_time = microtime(true);
if ($req instanceof Zend_Controller_Request_Http) {
$this->_method = $req->getMethod();
$this->_path = $req->getPathInfo();
}
$this->_request = $req;
}
示例2: preDispatch
/**
*
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$front = Zend_Controller_Front::getInstance();
$logger = $front->getParam('bootstrap')->getResource('logger');
$logger->setEventItem('http', $request->isXmlHttpRequest() ? 'AJAX' : $request->getMethod());
$logger->setEventItem('module', $module);
$logger->setEventItem('controller', $controller);
$logger->setEventItem('action', $action);
}
示例3: routeShutdown
/**
* Set REST action/method based on cascading priority of allowed syntaxes
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
// Only do for API module
if ('api' != $this->getRequest()->getModuleName()) {
return;
}
$action = $request->getMethod();
// Support override of method request type
if ('get' != strtolower($action)) {
if ($request->getParam('_method')) {
$action = $request->getParam('_method');
} elseif ($request->getHeader('X-HTTP-Method-Override')) {
$action = $request->getHeader('X-HTTP-Method-Override');
}
}
$request->setActionName(strtolower($action));
}
示例4: _getPrivilege
protected function _getPrivilege(Zend_Controller_Request_Abstract $request)
{
$privilege = null;
if ($request instanceof Zend_Controller_Request_Http) {
$privilege = $request->getMethod();
}
return $privilege;
}
示例5: addHistory
/**
* addMessage() - Add an current navigation on history
*
* @param Zend_Controller_Request_Abstract $oRequest
* @param string $layout
* @return ZLayer_Controller_Request_History Provides a fluent interface
*/
public function addHistory(Zend_Controller_Request_Abstract $oRequest, $layout)
{
if (!is_array(self::$_session->history)) {
self::$_session->history = array();
}
$params = $oRequest->getParams();
if (isset($params['__format'])) {
$context = $params['__format'];
} else {
$context = 'default';
}
$array = array("action" => $oRequest->getActionName(), "controller" => $oRequest->getControllerName(), "module" => $oRequest->getModuleName(), "layout" => $layout, "params" => $oRequest->getParams(), "method" => $oRequest->getMethod(), "context" => $context, "secure" => $oRequest->isSecure(), "xmlHttpRequest" => $oRequest->isXmlHttpRequest(), "flashRequest" => $oRequest->isFlashRequest());
self::$_session->history[] = $array;
$histAr = self::$_session->history;
$revAr = array_reverse($histAr);
$limitRevAr = array_slice($revAr, 0, 10);
$newHistAr = array_reverse($limitRevAr);
self::$_session->history = $newHistAr;
return $this;
}
示例6: routeShutdown
/**
* This action will decide what controllers will be called and in which order
*
* Note: this can change the expected dispatch behaviour!
*
* @param $request
* @return void
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
//Check if the module is registered for HMVC
if (!$this->isActiveModule($request->getModuleName())) {
return;
}
//For some reason, unknown to me at this time, Zend_Controller_Request has lost all relevant info.
//Rebuild it from scratch.
$params = explode('/', trim($request->getPathInfo(), '/'));
if ($params[0] === $request->getModuleName()) {
//Unset the module if the same, not needed further
unset($params[0]);
}
$action = $request->getActionName();
$module = $request->getModuleName();
//Clear all params as new ones are on the way
$request->clearParams();
//Filter strings only
$names = array_filter($params, 'ctype_alpha');
//Filter digits only
$ids = array_filter($params, 'ctype_digit');
if (0 === count($names) && 0 === count($ids)) {
//We have nothing here to work with.. Assume default actions take over
return;
}
$dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
//Set some default params
$request->setParam('collection', false)->setParam('resource', true)->setParam('passthrough', true);
if (count($names) !== count($ids)) {
$ids = array_pad($ids, count($names), null);
$request->setParam('collection', true)->setParam('resource', false);
//Possible fix for crappy Zend_Rest_Route as the action is set to index
//Example: /rest/car should point to Hmvc/Controller/Car/"METHOD" to get a collection
if (!in_array($action, array('get', 'put', 'post', 'delete'))) {
$action = strtolower($request->getMethod());
}
}
//Combine all data
$params = array_combine($names, $ids);
$params['module'] = $module;
$params['action'] = $action;
$params['controller'] = $dispatcher->formatModuleName(current($names));
//Register with the request so the controllers can work with them
$request->setModuleName($module)->setActionName($action)->setParams($params);
$delimiter = $dispatcher->getPathDelimiter();
if (!Glitch_Registry::getConfig()->resources->hmvc->redispatch) {
$controller = $dispatcher->formatModuleName(implode($delimiter, $names));
$request->setControllerName($controller)->setParam('controller', $controller)->setDispatched(false)->setParam('passthrough', false);
return;
}
$nextController = '';
foreach ($names as $controller) {
//Collect the new controller string
$nextController .= $delimiter . $controller;
//Modify so it fits our structure and append to the controllers we want to handle
//We use formatModuleName as we already figured out our own structure
$this->_controllers[] = $dispatcher->formatModuleName(trim($nextController, $delimiter));
}
}