Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
dbc418c0
Commit
dbc418c0
authored
Jun 20, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed Request::is to Request::route_is.
parent
2b4093f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
request.php
system/request.php
+15
-15
router.php
system/router.php
+1
-1
No files found.
system/request.php
View file @
dbc418c0
...
...
@@ -74,17 +74,6 @@ class Request {
return
(
$uri
==
''
)
?
'/'
:
Str
::
lower
(
$uri
);
}
/**
* Determine if the route handling the request is a given name.
*
* @param string $name
* @return bool
*/
public
static
function
is
(
$name
)
{
return
(
is_array
(
static
::
$route
->
callback
)
and
isset
(
static
::
$route
->
callback
[
'name'
])
and
static
::
$route
->
callback
[
'name'
]
===
$name
);
}
/**
* Get the request method.
*
...
...
@@ -125,7 +114,7 @@ class Request {
*
* @return bool
*/
public
static
function
secure
()
public
static
function
is_
secure
()
{
return
(
static
::
protocol
()
==
'https'
);
}
...
...
@@ -145,11 +134,22 @@ class Request {
*
* @return bool
*/
public
static
function
ajax
()
public
static
function
is_
ajax
()
{
return
(
isset
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
and
Str
::
lower
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
===
'xmlhttprequest'
);
}
/**
* Determine if the route handling the request is a given name.
*
* @param string $name
* @return bool
*/
public
static
function
route_is
(
$name
)
{
return
(
is_array
(
static
::
$route
->
callback
)
and
isset
(
static
::
$route
->
callback
[
'name'
])
and
static
::
$route
->
callback
[
'name'
]
===
$name
);
}
/**
* Magic Method to handle dynamic static methods.
*/
...
...
@@ -160,9 +160,9 @@ class Request {
//
// Example: Request::is_login()
// --------------------------------------------------------------
if
(
strpos
(
$method
,
'is_'
)
===
0
)
if
(
strpos
(
$method
,
'
route_
is_'
)
===
0
)
{
return
static
::
is
(
substr
(
$method
,
3
));
return
static
::
route_is
(
substr
(
$method
,
9
));
}
}
...
...
system/router.php
View file @
dbc418c0
...
...
@@ -56,7 +56,7 @@ class Router {
if
(
preg_match
(
'#^'
.
$key
.
'$#'
,
$method
.
' '
.
$uri
))
{
return
Request
::
$route
=
new
Route
(
$key
,
$callback
,
Route\Parser
::
parameters
(
$uri
,
$key
));
return
Request
::
$route
=
new
Route
(
$key
s
,
$callback
,
Route\Parser
::
parameters
(
$uri
,
$key
));
}
}
}
...
...
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