aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-15 16:55:47 -0700
committerzotlabs <mike@macgirvin.com>2017-03-15 16:55:47 -0700
commitdf6c07aaadda2e89d2843bae136f813c909637ba (patch)
tree295d72d88f6986c06399e0eef148048daf8367e1
parentc95e9b9ba52b8376eea079850caf178e223a1a6d (diff)
downloadvolse-hubzilla-df6c07aaadda2e89d2843bae136f813c909637ba.tar.gz
volse-hubzilla-df6c07aaadda2e89d2843bae136f813c909637ba.tar.bz2
volse-hubzilla-df6c07aaadda2e89d2843bae136f813c909637ba.zip
Comanche: allow widgets to be class based and stored appropriately in Zotlabs
-rw-r--r--Zotlabs/Render/Comanche.php14
-rw-r--r--Zotlabs/Widget/Notes.php23
-rw-r--r--include/widgets.php16
3 files changed, 37 insertions, 16 deletions
diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php
index 5826063fd..899fbd8aa 100644
--- a/Zotlabs/Render/Comanche.php
+++ b/Zotlabs/Render/Comanche.php
@@ -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)) {
diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php
new file mode 100644
index 000000000..5c83a550f
--- /dev/null
+++ b/Zotlabs/Widget/Notes.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Notes {
+
+ function widget($arr) {
+ if(! local_channel())
+ return '';
+ if(! feature_enabled(local_channel(),'private_notes'))
+ return '';
+
+ $text = get_pconfig(local_channel(),'notes','text');
+
+ $o = replace_macros(get_markup_template('notes.tpl'), array(
+ '$banner' => t('Notes'),
+ '$text' => $text,
+ '$save' => t('Save'),
+ ));
+
+ return $o;
+ }
+}
diff --git a/include/widgets.php b/include/widgets.php
index f05c7c0ee..b5389e60d 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -174,22 +174,6 @@ function widget_follow($args) {
}
-function widget_notes($arr) {
- if(! local_channel())
- return '';
- if(! feature_enabled(local_channel(),'private_notes'))
- return '';
-
- $text = get_pconfig(local_channel(),'notes','text');
-
- $o = replace_macros(get_markup_template('notes.tpl'), array(
- '$banner' => t('Notes'),
- '$text' => $text,
- '$save' => t('Save'),
- ));
-
- return $o;
-}
function widget_savedsearch($arr) {