aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Render/Comanche.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-07-12 16:23:32 -0700
committerzotlabs <mike@macgirvin.com>2018-07-12 16:23:32 -0700
commitd71e70bedf4fa7244f3fcce789e29504c452d5cd (patch)
treeebf215dc6f4e4e4c909c7c567b8eb386ce09b77a /Zotlabs/Render/Comanche.php
parent38bccecc04c9fe0cabab865deb686f0e85f18009 (diff)
downloadvolse-hubzilla-d71e70bedf4fa7244f3fcce789e29504c452d5cd.tar.gz
volse-hubzilla-d71e70bedf4fa7244f3fcce789e29504c452d5cd.tar.bz2
volse-hubzilla-d71e70bedf4fa7244f3fcce789e29504c452d5cd.zip
functions to support module and widget registration by plugins. These have identical construction to core modules and widgets and are registered just like hooks during addon load. Also additional Apps functions addon_app_installed() and system_app_installed() which will eventually replace feature_installed() for features which are converted to apps. The convention being used is that the module associated with the app calls the appropriate *_app_installed() function and if not present emits descriptive text about the app and exits. This allows one to click on an 'available' app and learn about it. Once installed, the app module behaves normally and may offer functionality or what once were addon settings on the settings/featured page. Refer to zap-addons in the zap repository for examples of how this is being used to eliminate the 'additional features' and 'addon settings' pages.
Diffstat (limited to 'Zotlabs/Render/Comanche.php')
-rw-r--r--Zotlabs/Render/Comanche.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php
index fb400b6fe..f58dba60e 100644
--- a/Zotlabs/Render/Comanche.php
+++ b/Zotlabs/Render/Comanche.php
@@ -528,18 +528,32 @@ 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('widget/' . $clsname . '/' . $clsname . '.php'))
- require_once('widget/' . $clsname . '/' . $clsname . '.php');
- elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php'))
- require_once('Zotlabs/Widget/' . $clsname . '.php');
- else {
- $pth = theme_include($clsname . '.php');
- if($pth) {
- require_once($pth);
+ $found = false;
+ $widgets = \Zotlabs\Extend\Widget::get();
+ if($widgets) {
+ foreach($widgets as $widget) {
+ if(is_array($widget) && strtolower($widget[1]) === strtolower($name) && file_exists($widget[0])) {
+ require_once($widget[0]);
+ $found = true;
+ }
}
}
+
+ if(! $found) {
+ if(file_exists('Zotlabs/SiteWidget/' . $clsname . '.php'))
+ require_once('Zotlabs/SiteWidget/' . $clsname . '.php');
+ elseif(file_exists('widget/' . $clsname . '/' . $clsname . '.php'))
+ require_once('widget/' . $clsname . '/' . $clsname . '.php');
+ elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php'))
+ require_once('Zotlabs/Widget/' . $clsname . '.php');
+ else {
+ $pth = theme_include($clsname . '.php');
+ if($pth) {
+ require_once($pth);
+ }
+ }
+ }
+
if(class_exists($nsname)) {
$x = new $nsname;
$f = 'widget';