diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index f0afcf2ec30484356dd2b3e5cd6fd54d787bbc17..34acd98b711861f6651a933d8581b266a899daeb 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -16,6 +16,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? */ @@ -23,6 +37,13 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { return 'substition'; } + /** + * What about paragraphs? + */ + function getPType(){ + return 'block'; + } + /** * Where to sort in? */ @@ -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]); } @@ -71,6 +95,37 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { return false; } + /** + * 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 */ diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 2a67a5ca5e973a66c6ff1b9491a7eebe9759d54d..bf03fdf2c349df82ae3c641f043014fb3fb5f161 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -16,6 +16,22 @@ require_once(DOKU_INC.'inc/parser/parser.php'); */ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { + /** + * General Info + * + * Needs to return a associative array with the following values: + * + * author - Author of the plugin + * email - Email address to contact the author + * date - Last modified date of the plugin in YYYY-MM-DD format + * name - Name of the plugin + * desc - Short description of the plugin (Text only) + * url - Website with more information on the plugin (eg. syntax description) + */ + function getInfo(){ + trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING); + } + /** * Syntax Type *