~~ * or * ~~LASTCOMP||~~ * Examples: * ~~LASTCOMP|ktg00:m0000068.004.v01~~ * compares the current wiki page with the page 'ktg00:m0000068.004.v01' * ~~LASTCOMP|ktg00:m0000068.004.v01|playground:playground~~ * compares the wiki page 'ktg00:m0000068.004.v01' with the page 'playground:playground' * * Additionally required: * wrap plugin **/ 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_lastcomp extends DokuWiki_Syntax_Plugin { /** * What kind of syntax are we? */ function getType(){ return 'substition'; } /** * What about paragraphs? */ function getPType(){ return 'normal'; } /** * Where to sort in? */ function getSort(){ return 160; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern('~~LASTCOMP[^~]*~~',$mode,'plugin_lastcomp'); } /** * Handle the match */ function handle($match, $state, $pos, Doku_Handler $handler){ global $ID, $INFO, $conf; $basis = DOKU_URL . "doku.php?id="; // erste Seite auslesen $match = str_replace("~~lastcomp", '', $match); $match = str_replace("~~", '', $match); $typ = explode('|',$match); $verz1 = $typ[1]; if (!empty($typ[2])) { $verz2 = $typ[2]; } else { $verz2 = $ID; } $id_save = $ID; $ID = $verz1; $tmp_info = pageinfo(); $mod1 = $tmp_info['lastmod']; $ID = $id_save; $id_save = $ID; $ID = $verz2; $tmp_info = pageinfo(); $mod2 = $tmp_info['lastmod']; $ID = $id_save; $titel1 = substr($verz1,strrpos($verz1,":")+1); $titel2 = substr($verz2,strrpos($verz2,":")+1); $link1 = "$titel1"; $link2 = "$titel2"; $datum1 = strftime($conf['dformat'], $mod1); $datum2 = strftime($conf['dformat'], $mod2); $txt1 = $this->getLang('txt1'); $txt2 = $this->getLang('txt2'); $txt3 = $this->getLang('txt3'); if ($mod1 > $mod2) { $mod = "
"; $mod .= $txt1 . "
'" . $link1 . "' (". $datum1 . ")
" . $txt2 . "
'" . $link2 . "' (" . $datum2 . ")
" . $txt3; $mod .= "
"; } else { $mod = "
"; $mod .= $txt1 . "
'" . $link2 . "' (". $datum2 . ")
" . $txt2 . "
'" . $link1 . "' (". $datum1 . ")"; $mod .= "
"; } return $mod; } /** * Create output */ function render($mode, Doku_Renderer $renderer, $data) { if($mode == 'xhtml'){ $renderer->doc .= $data; return true; } return false; } } ?>