From df6c07aaadda2e89d2843bae136f813c909637ba Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 15 Mar 2017 16:55:47 -0700 Subject: Comanche: allow widgets to be class based and stored appropriately in Zotlabs --- Zotlabs/Render/Comanche.php | 14 ++++++++++++++ Zotlabs/Widget/Notes.php | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Zotlabs/Widget/Notes.php (limited to 'Zotlabs') 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 @@ + t('Notes'), + '$text' => $text, + '$save' => t('Save'), + )); + + return $o; + } +} -- cgit v1.2.3