1<?php 2/** 3 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 4 * @author Jon Magne B�e <jonmagneboe@hotmail.com 5 * @author i-net software <tools@inetsoftware.de> 6 * @author Gerry Weissbach <gweissbach@inetsoftware.de> 7 */ 8 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_daftdrafts_daftdrafts extends DokuWiki_Syntax_Plugin { 19 20 /** 21 * Returns information about this plugin 22 */ 23 function getInfo(){ 24 return array ( 25 'author' => 'Jon Magne B�e', 26 'date' => '2011-11-06', 27 'name' => 'DaftDrafts (Syntax Component)', 28 'desc' => 'Marks pages as drafts, which hides them from unregistered users.', 29 'url' => 'http://www.dokuwiki.org/plugin:daftdrafts', 30 ); 31 } 32 33 function getType(){ return 'substition'; } 34 function getPType(){ return 'block'; } 35 function getSort(){ return 110; } 36 37 /** 38 * Connect pattern to lexer 39 */ 40 function connectTo($mode){ 41 if ($mode == 'base') { 42 $this->Lexer->addSpecialPattern('~~' .$this->getLang('code'). '~~',$mode,'plugin_daftdrafts_daftdrafts'); 43 } 44 } 45 46 /** 47 * Handle the match 48 */ 49 function handle($match, $state, $pos, &$handler){ 50 return array('daftdrafts'); 51 } 52 53 /** 54 * Render output 55 */ 56 function render($mode, &$renderer, $data) { 57 if ($mode == 'xthml') { 58 return true; 59 } elseif ($mode == 'metadata') { 60 $renderer->meta['type'] = 'daftdrafts'; 61 return true; 62 } 63 return false; 64 } 65} 66