diff options
Diffstat (limited to 'Zotlabs/Widget/Helpindex.php')
-rw-r--r-- | Zotlabs/Widget/Helpindex.php | 63 |
1 files changed, 20 insertions, 43 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; } } |