1<?php 2/** 3 * Offline Plugin: Create a static version that is offline browsable 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Carsten Graw <dokuwiki@graw.eu> 7 */ 8// must be run within Dokuwiki 9if(!defined('DOKU_INC')) die(); 10 11if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 12require_once(DOKU_PLUGIN.'syntax.php'); 13 14/** 15 * All DokuWiki plugins to extend the parser/rendering mechanism 16 * need to inherit from this class 17 */ 18class syntax_plugin_offline extends DokuWiki_Syntax_Plugin { 19 20 /** 21 * return some info 22 */ 23 function getInfo(){ 24 return confToHash(dirname(__FILE__).'/info.txt'); 25 } 26 27 /** 28 * What kind of syntax are we? 29 */ 30 function getType(){ 31 return 'substition'; 32 } 33 34 /** 35 * What about paragraphs? 36 */ 37 function getPType(){ 38 return 'normal'; 39 } 40 41 /** 42 * Where to sort in? 43 */ 44 function getSort(){ 45 return 800; 46 } 47 48 49 /** 50 * Connect pattern to lexer 51 */ 52 function connectTo($mode) { 53 $this->Lexer->addSpecialPattern('~~SLIDESHOW~~',$mode,'plugin_s5'); 54 } 55 56 57 /** 58 * Handle the match 59 */ 60 function handle($match, $state, $pos, &$handler){ 61 return array(); 62 } 63 64 /** 65 * Create output 66 */ 67 function render($format, &$renderer, $data) { 68 global $ID; 69 if($format != 'xhtml') return false; 70 71 $renderer->doc .= '<a href="'.exportlink($ID, 's5').'" title="'.$this->getLang('view').'">'; 72 $renderer->doc .= '<img src="'.DOKU_BASE.'lib/plugins/offline/screen.gif" align="right" alt="'.$this->getLang('view').'" width="48" height="48" />'; 73 $renderer->doc .= '</a>'; 74 return true; 75 } 76} 77 78//Setup VIM: ex: et ts=4 enc=utf-8 : 79