get init() working with class modules
This commit is contained in:
parent
aaa327ca05
commit
07650b4646
12
Zotlabs/Web/Controller.php
Normal file
12
Zotlabs/Web/Controller.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Web;
|
||||||
|
|
||||||
|
|
||||||
|
class Controller {
|
||||||
|
|
||||||
|
function init() {}
|
||||||
|
function post() {}
|
||||||
|
function get() {}
|
||||||
|
|
||||||
|
}
|
@ -133,10 +133,14 @@ logger('3');
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$nmod = false;
|
$nmod = false;
|
||||||
|
$modname = '';
|
||||||
|
|
||||||
$newmod = ucfirst(\App::$module);
|
$newmod = ucfirst(\App::$module);
|
||||||
if(class_exists("Zotlabs\\Module\\{$newmod}"))
|
|
||||||
|
if(class_exists("Zotlabs\\Module\\{$newmod}")) {
|
||||||
$nmod = true;
|
$nmod = true;
|
||||||
|
$modname = "Zotlabs\\Module\\{$newmod}";
|
||||||
|
}
|
||||||
|
|
||||||
if(\App::$module_loaded) {
|
if(\App::$module_loaded) {
|
||||||
\App::$page['page_title'] = \App::$module;
|
\App::$page['page_title'] = \App::$module;
|
||||||
@ -149,14 +153,15 @@ logger('3');
|
|||||||
* to over-ride them.
|
* 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);
|
$arr = array('init' => true, 'replace' => false);
|
||||||
call_hooks(\App::$module . '_mod_init', $arr);
|
call_hooks(\App::$module . '_mod_init', $arr);
|
||||||
if(! $arr['replace']) {
|
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 = \App::$module . '_init';
|
||||||
$func($a);
|
$func($a);
|
||||||
}
|
}
|
||||||
@ -199,6 +204,7 @@ logger('3');
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error)
|
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! \App::$error)
|
||||||
&& (function_exists(\App::$module . '_post'))
|
&& (function_exists(\App::$module . '_post'))
|
||||||
&& (! x($_POST, 'auth-params'))) {
|
&& (! x($_POST, 'auth-params'))) {
|
||||||
|
Reference in New Issue
Block a user