1<?php
2
3use dokuwiki\Extension\AdminPlugin;
4
5class admin_plugin_tagging extends AdminPlugin
6{
7    /** @var helper_plugin_tagging */
8    private $hlp;
9
10    public function __construct()
11    {
12        $this->hlp = plugin_load('helper', 'tagging');
13    }
14
15    /**
16     * We allow use by managers
17     *
18     * @return bool always false
19     */
20    public function forAdminOnly()
21    {
22        return false;
23    }
24
25    /**
26     * Handle tag actions
27     */
28    public function handle()
29    {
30
31        if (!empty($_REQUEST['cmd']['clean'])) {
32            if (checkSecurityToken()) {
33                $this->hlp->deleteInvalidTaggings();
34            }
35        }
36
37        if (!$this->hlp->getParams()) {
38            $this->hlp->setDefaultSort();
39            return;
40        }
41
42        $this->hlp->setDefaultSort();
43    }
44
45    /**
46     * Draw the interface
47     */
48    public function html()
49    {
50        echo $this->locale_xhtml('intro');
51        echo $this->hlp->html_table();
52        echo $this->locale_xhtml('clean');
53        echo $this->hlp->html_clean();
54    }
55}
56