Version 0.9.5 beta - update for the autoloading and a bugfix for the directory iterators, also the dispatcher checks for the action before loading it now.

This commit is contained in:
Stephan Kasdorf
2020-01-06 11:42:01 +01:00
parent 12288f52df
commit dc45ffb6ec
2 changed files with 37 additions and 22 deletions

View File

@@ -205,6 +205,8 @@ class Autoloader
foreach ( Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] as $modelfolder )
{
$iterator = self::folderContent( __DIR__ . $modelfolder );
if($iterator!=null)
{
foreach ($iterator as $item)
{
if ($item->getFileName() != self::MY_FILE_NAME && $item->getFileName() != "." && $item->getFileName() != ".." && strstr($item->getFileName(), self::PHP_FILE_EXTENSION))
@@ -214,9 +216,12 @@ class Autoloader
}
}
}
}
else
{
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER]);
if($iterator != null)
{
foreach ($iterator as $item)
{
if ($item->getFileName() != self::MY_FILE_NAME && $item->getFileName() != "." && $item->getFileName() != ".." && strstr($item->getFileName(), self::PHP_FILE_EXTENSION))
@@ -225,6 +230,7 @@ class Autoloader
}
}
}
}
/**
* TODO: refactor this section
*/
@@ -232,7 +238,7 @@ class Autoloader
foreach($moduleInterfaceNames as $interfaceName)
{
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::INTERFACE_FOLDER], $interfaceName);
if(sizeof($iterator)>0)
if($iterator!=null)
{
foreach ( $iterator as $item )
{
@@ -262,6 +268,8 @@ class Autoloader
foreach($modulesTraitsNames as $traitsName)
{
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::TRAIT_FOLDER], $traitsName );
if($iterator!=null)
{
foreach ( $iterator as $item )
{
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!=".." && strstr($item->getFileName(), self::PHP_FILE_EXTENSION))
@@ -272,6 +280,7 @@ class Autoloader
);
}
}
}
if(is_array($traits))
{
asort($traits);
@@ -289,6 +298,8 @@ class Autoloader
foreach($modulesClassNames as $className)
{
$iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER], $className );
if($iterator!=null)
{
foreach ( $iterator as $item )
{
if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!=".." && strstr($item->getFileName(), self::PHP_FILE_EXTENSION))
@@ -299,6 +310,7 @@ class Autoloader
);
}
}
}
if(is_array($modules))
{
asort($modules);

View File

@@ -48,7 +48,10 @@ final class Dispatcher
{
$action = $_REQUEST['_action']."Action";
$controller->navigationAction();
if(method_exists($controller, $action))
{
$controller->$action();
}
$controller->pageAction();
}
else