devel:admin_plugin_skeleton
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
devel:admin_plugin_skeleton [2008-08-09 19:59] – chi | devel:admin_plugin_skeleton [2015-10-07 20:44] – Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Admin Plugin | + | ====== Admin Plugin |
- | This skeleton has a little more meat than the one list on the admin plugins page. In particular it shows a bare bones form with hidden controls to generate values to return to the plugin and all displayed text is retrieved from the localised | + | This Hello World example show an admin plugin. In particular it shows a bare bones form with hidden controls to generate values to return to the plugin and all displayed text is retrieved from the localized |
- | Two files are shown here | + | Three files are needed |
- | * [[# | + | * [[# |
- | * [[# | + | * [[# |
+ | * [[#lang/en/lang.php]], an English language file with [[localization|localized]] strings used for this plugin. | ||
+ | |||
+ | ===== plugin.info.txt ===== | ||
+ | |||
+ | '' | ||
+ | |||
+ | <code - plugin.info.txt> | ||
+ | base | ||
+ | author me | ||
+ | email me@somesite.com | ||
+ | date | ||
+ | name Hello World Plugin | ||
+ | desc | ||
+ | url https:// | ||
+ | </ | ||
===== admin.php ===== | ===== admin.php ===== | ||
Line 11: | Line 26: | ||
'' | '' | ||
- | <code php> | + | < |
<?php | <?php | ||
/** | /** | ||
Line 20: | Line 35: | ||
*/ | */ | ||
- | if(!defined(' | ||
- | if(!defined(' | ||
- | require_once(DOKU_PLUGIN.' | ||
/** | /** | ||
Line 31: | Line 43: | ||
var $output = ' | var $output = ' | ||
- | + | | |
- | /** | + | |
- | * return some info | + | |
- | */ | + | |
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | * return sort order for position in admin menu | + | |
- | */ | + | |
- | function getMenuSort() { | + | |
- | return 999; | + | |
- | } | + | |
- | + | ||
- | /** | + | |
- | | + | |
- | | + | |
- | | + | |
- | */ | + | |
- | // function getMenuText() { | + | |
- | // return 'a menu prompt'; | + | |
- | // } | + | |
- | + | ||
/** | /** | ||
* handle user request | * handle user request | ||
Line 70: | Line 52: | ||
$this-> | $this-> | ||
+ | if (!checkSecurityToken()) return; | ||
if (!is_array($_REQUEST[' | if (!is_array($_REQUEST[' | ||
| | ||
Line 91: | Line 73: | ||
ptln(' | ptln(' | ||
ptln(' | ptln(' | ||
- | | + | |
ptln(' | ptln(' | ||
ptln(' | ptln(' | ||
Line 100: | Line 83: | ||
</ | </ | ||
- | ===== lang.php ===== | + | ===== lang/en/lang.php ===== |
- | lib/ | + | '' |
- | <code php> | + | < |
<?php | <?php | ||
/** | /** | ||
- | | + | |
* | * | ||
* @license | * @license | ||
* @author | * @author | ||
*/ | */ | ||
- | |||
- | // settings must be present and set appropriately for the language | ||
- | $lang[' | ||
- | $lang[' | ||
// for admin plugins, the menu prompt to be displayed in the admin menu | // for admin plugins, the menu prompt to be displayed in the admin menu | ||
Line 121: | Line 100: | ||
$lang[' | $lang[' | ||
- | $lang[' | + | $lang[' |
- | $lang[' | + | $lang[' |
- | $lang[' | + | $lang[' |
- | $lang[' | + | $lang[' |
- | $lang[' | + | $lang[' |
- | $lang[' | + | $lang[' |
</ | </ | ||
- | ---- | ||
- | |||
devel/admin_plugin_skeleton.txt · Last modified: 2023-09-01 22:43 by Klap-in