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 if($ACT != 'show') return; 46 47 $pos = 0; //FIXME this should probably be the file size? 48 49 $event->data->calls[] = array( 50 'plugin', 51 array( 52 'struct_output', array(), DOKU_LEXER_SPECIAL, '' 53 ), 54 $pos 55 ); 56 } 57 58} 59 60// vim:ts=4:sw=4:et: 61