Some minor internal fixes

This commit is contained in:
Deon George
2014-10-08 23:20:27 +11:00
parent 6d914ff290
commit fc5cea470a
5 changed files with 30 additions and 11 deletions

View File

@@ -10,20 +10,21 @@
* @license http://dev.leenooks.net/license.html
*/
class lnApp_Menu {
public static function items($type) {
public static function items($type,array $list=array()) {
$result = array();
if (empty(URL::$method_directory[$type]))
return NULL;
$list = Kohana::list_files('classes/Controller/'.ucfirst($type));
if (! $list)
$list = Kohana::list_files('classes/Controller/'.ucfirst($type));
// This will be used a lot!
$ext_length = strlen(EXT);
foreach ($list as $name => $path)
if (is_array($path)) {
$result += self::items($path);
$result += self::items($type,$path);
} elseif (substr($name, -$ext_length) === EXT) {
// Remove "classes/" and the extension