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