die("CLI only");
}
}
-
+
function get($base, $opts = array())
{
-// $this->scan($this->rootDir, 'Pman');
-// $this->scan($this->rootDir);
-
-
+ $this->scan();
}
- function scan($dir)
+ function scan($route = array())
{
+ $dir = $this->rootDir . "/" . implode("/", $route);
+
+ echo "Looking for {$dir}\n";
+
foreach (scandir($dir) as $d) {
if (!strlen($d) || $d[0] == '.') {
continue;
}
+ if (is_dir($d)) {
+ $this->scan(array_merge($route, array($d)));
+ continue;
+ }
+
+ if (!preg_match('/\.php$/', $d)) {
+ continue;
+ }
+
+// require_once implode('/', $route) . "/" . $d;
+ try {
+ require_once implode('/', $route) . "/" . $d;
+ } catch (ErrorException $ex) {
+ echo "Unable to load configuration file.";
+ }
}