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
34cb9a00
Commit
34cb9a00
authored
Apr 12, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move 'is' method to the str class where it belongs.
parent
0c8c6714
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
18 deletions
+47
-18
laravel/routing/route.php
+2
-1
laravel/str.php
+24
-0
laravel/uri.php
+2
-17
paths.php
+19
-0
No files found.
laravel/routing/route.php
View file @
34cb9a00
<?php
namespace
Laravel\Routing
;
use
Closure
;
use
Laravel\Str
;
use
Laravel\URI
;
use
Laravel\Bundle
;
use
Laravel\Request
;
...
...
@@ -198,7 +199,7 @@ class Route {
// if they match we'll attach the filter.
foreach
(
Filter
::
$patterns
as
$pattern
=>
$filter
)
{
if
(
URI
::
is
(
$pattern
,
$this
->
uri
))
if
(
Str
::
is
(
$pattern
,
$this
->
uri
))
{
$filters
[]
=
$filter
;
}
...
...
laravel/str.php
View file @
34cb9a00
...
...
@@ -301,6 +301,30 @@ class Str {
}
/**
* Determine if a given string matches a given pattern.
*
* @param string $pattern
* @param string $value
* @return bool
*/
public
static
function
is
(
$pattern
,
$value
)
{
// Asterisks are translated into zero-or-more regular expression wildcards
// to make it convenient to check if the URI starts with a given pattern
// such as "library/*". This is only done when not root.
if
(
$pattern
!==
'/'
)
{
$pattern
=
str_replace
(
'*'
,
'(.*)'
,
$pattern
)
.
'\z'
;
}
else
{
$pattern
=
'^/$'
;
}
return
preg_match
(
'#'
.
$pattern
.
'#'
,
$value
);
}
/**
* Get the character pool for a given type of random string.
*
* @param string $type
...
...
laravel/uri.php
View file @
34cb9a00
...
...
@@ -60,26 +60,11 @@ class URI {
* Determine if the current URI matches a given pattern.
*
* @param string $pattern
* @param string $uri
* @return bool
*/
public
static
function
is
(
$pattern
,
$uri
=
null
)
{
$uri
=
$uri
?:
static
::
current
();
// Asterisks are translated into zero-or-more regular expression wildcards
// to make it convenient to check if the URI starts with a given pattern
// such as "library/*". This is only done when not root.
if
(
$pattern
!==
'/'
)
public
static
function
is
(
$pattern
)
{
$pattern
=
str_replace
(
'*'
,
'(.*)'
,
$pattern
)
.
'\z'
;
}
else
{
$pattern
=
'^/$'
;
}
return
preg_match
(
'#'
.
$pattern
.
'#'
,
$uri
);
return
Str
::
is
(
$pattern
,
static
::
current
());
}
/**
...
...
paths.php
View file @
34cb9a00
...
...
@@ -8,6 +8,25 @@
* @link http://laravel.com
*/
/*
|----------------------------------------------------------------
| Application Environemtns
|----------------------------------------------------------------
|
| Laravel takes a dead simple approach to environments, and we
| think you'll love it. Just specify which URLs belongs to a
| given environment, and when you access your application
| from a URL matching that pattern, we'll be sure to
| merge in that environment's configuration files.
|
*/
$environments
=
array
(
'local'
=>
array
(
'*localhost*'
,
'*.dev'
),
);
// --------------------------------------------------------------
// The path to the application directory.
// --------------------------------------------------------------
...
...
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