1<?php
2// must be run within Dokuwiki
3if (!defined('DOKU_INC')) {
4    die();
5}
6
7class admin_plugin_tagging extends DokuWiki_Admin_Plugin {
8
9    /** @var helper_plugin_tagging */
10    private $hlp;
11
12    public function __construct() {
13        $this->hlp = plugin_load('helper', 'tagging');
14    }
15
16    /**
17     * We allow use by managers
18     *
19     * @return bool always false
20     */
21    function forAdminOnly() {
22        return false;
23    }
24
25    /**
26     * Handle tag actions
27     */
28    function handle() {
29
30        if (!empty($_REQUEST['cmd']['clean'])) {
31            checkSecurityToken() && $this->hlp->deleteInvalidTaggings();
32        }
33
34        if (!$this->hlp->getParams()) {
35            $this->hlp->setDefaultSort();
36            return false;
37        }
38
39        $this->hlp->setDefaultSort();
40
41        if (!checkSecurityToken()) {
42            return false;
43        }
44    }
45
46    /**
47     * Draw the interface
48     */
49    public function html() {
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