Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
13eca905
Commit
13eca905
authored
Jun 06, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring Request.
parent
021f6f03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
Request.php
framework/yii/web/Request.php
+8
-8
UrlManager.php
framework/yii/web/UrlManager.php
+1
-1
No files found.
framework/yii/web/Request.php
View file @
13eca905
...
...
@@ -94,7 +94,7 @@ class Request extends \yii\base\Request
* Returns whether this is a POST request.
* @return boolean whether this is a POST request.
*/
public
function
getIsPost
Request
()
public
function
getIsPost
()
{
return
$this
->
getMethod
()
===
'POST'
;
}
...
...
@@ -103,7 +103,7 @@ class Request extends \yii\base\Request
* Returns whether this is a DELETE request.
* @return boolean whether this is a DELETE request.
*/
public
function
getIsDelete
Request
()
public
function
getIsDelete
()
{
return
$this
->
getMethod
()
===
'DELETE'
;
}
...
...
@@ -112,7 +112,7 @@ class Request extends \yii\base\Request
* Returns whether this is a PUT request.
* @return boolean whether this is a PUT request.
*/
public
function
getIsPut
Request
()
public
function
getIsPut
()
{
return
$this
->
getMethod
()
===
'PUT'
;
}
...
...
@@ -121,7 +121,7 @@ class Request extends \yii\base\Request
* Returns whether this is an AJAX (XMLHttpRequest) request.
* @return boolean whether this is an AJAX (XMLHttpRequest) request.
*/
public
function
getIsAjax
Request
()
public
function
getIsAjax
()
{
return
isset
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
&&
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
]
===
'XMLHttpRequest'
;
}
...
...
@@ -130,7 +130,7 @@ class Request extends \yii\base\Request
* Returns whether this is an Adobe Flash or Flex request.
* @return boolean whether this is an Adobe Flash or Adobe Flex request.
*/
public
function
getIsFlash
Request
()
public
function
getIsFlash
()
{
return
isset
(
$_SERVER
[
'HTTP_USER_AGENT'
])
&&
(
stripos
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'Shockwave'
)
!==
false
||
stripos
(
$_SERVER
[
'HTTP_USER_AGENT'
],
'Flash'
)
!==
false
);
...
...
@@ -203,7 +203,7 @@ class Request extends \yii\base\Request
* @return mixed the GET parameter value
* @see getPost
*/
public
function
get
Param
(
$name
,
$defaultValue
=
null
)
public
function
get
(
$name
,
$defaultValue
=
null
)
{
return
isset
(
$_GET
[
$name
])
?
$_GET
[
$name
]
:
$defaultValue
;
}
...
...
@@ -229,7 +229,7 @@ class Request extends \yii\base\Request
*/
public
function
getDelete
(
$name
,
$defaultValue
=
null
)
{
return
$this
->
getIsDelete
Request
()
?
$this
->
getRestParam
(
$name
,
$defaultValue
)
:
null
;
return
$this
->
getIsDelete
()
?
$this
->
getRestParam
(
$name
,
$defaultValue
)
:
null
;
}
/**
...
...
@@ -240,7 +240,7 @@ class Request extends \yii\base\Request
*/
public
function
getPut
(
$name
,
$defaultValue
=
null
)
{
return
$this
->
getIsPut
Request
()
?
$this
->
getRestParam
(
$name
,
$defaultValue
)
:
null
;
return
$this
->
getIsPut
()
?
$this
->
getRestParam
(
$name
,
$defaultValue
)
:
null
;
}
private
$_hostInfo
;
...
...
framework/yii/web/UrlManager.php
View file @
13eca905
...
...
@@ -196,7 +196,7 @@ class UrlManager extends Component
return
array
(
$pathInfo
,
array
());
}
else
{
$route
=
$request
->
get
Param
(
$this
->
routeVar
);
$route
=
$request
->
get
(
$this
->
routeVar
);
if
(
is_array
(
$route
))
{
$route
=
''
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment