diff options
author | zotlabs <mike@macgirvin.com> | 2018-09-17 19:38:40 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-09-17 19:38:40 -0700 |
commit | dfdf11d461d9c72fa4fb54fd28949af2a90209b3 (patch) | |
tree | 8b3cddfb1f235c60125763066f13c3822c0ac530 /Zotlabs/Web/SubModule.php | |
parent | cc5ef57843f4012f7319a0ffd687fe26950a7790 (diff) | |
parent | c4c1b1f5a2ab90873bf1eef31ed794d94fdd6077 (diff) | |
download | volse-hubzilla-dfdf11d461d9c72fa4fb54fd28949af2a90209b3.tar.gz volse-hubzilla-dfdf11d461d9c72fa4fb54fd28949af2a90209b3.tar.bz2 volse-hubzilla-dfdf11d461d9c72fa4fb54fd28949af2a90209b3.zip |
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Web/SubModule.php')
-rw-r--r-- | Zotlabs/Web/SubModule.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php index 7c8404201..763a55d86 100644 --- a/Zotlabs/Web/SubModule.php +++ b/Zotlabs/Web/SubModule.php @@ -2,6 +2,8 @@ namespace Zotlabs\Web; +use Zotlabs\Extend\Route; + /* * @brief * @@ -31,9 +33,23 @@ class SubModule { $filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv($whicharg)) . '.php'; $modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv($whicharg)); + if(file_exists($filename)) { $this->controller = new $modname(); } + + $routes = Route::get(); + + if($routes) { + foreach($routes as $route) { + if(is_array($route) && strtolower($route[1]) === strtolower(argv(0)) . '/' . strtolower(argv($whicharg))) { + include_once($route[0]); + if(class_exists($modname)) { + $this->controller = new $modname; + } + } + } + } } /** @@ -43,6 +59,7 @@ class SubModule { * @return boolean|mixed */ function call($method) { + if(! $this->controller) return false; |