public static function directory($main, $debug = false) { if ($debug) { self::$debug = $debug; } /* Add directory slash at the end if there is none. */ if (substr($main, -1)) { $main .= "/"; } if (!is_dir($main)) { echo "Directory: " . $main . " could not be found."; exit; } self::$main = $main; /* Load all files from the directory */ self::files($main); /* Scan the directory for more directories */ self::scan($main); }