1<?php
2
3/**
4 * DokuWiki Plugin linkscollection (Helper Component)
5 *
6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
7 * @author  Anna Dabrowska <dokuwiki@cosmocode.de>
8 */
9class helper_plugin_linkscollection extends DokuWiki_Plugin {
10
11    /**
12     * Return sitemap HTML
13     *
14     * @return string
15     */
16    public function getSitemap()
17    {
18        global $IDX;
19        global $conf;
20
21        $data = [];
22        search($data, $conf['datadir'], 'search_index', ['ns' => '']);
23
24
25        // Hogfather compatibility
26        if (class_exists('\dokuwiki\Ui\Index')) {
27            $index = new \dokuwiki\Ui\Index($IDX);
28            $html = html_buildlist($data, 'idx', [$index,'formatListItem'], [$index,'tagListItem']);
29        } else {
30            $html = html_buildlist($data, 'idx', 'html_list_index', 'html_li_index');
31        }
32
33        return '<div id="plugin_linkscollection__tree" class="index__tree">'
34            . $html
35            . '</div>';
36    }
37}
38