aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-15 16:13:55 -0700
committerredmatrix <git@macgirvin.com>2016-04-15 16:13:55 -0700
commit07650b4646137e35ec975664ee69f077c9f370d3 (patch)
tree6ee3e5ecb0de7b47d467bce1b6a2eaefd39b721e /Zotlabs
parentaaa327ca056fe8d1315b8fff9bb08b1c1d40fa1c (diff)
downloadvolse-hubzilla-07650b4646137e35ec975664ee69f077c9f370d3.tar.gz
volse-hubzilla-07650b4646137e35ec975664ee69f077c9f370d3.tar.bz2
volse-hubzilla-07650b4646137e35ec975664ee69f077c9f370d3.zip
get init() working with class modules
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Web/Controller.php12
-rw-r--r--Zotlabs/Web/Router.php24
2 files changed, 27 insertions, 9 deletions
diff --git a/Zotlabs/Web/Controller.php b/Zotlabs/Web/Controller.php
new file mode 100644
index 000000000..ac835e008
--- /dev/null
+++ b/Zotlabs/Web/Controller.php
@@ -0,0 +1,12 @@
+<?php
+
+namespace Zotlabs\Web;
+
+
+class Controller {
+
+ function init() {}
+ function post() {}
+ function get() {}
+
+} \ No newline at end of file
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index 699b27891..cbd9c107a 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -133,10 +133,14 @@ logger('3');
*/
$nmod = false;
+ $modname = '';
$newmod = ucfirst(\App::$module);
- if(class_exists("Zotlabs\\Module\\{$newmod}"))
+
+ if(class_exists("Zotlabs\\Module\\{$newmod}")) {
$nmod = true;
+ $modname = "Zotlabs\\Module\\{$newmod}";
+ }
if(\App::$module_loaded) {
\App::$page['page_title'] = \App::$module;
@@ -149,14 +153,15 @@ logger('3');
* to over-ride them.
*/
- $modname = (($nmod) ? "Zotlabs\\Module\\{$newmod}" : '');
- if($modname && method_exists($modname,'init'))
- logger('function_exists: ' . $modname . '->init');
-
- if(function_exists(\App::$module . '_init')) {
- $arr = array('init' => true, 'replace' => false);
- call_hooks(\App::$module . '_mod_init', $arr);
- if(! $arr['replace']) {
+ $arr = array('init' => true, 'replace' => false);
+ call_hooks(\App::$module . '_mod_init', $arr);
+ if(! $arr['replace']) {
+ if($modname && method_exists($modname,'init')) {
+ logger('function_exists: ' . $modname . '->init');
+ $modclass = new $modname;
+ $modclass->init();
+ }
+ elseif(function_exists(\App::$module . '_init')) {
$func = \App::$module . '_init';
$func($a);
}
@@ -199,6 +204,7 @@ logger('3');
}
}
+
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error)
&& (function_exists(\App::$module . '_post'))
&& (! x($_POST, 'auth-params'))) {