Comanche: allow widgets to be class based and stored appropriately in Zotlabs
This commit is contained in:
@@ -410,6 +410,20 @@ class Comanche {
|
||||
}
|
||||
}
|
||||
|
||||
$clsname = ucfirst($name);
|
||||
$nsname = "Zotlabs\\Widget\\" . $clsname;
|
||||
if(file_exists('Zotlabs/SiteWidget/' . $clsname . '.php'))
|
||||
require_once('Zotlabs/SiteWidget/' . $clsname . '.php');
|
||||
elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php'))
|
||||
require_once('Zotlabs/Widget/' . $clsname . '.php');
|
||||
if(class_exists($nsname)) {
|
||||
$x = new $nsname;
|
||||
$f = 'widget';
|
||||
if(method_exists($x,$f)) {
|
||||
return $x->$f($vars);
|
||||
}
|
||||
}
|
||||
|
||||
$func = 'widget_' . trim($name);
|
||||
|
||||
if(! function_exists($func)) {
|
||||
|
Reference in New Issue
Block a user