xref: /dokuwiki/lib/plugins/extension/admin.php (revision 788f86d986d170475e9fda3578b4fde5ba4864dd)
1<?php
2/**
3 * DokuWiki Plugin extension (Admin Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Michael Hamann <michael@content-space.de>
7 */
8
9// must be run within Dokuwiki
10if(!defined('DOKU_INC')) die();
11
12class admin_plugin_extension extends DokuWiki_Admin_Plugin {
13
14    /**
15     * @return int sort number in admin menu
16     */
17    public function getMenuSort() {
18        return 0;
19    }
20
21    /**
22     * @return bool true if only access for superuser, false is for superusers and moderators
23     */
24    public function forAdminOnly() {
25        return true;
26    }
27
28    /**
29     * Should carry out any processing required by the plugin.
30     */
31    public function handle() {
32        /* @var helper_plugin_extension_repository $repository */
33        $repository = $this->loadHelper('extension_repository');
34        $repository->init();
35    }
36
37    /**
38     * Render HTML output, e.g. helpful text and a form
39     */
40    public function html() {
41        /* @var Doku_Plugin_Controller $plugin_controller */
42        global $plugin_controller;
43        ptln('<h1>'.$this->getLang('menu').'</h1>');
44
45        $pluginlist = $plugin_controller->getList('', true);
46        /* @var helper_plugin_extension_extension $extension */
47        $extension = $this->loadHelper('extension_extension');
48        foreach ($pluginlist as $name) {
49            $extension->setExtension($name, false);
50            ptln('<h2>'.hsc($extension->getName()).'</h2>');
51            ptln('<p>'.hsc($extension->getDescription()).'</p>');
52            ptln('<p>Latest available version: '.hsc($extension->getLastUpdate()).'</p>');
53            ptln('<p>Installed version: '.hsc($extension->getInstalledVersion()).'</p>');
54        }
55    }
56}
57
58// vim:ts=4:sw=4:et: