summaryrefslogtreecommitdiff
path: root/lib/plugins/extension
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2013-08-01 21:14:17 +0200
committerMichael Hamann <michael@content-space.de>2013-08-01 21:14:17 +0200
commit788f86d986d170475e9fda3578b4fde5ba4864dd (patch)
tree0c5ff742cb303aeafddba999f73f9c12b1229cff /lib/plugins/extension
parent366f1b4213db30071ca5e1b73c31f6e99337e1a7 (diff)
downloadrpg-788f86d986d170475e9fda3578b4fde5ba4864dd.tar.gz
rpg-788f86d986d170475e9fda3578b4fde5ba4864dd.tar.bz2
Extension manager: add language file and simple admin component
Diffstat (limited to 'lib/plugins/extension')
-rw-r--r--lib/plugins/extension/admin.php58
-rw-r--r--lib/plugins/extension/lang/en/lang.php21
2 files changed, 79 insertions, 0 deletions
diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php
new file mode 100644
index 000000000..19863e772
--- /dev/null
+++ b/lib/plugins/extension/admin.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * DokuWiki Plugin extension (Admin Component)
+ *
+ * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
+ * @author Michael Hamann <michael@content-space.de>
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+class admin_plugin_extension extends DokuWiki_Admin_Plugin {
+
+ /**
+ * @return int sort number in admin menu
+ */
+ public function getMenuSort() {
+ return 0;
+ }
+
+ /**
+ * @return bool true if only access for superuser, false is for superusers and moderators
+ */
+ public function forAdminOnly() {
+ return true;
+ }
+
+ /**
+ * Should carry out any processing required by the plugin.
+ */
+ public function handle() {
+ /* @var helper_plugin_extension_repository $repository */
+ $repository = $this->loadHelper('extension_repository');
+ $repository->init();
+ }
+
+ /**
+ * Render HTML output, e.g. helpful text and a form
+ */
+ public function html() {
+ /* @var Doku_Plugin_Controller $plugin_controller */
+ global $plugin_controller;
+ ptln('<h1>'.$this->getLang('menu').'</h1>');
+
+ $pluginlist = $plugin_controller->getList('', true);
+ /* @var helper_plugin_extension_extension $extension */
+ $extension = $this->loadHelper('extension_extension');
+ foreach ($pluginlist as $name) {
+ $extension->setExtension($name, false);
+ ptln('<h2>'.hsc($extension->getName()).'</h2>');
+ ptln('<p>'.hsc($extension->getDescription()).'</p>');
+ ptln('<p>Latest available version: '.hsc($extension->getLastUpdate()).'</p>');
+ ptln('<p>Installed version: '.hsc($extension->getInstalledVersion()).'</p>');
+ }
+ }
+}
+
+// vim:ts=4:sw=4:et: \ No newline at end of file
diff --git a/lib/plugins/extension/lang/en/lang.php b/lib/plugins/extension/lang/en/lang.php
new file mode 100644
index 000000000..81069e498
--- /dev/null
+++ b/lib/plugins/extension/lang/en/lang.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * English language file for extension plugin
+ *
+ * @author Michael Hamann <michael@content-space.de>
+ */
+
+// menu entry for admin plugins
+$lang['menu'] = 'Extension manager';
+
+// custom language strings for the plugin
+$lang['notimplemented'] = 'This feature hasn\'t been implemented yet';
+$lang['alreadyenabled'] = 'This extension has already been enabled';
+$lang['alreadydisabled'] = 'This extension has already been disabled';
+$lang['pluginlistsaveerror'] = 'There was an error saving the plugin list';
+$lang['unknownauthor'] = 'Unknown author';
+$lang['unknownversion'] = 'Unknown version';
+
+
+
+//Setup VIM: ex: et ts=4 :