Url::add_url_handler(): accept null as $pattern to match the root on the application
This commit is contained in:
parent
4ff9aa71ad
commit
f16f433326
2 changed files with 5 additions and 2 deletions
|
@ -68,7 +68,7 @@ class App {
|
||||||
Tpl :: init();
|
Tpl :: init();
|
||||||
if (self :: get('url.enabled', true, 'bool')) {
|
if (self :: get('url.enabled', true, 'bool')) {
|
||||||
Url::init();
|
Url::init();
|
||||||
Url :: add_url_handler('#^$#', array('EesyPHP\\App', 'handle_homepage'));
|
Url :: add_url_handler(null, array('EesyPHP\\App', 'handle_homepage'));
|
||||||
}
|
}
|
||||||
if (Auth :: enabled()) {
|
if (Auth :: enabled()) {
|
||||||
Auth :: init();
|
Auth :: init();
|
||||||
|
|
|
@ -79,7 +79,8 @@ class Url {
|
||||||
/**
|
/**
|
||||||
* Add an URL pattern
|
* Add an URL pattern
|
||||||
*
|
*
|
||||||
* @param string|array $pattern The URL pattern or an array of patterns (required)
|
* @param string|array|null $pattern The URL pattern, an array of patterns or null to
|
||||||
|
* match to the root of the application
|
||||||
* @param callable $handler The URL pattern handler (must be callable, required)
|
* @param callable $handler The URL pattern handler (must be callable, required)
|
||||||
* @param array|null $additional_info Array of information to pass to the URL handler
|
* @param array|null $additional_info Array of information to pass to the URL handler
|
||||||
* @param boolean $authenticated Permit to define if this URL is accessible only for
|
* @param boolean $authenticated Permit to define if this URL is accessible only for
|
||||||
|
@ -118,6 +119,8 @@ class Url {
|
||||||
) $error = true;
|
) $error = true;
|
||||||
return !$error;
|
return !$error;
|
||||||
}
|
}
|
||||||
|
else if (is_null($pattern))
|
||||||
|
$pattern = '#^$#';
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
foreach($http_methods as $http_method) {
|
foreach($http_methods as $http_method) {
|
||||||
|
|
Loading…
Reference in a new issue