mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
Renamed Request::getRequestMethod() to Request::getMethod().
This commit is contained in:
@@ -99,7 +99,7 @@ class AccessRule extends Component
|
|||||||
if ($this->matchAction($action)
|
if ($this->matchAction($action)
|
||||||
&& $this->matchRole($user)
|
&& $this->matchRole($user)
|
||||||
&& $this->matchIP($request->getUserIP())
|
&& $this->matchIP($request->getUserIP())
|
||||||
&& $this->matchVerb($request->getRequestMethod())
|
&& $this->matchVerb($request->getMethod())
|
||||||
&& $this->matchController($action->controller)
|
&& $this->matchController($action->controller)
|
||||||
&& $this->matchCustom($action)
|
&& $this->matchCustom($action)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class HttpCache extends ActionFilter
|
|||||||
*/
|
*/
|
||||||
public function beforeAction($action)
|
public function beforeAction($action)
|
||||||
{
|
{
|
||||||
$verb = Yii::$app->request->getRequestMethod();
|
$verb = Yii::$app->request->getMethod();
|
||||||
if ($verb !== 'GET' && $verb !== 'HEAD' || $this->lastModified === null && $this->etagSeed === null) {
|
if ($verb !== 'GET' && $verb !== 'HEAD' || $this->lastModified === null && $this->etagSeed === null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Request extends \yii\base\Request
|
|||||||
/**
|
/**
|
||||||
* @var string|boolean the name of the POST parameter that is used to indicate if a request is a PUT or DELETE
|
* @var string|boolean the name of the POST parameter that is used to indicate if a request is a PUT or DELETE
|
||||||
* request tunneled through POST. Default to '_method'.
|
* request tunneled through POST. Default to '_method'.
|
||||||
* @see getRequestMethod
|
* @see getMethod
|
||||||
* @see getRestParams
|
* @see getRestParams
|
||||||
*/
|
*/
|
||||||
public $restVar = '_method';
|
public $restVar = '_method';
|
||||||
@@ -81,7 +81,7 @@ class Request extends \yii\base\Request
|
|||||||
* @return string request method, such as GET, POST, HEAD, PUT, DELETE.
|
* @return string request method, such as GET, POST, HEAD, PUT, DELETE.
|
||||||
* The value returned is turned into upper case.
|
* The value returned is turned into upper case.
|
||||||
*/
|
*/
|
||||||
public function getRequestMethod()
|
public function getMethod()
|
||||||
{
|
{
|
||||||
if (isset($_POST[$this->restVar])) {
|
if (isset($_POST[$this->restVar])) {
|
||||||
return strtoupper($_POST[$this->restVar]);
|
return strtoupper($_POST[$this->restVar]);
|
||||||
@@ -96,7 +96,7 @@ class Request extends \yii\base\Request
|
|||||||
*/
|
*/
|
||||||
public function getIsPostRequest()
|
public function getIsPostRequest()
|
||||||
{
|
{
|
||||||
return $this->getRequestMethod() === 'POST';
|
return $this->getMethod() === 'POST';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,7 +105,7 @@ class Request extends \yii\base\Request
|
|||||||
*/
|
*/
|
||||||
public function getIsDeleteRequest()
|
public function getIsDeleteRequest()
|
||||||
{
|
{
|
||||||
return $this->getRequestMethod() === 'DELETE';
|
return $this->getMethod() === 'DELETE';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +114,7 @@ class Request extends \yii\base\Request
|
|||||||
*/
|
*/
|
||||||
public function getIsPutRequest()
|
public function getIsPutRequest()
|
||||||
{
|
{
|
||||||
return $this->getRequestMethod() === 'PUT';
|
return $this->getMethod() === 'PUT';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +141,7 @@ class Request extends \yii\base\Request
|
|||||||
/**
|
/**
|
||||||
* Returns the request parameters for the RESTful request.
|
* Returns the request parameters for the RESTful request.
|
||||||
* @return array the RESTful request parameters
|
* @return array the RESTful request parameters
|
||||||
* @see getRequestMethod
|
* @see getMethod
|
||||||
*/
|
*/
|
||||||
public function getRestParams()
|
public function getRestParams()
|
||||||
{
|
{
|
||||||
@@ -772,7 +772,7 @@ class Request extends \yii\base\Request
|
|||||||
if (!$this->enableCsrfValidation) {
|
if (!$this->enableCsrfValidation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$method = $this->getRequestMethod();
|
$method = $this->getMethod();
|
||||||
if ($method === 'POST' || $method === 'PUT' || $method === 'DELETE') {
|
if ($method === 'POST' || $method === 'PUT' || $method === 'DELETE') {
|
||||||
$cookies = $this->getCookies();
|
$cookies = $this->getCookies();
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class UrlRule extends Object
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->verb !== null && !in_array($request->getRequestMethod(), $this->verb, true)) {
|
if ($this->verb !== null && !in_array($request->getMethod(), $this->verb, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class VerbFilter extends Behavior
|
|||||||
{
|
{
|
||||||
$action = $event->action->id;
|
$action = $event->action->id;
|
||||||
if (isset($this->actions[$action])) {
|
if (isset($this->actions[$action])) {
|
||||||
$verb = Yii::$app->getRequest()->getRequestMethod();
|
$verb = Yii::$app->getRequest()->getMethod();
|
||||||
$allowed = array_map('strtoupper', $this->actions[$action]);
|
$allowed = array_map('strtoupper', $this->actions[$action]);
|
||||||
if (!in_array($verb, $allowed)) {
|
if (!in_array($verb, $allowed)) {
|
||||||
$event->isValid = false;
|
$event->isValid = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user