use SubModule class for generalising submodules, move back to the zotlabs/module hierarchy

This commit is contained in:
redmatrix
2016-09-05 18:11:00 -07:00
parent d7d46def9d
commit bedc7b7b69
4 changed files with 43 additions and 17 deletions

31
Zotlabs/Web/SubModule.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
namespace Zotlabs\Web;
class SubModule {
private $controller = false;
function __construct() {
if(argc() < 2)
return;
$filename = 'Zotlabs/Module/' . ucfirst(argv(0)) . '/'. ucfirst(argv(1)) . '.php';
$modname = '\\Zotlabs\\Module\\' . ucfirst(argv(0)) . '\\' . ucfirst(argv(1));
if(file_exists($filename)) {
$this->controller = new $modname();
}
}
function call($method) {
if(! $this->controller)
return false;
if(method_exists($this->controller,$method))
return $this->controller->$method();
return false;
}
}