aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-06 11:05:22 +0000
committerMario <mario@mariovavti.com>2024-07-06 11:05:22 +0000
commit45275910e606a02b12393714ea3b0409da440d61 (patch)
tree10b2d173d58cb930f8df28fe75af73dd4974c08c /Zotlabs/Widget
parent0c1d0f7498661fb34dcca6f3c6566e757af310a7 (diff)
parentc04e781926a78e514cdf211fa24930a331149072 (diff)
downloadvolse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.gz
volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.tar.bz2
volse-hubzilla-45275910e606a02b12393714ea3b0409da440d61.zip
Merge branch '9.2RC'master
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Helpindex.php63
-rw-r--r--Zotlabs/Widget/Newmember.php6
-rw-r--r--Zotlabs/Widget/Pinned.php4
-rw-r--r--Zotlabs/Widget/Pubtagcloud.php8
-rw-r--r--Zotlabs/Widget/Rating.php4
5 files changed, 35 insertions, 50 deletions
diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php
index 63e686d3a..5264e1947 100644
--- a/Zotlabs/Widget/Helpindex.php
+++ b/Zotlabs/Widget/Helpindex.php
@@ -1,6 +1,9 @@
<?php
-
/**
+ * Widget to show the help index.
+ *
+ * By default used by the left sidebar by the help module.
+ *
* * Name: Help index
* * Description: Help pages index
*/
@@ -9,54 +12,28 @@ namespace Zotlabs\Widget;
class Helpindex {
- function widget($arr) {
-
- require_once('include/help.php');
-
- $o = '<div class="widget">';
-
- $level_0 = get_help_content('sitetoc');
- if(! $level_0) {
- $path = 'toc';
- $x = determine_help_language();
- $lang = $x['language'];
- if($lang !== 'en') {
- $path = $lang . '/toc';
- }
- $level_0 = get_help_content($path);
- }
+ use \Zotlabs\Lib\Traits\HelpHelperTrait;
- $level_0 = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$level_0);
+ private string $contents = '';
- $levels = array();
+ function widget() {
+ $this->determine_help_language();
+ $this->find_help_file('toc', $this->lang['language']);
- // TODO: Implement support for translations in hierarchical table of content files
- /*
- if(argc() > 2) {
- $path = '';
- for($x = 1; $x < argc(); $x ++) {
- $path .= argv($x) . '/';
- $y = get_help_content($path . 'sitetoc');
- if(! $y)
- $y = get_help_content($path . 'toc');
- if($y)
- $levels[] = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$y);
- }
- }
- */
-
- if($level_0)
- $o .= $level_0;
- if($levels) {
- foreach($levels as $l) {
- $o .= '<br /><br />';
- $o .= $l;
- }
+ if (! empty($this->file_name)) {
+ $this->contents = file_get_contents($this->file_name);
}
- $o .= '</div>';
+ $tpl = get_markup_template('widget.tpl');
+ return replace_macros($tpl, [ '$widget' => $this ]);
+ }
+
+ public function title(): string {
+ return '';
+ }
- return $o;
+ public function contents(): string {
+ return $this->contents;
}
}
diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php
index 70a858fb0..79bdf9f9f 100644
--- a/Zotlabs/Widget/Newmember.php
+++ b/Zotlabs/Widget/Newmember.php
@@ -7,6 +7,8 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Newmember {
function widget($arr) {
@@ -66,8 +68,8 @@ class Newmember {
]
];
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
// hack to put this in the correct spot of the array
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index 1380c156b..2ba170fe8 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
/**
* * Name: Pinned items
* * Description: Display pinned items
@@ -31,7 +33,7 @@ class Pinned {
if(! $this->uid)
return $ret;
- $this->allowed_types = get_config('system', 'pin_types', [ ITEM_TYPE_POST ]);
+ $this->allowed_types = Config::Get('system', 'pin_types', [ ITEM_TYPE_POST ]);
$items = $this->list($types);
diff --git a/Zotlabs/Widget/Pubtagcloud.php b/Zotlabs/Widget/Pubtagcloud.php
index 90bf5eb97..8119d0c73 100644
--- a/Zotlabs/Widget/Pubtagcloud.php
+++ b/Zotlabs/Widget/Pubtagcloud.php
@@ -7,6 +7,8 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Pubtagcloud {
function widget($arr) {
@@ -16,19 +18,19 @@ class Pubtagcloud {
return EMPTY_STR;
}
- if(! intval(get_config('system','open_pubstream',1))) {
+ if(! intval(Config::Get('system','open_pubstream',1))) {
if(! get_observer_hash()) {
return EMPTY_STR;
}
}
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
if(!$net_firehose) {
return '';
}
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
$safemode = get_xconfig(get_observer_hash(),'directory','safemode',1);
diff --git a/Zotlabs/Widget/Rating.php b/Zotlabs/Widget/Rating.php
index 20c27ff1c..f8986ac93 100644
--- a/Zotlabs/Widget/Rating.php
+++ b/Zotlabs/Widget/Rating.php
@@ -8,12 +8,14 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Rating {
function widget($arr) {
- $rating_enabled = get_config('system','rating_enabled');
+ $rating_enabled = Config::Get('system','rating_enabled');
if(! $rating_enabled) {
return;
}