1<?php 2/** 3 * GoogleMap Action Plugin. 4 * 5 * @author Borodin Oleg <onborodin@gmail.com> 6 */ 7 8if(!defined('DOKU_INC')) die(); 9if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 10require_once DOKU_PLUGIN.'action.php'; 11 12class action_plugin_googlemap3 extends DokuWiki_Action_Plugin { 13 14 /** 15 * Register its handlers with the DokuWiki's event controller 16 */ 17 function register(&$controller) { 18 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 19 'insert_javascript'); 20 } 21 22 /** 23 * Hook js script into page headers. 24 */ 25 function insert_javascript(&$event, $param) { 26 $script = $this->getConf('script'); 27 28 $event->data['script'][] = array( 29 'type' => 'text/javascript', 30 'charset' => 'utf-8', 31 '_data' => '', 32 'src' => DOKU_BASE.'lib/plugins/googlemap3/googlemap3.js'); 33 34 $event->data['script'][] = array( 35 'type' => 'text/javascript', 36 'charset' => 'utf-8', 37 '_data' => ' 38function loadScript() { 39 var script = document.createElement("script"); 40 script.type = "text/javascript"; 41 script.src = "'.$script.'&callback=init_googlemap3"; 42 document.body.appendChild(script); 43} 44var googlscriptloaded = 0; 45' 46 ); 47 48 } 49} 50/* EOF */ 51