1<?php 2/** 3 * popoutviewer Plugin 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author i-net software <tools@inetsoftware.de> 7 * @author Gerry Weissbach <gweissbach@inetsoftware.de> 8 */ 9 10// must be run within Dokuwiki 11if(!defined('DOKU_INC')) die(); 12if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 13 14require_once(DOKU_PLUGIN.'syntax.php'); 15 16class syntax_plugin_popupviewer_popupscript extends DokuWiki_Syntax_Plugin { 17 18 function getType() { return 'protected'; } 19 function getPType() { return 'normal'; } 20 function getSort() { return 98; } 21 22 function connectTo($mode) { 23 $this->Lexer->addEntryPattern('<popupscript>(?=.*?</popupscript>)', $mode, 'plugin_popupviewer_popupscript'); 24 } 25 26 function postConnect() { 27 $this->Lexer->addExitPattern('</popupscript>', 'plugin_popupviewer_popupscript'); 28 } 29 30 function handle($match, $state, $pos, &$handler) { 31 if ( $state == DOKU_LEXER_UNMATCHED ) { 32 return $match; 33 } 34 35 return false; 36 } 37 38 function render($mode, &$renderer, $data) { 39 40 global $ID; 41 42 if ( $mode == "metadata" ) { 43 44 $meta = p_get_metadata($ID, 'popupscript'); 45 if ( !is_array($meta)) { 46 $meta = array(); 47 $meta['popupscript'] = array(); 48 } 49 50 $meta['popupscript'][] = trim($data); 51 p_set_metadata($ID, $meta); 52 } 53 } 54} 55// vim:ts=4:sw=4:et:enc=utf-8: 56