*/ 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'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_toplist extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Mario Lacko', 'email' => 'mario [dot] lacko [at] gmail [dot] com', 'date' => '2006-04-09', 'name' => 'Toplist Plugin', 'desc' => 'Show your statistic from toplist.cz . Syntax: ~~toplist:000000~~', 'url' => 'http://www.dokuwiki.org/plugin:toplist', ); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } function getSort(){ return 129; } function connectTo($mode) { $this->Lexer->addSpecialPattern("~~toplist:\w+~~",$mode,'plugin_toplist'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ $match = substr($match,10,-2); // Strip markup // Check alignment $ralign = (bool)preg_match('/^ /',$match); $lalign = (bool)preg_match('/ $/',$match); if ($lalign & $ralign) $align = 'center'; else if ($ralign) $align = 'right'; else if ($lalign) $align = 'left'; else $align = NULL; return array(trim($match),$align); } /** * Create output */ function render($mode, &$renderer, $data) { if($mode == 'xhtml'){ $renderer->doc .= 'TOPlist'; return true; } return false; } } //Setup VIM: ex: et ts=4 enc=utf-8 :