aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorredmatrix <mike@macgirvin.com>2016-09-05 18:11:00 -0700
committerredmatrix <mike@macgirvin.com>2016-09-05 18:11:00 -0700
commitbedc7b7b69dcc772243f5a1da692987459f324f0 (patch)
treed917aa939f0e907fc791272829a6aecae6a447ce /Zotlabs
parentd7d46def9d6893b239c4e4e468fe151cedb28477 (diff)
downloadvolse-hubzilla-bedc7b7b69dcc772243f5a1da692987459f324f0.tar.gz
volse-hubzilla-bedc7b7b69dcc772243f5a1da692987459f324f0.tar.bz2
volse-hubzilla-bedc7b7b69dcc772243f5a1da692987459f324f0.zip
use SubModule class for generalising submodules, move back to the zotlabs/module hierarchy
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Admin.php24
-rw-r--r--Zotlabs/Module/Admin/Plugins.php (renamed from Zotlabs/Admin/Plugins.php)4
-rw-r--r--Zotlabs/Web/SubModule.php31
3 files changed, 42 insertions, 17 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 422c9ba34..d7e3ea5ed 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -19,6 +19,12 @@ require_once('include/account.php');
class Admin extends \Zotlabs\Web\Controller {
+ private $sm = null;
+
+ function __construct() {
+ $this->sm = new \\Zotlabs\Web\SubModule();
+ }
+
function post(){
logger('admin_post', LOGGER_DEBUG);
@@ -99,13 +105,7 @@ class Admin extends \Zotlabs\Web\Controller {
break;
default:
- $filename = 'Zotlabs/Admin/'. ucfirst(argv(1)) . '.php';
- $modname = '\\Zotlabs\\Admin\\' . ucfirst(argv(1));
- if(file_exists($filename)) {
- $controller = new $modname;
- $controller->post();
- }
-
+ $this->sm->call('post');
break;
}
}
@@ -165,14 +165,8 @@ class Admin extends \Zotlabs\Web\Controller {
$o = $this->admin_page_queue($a);
break;
default:
-
- $filename = 'Zotlabs/Admin/'. ucfirst(argv(1)) . '.php';
- $modname = '\\Zotlabs\\Admin\\' . ucfirst(argv(1));
- if(file_exists($filename)) {
- $controller = new $modname;
- $o = $controller->get();
- }
- else {
+ $o = $this->sm->call('get');
+ if($o === false) {
notice( t('Item not found.') );
}
break;
diff --git a/Zotlabs/Admin/Plugins.php b/Zotlabs/Module/Admin/Plugins.php
index 5d2f3ff74..38e413680 100644
--- a/Zotlabs/Admin/Plugins.php
+++ b/Zotlabs/Module/Admin/Plugins.php
@@ -1,9 +1,9 @@
<?php
-namespace Zotlabs\Admin;
+namespace Zotlabs\Module\Admin;
-class Plugins extends \Zotlabs\Web\Controller {
+class Plugins {
function get() {
diff --git a/Zotlabs/Web/SubModule.php b/Zotlabs/Web/SubModule.php
new file mode 100644
index 000000000..122766d5a
--- /dev/null
+++ b/Zotlabs/Web/SubModule.php
@@ -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;
+ }
+
+}
+