1<?php 2 3class action_plugin_instantpage_addScriptTag extends DokuWiki_Action_Plugin 4{ 5 6 /** 7 * Registers a callback function for a given event 8 * 9 * @param Doku_Event_Handler $controller DokuWiki's event controller object 10 * 11 * @return void 12 */ 13 public function register(Doku_Event_Handler $controller) 14 { 15 $controller->register_hook( 16 'TPL_METAHEADER_OUTPUT', 17 'BEFORE', 18 $this, 19 'addInstantPageScriptTag' 20 ); 21 } 22 23 /** 24 * Event: TPL_METAHEADER_OUTPUT 25 * 26 * @param Doku_Event $event event object by reference 27 * 28 * @return void 29 */ 30 public function addInstantPageScriptTag(Doku_Event $event) 31 { 32 $event->data['script'][] = [ 33 'type' => 'module', 34 'src' => DOKU_BASE . 'lib/plugins/instantpage/lib/5.1.0.js', 35 'integrity' => 'sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw', 36 'defer' => true, 37 ]; 38 } 39} 40