Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
5b285882
Commit
5b285882
authored
Jul 29, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking router formatting.
parent
f16f90c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
system/router.php
+5
-4
No files found.
system/router.php
View file @
5b285882
...
@@ -26,8 +26,8 @@ class Router {
...
@@ -26,8 +26,8 @@ class Router {
*/
*/
public
function
__construct
(
$method
,
$uri
,
$routes
=
null
)
public
function
__construct
(
$method
,
$uri
,
$routes
=
null
)
{
{
// Put the request method and URI in route form.
// Put the request method and URI in route form.
Routes begin with
//
Routes begin with
the request method and a forward slash.
// the request method and a forward slash.
$this
->
request
=
$method
.
' /'
.
trim
(
$uri
,
'/'
);
$this
->
request
=
$method
.
' /'
.
trim
(
$uri
,
'/'
);
$this
->
routes
=
(
is_array
(
$routes
))
?
$routes
:
$this
->
load
(
$uri
);
$this
->
routes
=
(
is_array
(
$routes
))
?
$routes
:
$this
->
load
(
$uri
);
...
@@ -113,8 +113,9 @@ class Router {
...
@@ -113,8 +113,9 @@ class Router {
{
{
$replacements
=
0
;
$replacements
=
0
;
// For optional parameters, first translate the wildcards to their regex equivalent, sans the ")?" ending.
// For optional parameters, first translate the wildcards to their
// We will add the endings back on after we know how many replacements we made.
// regex equivalent, sans the ")?" ending. We will add the endings
// back on after we know how many replacements we made.
$key
=
str_replace
(
array
(
'/(:num?)'
,
'/(:any?)'
),
array
(
'(?:/([0-9]+)'
,
'(?:/([a-zA-Z0-9\-_]+)'
),
$key
,
$replacements
);
$key
=
str_replace
(
array
(
'/(:num?)'
,
'/(:any?)'
),
array
(
'(?:/([0-9]+)'
,
'(?:/([a-zA-Z0-9\-_]+)'
),
$key
,
$replacements
);
$key
.=
(
$replacements
>
0
)
?
str_repeat
(
')?'
,
$replacements
)
:
''
;
$key
.=
(
$replacements
>
0
)
?
str_repeat
(
')?'
,
$replacements
)
:
''
;
...
...
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