Comanche: allow widgets to be class based and stored appropriately in Zotlabs
This commit is contained in:
parent
c95e9b9ba5
commit
df6c07aaad
@ -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);
|
$func = 'widget_' . trim($name);
|
||||||
|
|
||||||
if(! function_exists($func)) {
|
if(! function_exists($func)) {
|
||||||
|
23
Zotlabs/Widget/Notes.php
Normal file
23
Zotlabs/Widget/Notes.php
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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) {
|
function widget_savedsearch($arr) {
|
||||||
|
Reference in New Issue
Block a user