DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:syntax_plugin_skeleton

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
devel:syntax_plugin_skeleton [2009-12-21 10:08] 130.158.152.134devel:syntax_plugin_skeleton [2022-08-14 16:13] (current) – fix handle/render syntax for newer DokuWiki versions 2a02:168:4a00:0:e61d:2dff:fe09:a3e0
Line 12: Line 12:
  */  */
  
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'syntax.php'); 
  
 /** /**
Line 22: Line 19:
 class syntax_plugin_test extends DokuWiki_Syntax_Plugin { class syntax_plugin_test extends DokuWiki_Syntax_Plugin {
  
-   /** +   
-    * Get an associative array with plugin info. +
-    * +
-    * <p> +
-    * The returned array holds the following fields: +
-    * <dl> +
-    * <dt>author</dt><dd>Author of the plugin</dd> +
-    * <dt>email</dt><dd>Email address to contact the author</dd> +
-    * <dt>date</dt><dd>Last modified date of the plugin in +
-    * <tt>YYYY-MM-DD</tt> format</dd> +
-    * <dt>name</dt><dd>Name of the plugin</dd> +
-    * <dt>desc</dt><dd>Short description of the plugin (Text only)</dd> +
-    * <dt>url</dt><dd>Website with more information on the plugin +
-    * (eg. syntax description)</dd> +
-    * </dl> +
-    * @param none +
-    * @return Array Information about this plugin class. +
-    * @public +
-    * @static +
-    */ +
-    function getInfo(){ +
-        return array( +
-            'author' => 'me', +
-            'email'  => 'me@somewhere.com', +
-            'date'   => '20yy-mm-dd', +
-            'name'   => 'Test Plugin', +
-            'desc'   => 'Testing 1, 2, 3 ...', +
-            'url'    => 'http://www.dokuwiki.org/wiki:plugins', +
-        ); +
-    }+
  
    /**    /**
Line 154: Line 122:
     * @static     * @static
     */     */
-    function handle($match, $state, $pos, &$handler){+    function handle($match, $state, $pos, Doku_Handler $handler){
         switch ($state) {         switch ($state) {
           case DOKU_LEXER_ENTER :            case DOKU_LEXER_ENTER : 
Line 189: Line 157:
     * @see handle()     * @see handle()
     */     */
-    function render($mode, &$renderer, $data) {+    function render($mode, Doku_Renderer $renderer, $data) {
         if($mode == 'xhtml'){         if($mode == 'xhtml'){
             $renderer->doc .= "Hello World!";            // ptype = 'normal'             $renderer->doc .= "Hello World!";            // ptype = 'normal'
Line 199: Line 167:
 } }
  
-//Setup VIM: ex: et ts=4 enc=utf-8 : 
-?> 
 </code> </code>
  
Line 209: Line 175:
 Because the plugin's name is ''test'', it has to be stored in ''lib/plugins/test'' to be recognized automagically by DokuWiki. It should be saved as syntax.php Because the plugin's name is ''test'', it has to be stored in ''lib/plugins/test'' to be recognized automagically by DokuWiki. It should be saved as syntax.php
  
 +see also [[plugin_programming_tips]]
  
  
  
devel/syntax_plugin_skeleton.1261386507.txt.gz · Last modified: 2009-12-21 10:08 by 130.158.152.134

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki