base skeleton
author me
email me@somesite.com
date 20yy-mm-dd
name Hello World Plugin
desc Demonstration plugin
url https://www.dokuwiki.org/plugin:skeleton
===== admin.php =====
''lib/plugins/skeleton/admin.php''
*/
/**
* All DokuWiki plugins to extend the admin function
* need to inherit from this class
*/
class admin_plugin_skeleton extends AdminPlugin {
private $output = 'world';
/**
* handle user request
*/
public function handle() {
global $INPUT;
if (!$INPUT->has('cmd')) return; // first time - nothing to do
$this->output = 'invalid';
if (!checkSecurityToken()) return;
if (!is_array($INPUT->param('cmd')) return;
// verify valid values
$cmd = $INPUT->arr('cmd');
switch (key($cmd)) {
case 'hello' :
$this->output = 'again';
break;
case 'goodbye':
$this->output = 'goodbye';
break;
}
}
/**
* output appropriate html
*/
public function html() {
echo '' . htmlspecialchars($this->getLang($this->output)) . '
';
echo '';
}
}
===== lang/en/lang.php =====
''lib/plugins/skeleton/lang/en/lang.php''
*/
// for admin plugins, the menu prompt to be displayed in the admin menu
// if set here, the plugin doesn't need to override the getMenuText() method
$lang['menu'] = 'Admin Skeleton...';
$lang['btn_hello'] = 'hello';
$lang['btn_goodbye'] = 'goodbye';
$lang['world'] = 'Hello, world!';
$lang['again'] = 'Hello again!';
$lang['goodbye'] = 'Goodbye.';
$lang['invalid'] = 'invalid input detected!';