Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pquery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
pquery
Commits
7f57b354
Commit
7f57b354
authored
Dec 10, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added full unit test suite for URL plugin.
parent
a6e7de46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
pquery.url.php
pquery.url.php
+16
-14
No files found.
pquery.url.php
View file @
7f57b354
...
@@ -34,20 +34,6 @@ class pQueryUrl extends pQuery {
...
@@ -34,20 +34,6 @@ class pQueryUrl extends pQuery {
return
preg_replace
(
'%(^/|/$)%'
,
''
,
$url
);
return
preg_replace
(
'%(^/|/$)%'
,
''
,
$url
);
}
}
/**
* Execute the handler of the first matching URL regex.
*
* @param string $path The path to add.
* @param bool $relative Indicates whether the path is relative to the document root.
*/
function
handler
()
{
foreach
(
self
::
$handlers
as
$pattern
=>
$handler
)
if
(
preg_match
(
$pattern
,
$this
->
url
,
$matches
)
)
return
call_user_func_array
(
$handler
,
array_slice
(
$matches
,
1
));
//self::error('URL has no handler.', $this->url);
}
/**
/**
* Add a handler function to a URL match.
* Add a handler function to a URL match.
*
*
...
@@ -68,6 +54,22 @@ class pQueryUrl extends pQuery {
...
@@ -68,6 +54,22 @@ class pQueryUrl extends pQuery {
foreach
(
$handlers
as
$pattern
=>
$handler
)
foreach
(
$handlers
as
$pattern
=>
$handler
)
self
::
add_handler
(
$pattern
,
$handler
);
self
::
add_handler
(
$pattern
,
$handler
);
}
}
/**
* Execute the handler of the first matching URL regex.
*
* @param string $path The path to add.
* @param bool $relative Indicates whether the path is relative to the document root.
*/
function
handler
()
{
foreach
(
self
::
$handlers
as
$pattern
=>
$handler
)
if
(
preg_match
(
$pattern
,
$this
->
url
,
$matches
)
)
return
call_user_func_array
(
$handler
,
array_slice
(
$matches
,
1
));
self
::
error
(
'URL "%s" has no handler.'
,
$this
->
url
);
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
}
}
/**
/**
...
...
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