1<?php 2/** 3 * DokuWiki Plugin jsontable (Action Component) 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Janez Paternoster <janez.paternoster@siol.net> 7 */ 8 9// must be run within Dokuwiki 10if (!defined('DOKU_INC')) { 11 die(); 12} 13 14class action_plugin_jsontable extends DokuWiki_Action_Plugin 15{ 16 17 /** 18 * Registers a callback function for a given event 19 * 20 * @param Doku_Event_Handler $controller DokuWiki's event controller object 21 * 22 * @return void 23 */ 24 public function register(Doku_Event_Handler $controller) { 25 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_tpl_metaheader_output'); 26 } 27 28 29 /** 30 * Handle event TPL_METAHEADER_OUTPUT 31 * 32 * Adds javascript and css files to html document. 33 * 34 * @param Doku_Event $event event object by reference 35 * @param mixed $param [the parameters passed as fifth argument to register_hook() when this 36 * handler was registered] 37 * 38 * @return void 39 */ 40 public function handle_tpl_metaheader_output(Doku_Event $event, $param) { 41 $event->data["script"][] = array ( 42 "type" => "text/javascript", 43 "src" => DOKU_BASE."lib/plugins/jsontable/script/handsontable.full.min.js", 44 "_data" => "", 45 ); 46 } 47} 48