xref: /plugin/tagging/admin.php (revision df43a7be9125b55733c41a4f1a13770bf4033169)
1872edc7cSRené Corinth<?php
2872edc7cSRené Corinth
3*df43a7beSAndreas Gohruse dokuwiki\Extension\AdminPlugin;
4872edc7cSRené Corinth
5*df43a7beSAndreas Gohrclass admin_plugin_tagging extends AdminPlugin
6*df43a7beSAndreas Gohr{
78a1a3846SAndreas Gohr    /** @var helper_plugin_tagging */
8872edc7cSRené Corinth    private $hlp;
9872edc7cSRené Corinth
10*df43a7beSAndreas Gohr    public function __construct()
11*df43a7beSAndreas Gohr    {
12872edc7cSRené Corinth        $this->hlp = plugin_load('helper', 'tagging');
138a1a3846SAndreas Gohr    }
14872edc7cSRené Corinth
158a1a3846SAndreas Gohr    /**
168a1a3846SAndreas Gohr     * We allow use by managers
178a1a3846SAndreas Gohr     *
188a1a3846SAndreas Gohr     * @return bool always false
198a1a3846SAndreas Gohr     */
20*df43a7beSAndreas Gohr    public function forAdminOnly()
21*df43a7beSAndreas Gohr    {
228a1a3846SAndreas Gohr        return false;
238a1a3846SAndreas Gohr    }
248a1a3846SAndreas Gohr
258a1a3846SAndreas Gohr    /**
2631396860SSzymon Olewniczak     * Handle tag actions
278a1a3846SAndreas Gohr     */
28*df43a7beSAndreas Gohr    public function handle()
29*df43a7beSAndreas Gohr    {
30ec4796e4SAnna Dabrowska
31ec4796e4SAnna Dabrowska        if (!empty($_REQUEST['cmd']['clean'])) {
32*df43a7beSAndreas Gohr            if (checkSecurityToken()) {
33*df43a7beSAndreas Gohr                $this->hlp->deleteInvalidTaggings();
34*df43a7beSAndreas Gohr            }
35ec4796e4SAnna Dabrowska        }
36ec4796e4SAnna Dabrowska
37f6568bcbSAnna Dabrowska        if (!$this->hlp->getParams()) {
38f6568bcbSAnna Dabrowska            $this->hlp->setDefaultSort();
39*df43a7beSAndreas Gohr            return;
40ca455b8eSMichael Große        }
41f6568bcbSAnna Dabrowska
42f6568bcbSAnna Dabrowska        $this->hlp->setDefaultSort();
43872edc7cSRené Corinth    }
44872edc7cSRené Corinth
458a1a3846SAndreas Gohr    /**
468a1a3846SAndreas Gohr     * Draw the interface
478a1a3846SAndreas Gohr     */
48*df43a7beSAndreas Gohr    public function html()
49*df43a7beSAndreas Gohr    {
508a1a3846SAndreas Gohr        echo $this->locale_xhtml('intro');
5189ed97adSAnna Dabrowska        echo $this->hlp->html_table();
52ec4796e4SAnna Dabrowska        echo $this->locale_xhtml('clean');
53ec4796e4SAnna Dabrowska        echo $this->hlp->html_clean();
548f630140SSzymon Olewniczak    }
55872edc7cSRené Corinth}
56