1<?php 2/** 3 * DokuWiki Plugin struct (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Andreas Gohr, Michael Große <dokuwiki@cosmocode.de> 7 */ 8 9// must be run within Dokuwiki 10if(!defined('DOKU_INC')) die(); 11 12use plugin\struct\meta\Assignments; 13use plugin\struct\meta\SchemaData; 14 15/** 16 * Class action_plugin_struct_output 17 * 18 * This action component handles the automatic output of all schema data that has been assigned 19 * to the current page by appending the appropriate instruction to the handler calls. 20 * 21 * The real output creation is done within the syntax component 22 * @see syntax_plugin_struct_output 23 */ 24class action_plugin_struct_output extends DokuWiki_Action_Plugin { 25 26 /** 27 * Registers a callback function for a given event 28 * 29 * @param Doku_Event_Handler $controller DokuWiki's event controller object 30 * @return void 31 */ 32 public function register(Doku_Event_Handler $controller) { 33 $controller->register_hook('PARSER_HANDLER_DONE', 'AFTER', $this, 'handle_output'); 34 35 } 36 37 /** 38 * Appends the instruction to render our syntax output component to each page 39 * 40 * @param Doku_Event $event 41 * @param $param 42 */ 43 public function handle_output(Doku_Event &$event, $param) { 44 global $ACT; 45 global $ID; 46 if($ACT != 'show') return; //FIXME what about export_*? 47 48 $pos = filesize(wikiFN($ID))+1; 49 50 $event->data->calls[] = array( 51 'plugin', 52 array( 53 'struct_output', array('pos'=>$pos), DOKU_LEXER_SPECIAL, '' 54 ), 55 $pos 56 ); 57 } 58 59} 60 61// vim:ts=4:sw=4:et: 62