summaryrefslogtreecommitdiff
path: root/lib/plugins/info
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-06-26 17:16:17 +0200
committerandi <andi@splitbrain.org>2005-06-26 17:16:17 +0200
commit896a5c22ad2bfe6b07b70324ed639fbaf9a20869 (patch)
treea8bfced4ae559600bc546cda991ff063487586c2 /lib/plugins/info
parentf0891737afe2e6e426722f63c544bcb0dc3cd76e (diff)
downloadrpg-896a5c22ad2bfe6b07b70324ed639fbaf9a20869.tar.gz
rpg-896a5c22ad2bfe6b07b70324ed639fbaf9a20869.tar.bz2
plugin info added
Each plugin now needs to return some infos about it self. This allows to display a list of installed plugins using the info plugin. darcs-hash:20050626151617-9977f-0be6e15b32c35b23967e509b0057a00226df150c.gz
Diffstat (limited to 'lib/plugins/info')
-rw-r--r--lib/plugins/info/syntax.php61
1 files changed, 58 insertions, 3 deletions
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php
index f0afcf2ec..34acd98b7 100644
--- a/lib/plugins/info/syntax.php
+++ b/lib/plugins/info/syntax.php
@@ -17,6 +17,20 @@ require_once(DOKU_PLUGIN.'syntax.php');
class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
/**
+ * return some info
+ */
+ function getInfo(){
+ return array(
+ 'author' => 'Andreas Gohr',
+ 'email' => 'andi@splitbrain.org',
+ 'date' => '2005-06-26',
+ 'name' => 'Info Plugin',
+ 'desc' => 'Displays information about various DokuWiki internals',
+ 'url' => 'http://wiki.splitbrain.org/plugin:info',
+ );
+ }
+
+ /**
* What kind of syntax are we?
*/
function getType(){
@@ -24,6 +38,13 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
}
/**
+ * What about paragraphs?
+ */
+ function getPType(){
+ return 'block';
+ }
+
+ /**
* Where to sort in?
*/
function getSort(){
@@ -54,15 +75,18 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
if($mode == 'xhtml'){
//handle various info stuff
switch ($data[0]){
- case 'version';
+ case 'version':
$renderer->doc .= getVersion();
break;
- case 'syntaxmodes';
+ case 'syntaxmodes':
$renderer->doc .= $this->_syntaxmodes_xhtml();
break;
- case 'syntaxtypes';
+ case 'syntaxtypes':
$renderer->doc .= $this->_syntaxtypes_xhtml();
break;
+ case 'syntaxplugins':
+ $this->_syntaxplugins_xhtml($renderer);
+ break;
default:
$renderer->doc .= "no info about ".htmlspecialchars($data[0]);
}
@@ -72,6 +96,37 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
}
/**
+ * list all installed syntax plugins
+ *
+ * uses some of the original renderer methods
+ */
+ function _syntaxplugins_xhtml(& $renderer){
+ global $lang;
+ $renderer->doc .= '<ul>';
+
+ $plugins = plugin_list('syntax');
+ foreach($plugins as $p){
+ if(plugin_load('syntax',$p,$po)){
+ $info = $po->getInfo();
+
+ $renderer->doc .= '<li>';
+ $renderer->externallink($info['url'],$info['name']);
+ $renderer->doc .= ' ';
+ $renderer->doc .= '<i>'.$info['date'].'</i>';
+ $renderer->doc .= ' ';
+ $renderer->doc .= $lang['by'];
+ $renderer->doc .= ' ';
+ $renderer->emaillink($info['email'],$info['author']);
+ $renderer->doc .= '<br />';
+ $renderer->doc .= htmlspecialchars($info['desc']);
+ $renderer->doc .= '</li>';
+ }
+ }
+
+ $renderer->doc .= '</ul>';
+ }
+
+ /**
* lists all known syntax types and their registered modes
*/
function _syntaxtypes_xhtml(){