1<?php 2/** 3 * Syntax Plugin Backlinks 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Michael Klier <chi@chimeric.de> 7 */ 8 9if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11if(!defined('DW_LF')) define('DW_LF',"\n"); 12 13/** 14 * All DokuWiki plugins to extend the parser/rendering mechanism 15 * need to inherit from this class 16 */ 17class syntax_plugin_clearfloat extends DokuWiki_Syntax_Plugin { 18 19 20 /** 21 * General Info 22 */ 23 function getInfo(){ 24 return array( 25 'author' => 'Michael Klier (chi)', 26 'email' => 'chi@chimeric.de', 27 'date' => '2006-05-01', 28 'name' => 'Clearfloat', 29 'desc' => 'Clears previous floats form images etc.', 30 'url' => 'http://www.chimeric.de/dokuwiki/plugins/clearfloat' 31 ); 32 } 33 34 /** 35 * Syntax Type 36 * 37 * Needs to return one of the mode types defined in $PARSER_MODES in parser.php 38 */ 39 function getType(){ return 'substition'; } 40 function getPType() { return 'block'; } 41 function getSort() { return 308; } 42 43 /** 44 * Connect pattern to lexer 45 */ 46 function connectTo($mode) { 47 $this->Lexer->addSpecialPattern('~~CLEARFLOAT~~',$mode,'plugin_clearfloat'); 48 } 49 50 /** 51 * Handler to prepare matched data for the rendering process 52 */ 53 function handle($match, $state, $pos, &$handler){ 54 return array(); 55 } 56 57 /** 58 * Handles the actual output creation. 59 */ 60 function render($mode, &$renderer, $data) { 61 global $ID; 62 63 if($mode == 'xhtml'){ 64 $renderer->doc .= '<div class="clearer"></div>'; 65 return true; 66 } 67 return false; 68 } 69 70} 71//Setup VIM: ex: et ts=4 enc=utf-8 : 72