182c064c1SAndreas Gohr<?php 282c064c1SAndreas Gohr/** 382c064c1SAndreas Gohr * DokuWiki Plugin struct (Action Component) 482c064c1SAndreas Gohr * 582c064c1SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 682c064c1SAndreas Gohr * @author Andreas Gohr, Michael Große <dokuwiki@cosmocode.de> 782c064c1SAndreas Gohr */ 882c064c1SAndreas Gohr 982c064c1SAndreas Gohr// must be run within Dokuwiki 1082c064c1SAndreas Gohrif(!defined('DOKU_INC')) die(); 1182c064c1SAndreas Gohr 1282c064c1SAndreas Gohruse plugin\struct\meta\Assignments; 1382c064c1SAndreas Gohruse plugin\struct\meta\SchemaData; 1482c064c1SAndreas Gohr 1582c064c1SAndreas Gohr/** 1682c064c1SAndreas Gohr * Class action_plugin_struct_output 1782c064c1SAndreas Gohr * 1882c064c1SAndreas Gohr * This action component handles the automatic output of all schema data that has been assigned 1982c064c1SAndreas Gohr * to the current page by appending the appropriate instruction to the handler calls. 2082c064c1SAndreas Gohr * 2182c064c1SAndreas Gohr * The real output creation is done within the syntax component 2282c064c1SAndreas Gohr * @see syntax_plugin_struct_output 2382c064c1SAndreas Gohr */ 2482c064c1SAndreas Gohrclass action_plugin_struct_output extends DokuWiki_Action_Plugin { 2582c064c1SAndreas Gohr 2682c064c1SAndreas Gohr /** 2782c064c1SAndreas Gohr * Registers a callback function for a given event 2882c064c1SAndreas Gohr * 2982c064c1SAndreas Gohr * @param Doku_Event_Handler $controller DokuWiki's event controller object 3082c064c1SAndreas Gohr * @return void 3182c064c1SAndreas Gohr */ 3282c064c1SAndreas Gohr public function register(Doku_Event_Handler $controller) { 3382c064c1SAndreas Gohr $controller->register_hook('PARSER_HANDLER_DONE', 'AFTER', $this, 'handle_output'); 3482c064c1SAndreas Gohr 3582c064c1SAndreas Gohr } 3682c064c1SAndreas Gohr 3782c064c1SAndreas Gohr /** 3882c064c1SAndreas Gohr * Appends the instruction to render our syntax output component to each page 3982c064c1SAndreas Gohr * 4082c064c1SAndreas Gohr * @param Doku_Event $event 4182c064c1SAndreas Gohr * @param $param 4282c064c1SAndreas Gohr */ 4382c064c1SAndreas Gohr public function handle_output(Doku_Event &$event, $param) { 4482c064c1SAndreas Gohr global $ACT; 455a1eab78SAndreas Gohr global $ID; 465a1eab78SAndreas Gohr if($ACT != 'show') return; //FIXME what about export_*? 47*02481400SAndreas Gohr if(!page_exists($ID)) return; 4882c064c1SAndreas Gohr 495a1eab78SAndreas Gohr $pos = filesize(wikiFN($ID))+1; 5082c064c1SAndreas Gohr 5182c064c1SAndreas Gohr $event->data->calls[] = array( 5282c064c1SAndreas Gohr 'plugin', 5382c064c1SAndreas Gohr array( 545a1eab78SAndreas Gohr 'struct_output', array('pos'=>$pos), DOKU_LEXER_SPECIAL, '' 5582c064c1SAndreas Gohr ), 5682c064c1SAndreas Gohr $pos 5782c064c1SAndreas Gohr ); 5882c064c1SAndreas Gohr } 5982c064c1SAndreas Gohr 6082c064c1SAndreas Gohr} 6182c064c1SAndreas Gohr 6282c064c1SAndreas Gohr// vim:ts=4:sw=4:et: 63