Migrating back to old routing system.

This commit is contained in:
Taylor Otwell 2011-08-03 08:46:38 -05:00
parent 63694de75b
commit 57e6532723
1 changed files with 5 additions and 5 deletions

View File

@ -52,9 +52,9 @@ private function load_nested_routes($uri)
// matching route directory. Once we find it, we will return those routes.
foreach (array_reverse($segments, true) as $key => $value)
{
if (is_dir($path = $this->path.implode('/', array_slice($segments, 0, $key + 1))))
if (file_exists($path = $this->path.'routes/'.implode('/', array_slice($segments, 0, $key + 1)).EXT))
{
return (file_exists($path = $path.'/routes'.EXT)) ? require $path : array();
return require $path;
}
}
@ -71,7 +71,7 @@ private function load_nested_routes($uri)
* @param string $path
* @return array
*/
public static function all($reload = false, $path = ROUTE_PATH)
public static function all($reload = false, $path = APP_PATH)
{
if ( ! is_null(static::$routes) and ! $reload) return static::$routes;
@ -79,13 +79,13 @@ public static function all($reload = false, $path = ROUTE_PATH)
// Since route files can be nested deep within the route directory, we need to
// recursively spin through the directory to find every file.
$directoryIterator = new \RecursiveDirectoryIterator($path);
$directoryIterator = new \RecursiveDirectoryIterator($path.'routes');
$recursiveIterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($recursiveIterator as $file)
{
if (filetype($file) === 'file' and strpos($file, EXT) !== false and strpos($file, 'filters'.EXT) === false)
if (filetype($file) === 'file' and strpos($file, EXT) !== false)
{
$routes = array_merge(require $file, $routes);
}