From 57e653272345fbad26654bc06ffa172e494a44d6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 3 Aug 2011 08:46:38 -0500 Subject: [PATCH] Migrating back to old routing system. --- system/routing/loader.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/routing/loader.php b/system/routing/loader.php index ed6dbd7d..82aa302b 100644 --- a/system/routing/loader.php +++ b/system/routing/loader.php @@ -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); }