diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-10-19 11:18:28 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-10-19 11:18:28 +0200 |
commit | fa9e9510e5d993d183feb942fe74be5fdd07f5cf (patch) | |
tree | 41fec09f527a9346e043b8099b458a97d81b03ed /Zotlabs/Web/SubModule.php | |
parent | 32de123db0ac526795a237ff46885fe8a332cbc0 (diff) | |
parent | 06b3ad1071c755757555baf941e2c0f446f97b21 (diff) | |
download | volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.gz volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.tar.bz2 volse-hubzilla-fa9e9510e5d993d183feb942fe74be5fdd07f5cf.zip |
Merge branch '3.8RC'3.8
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; |