1<?php 2/** 3 * OpenStreetMap Action Plugin: Register OpenLayers-Javascript 4 * 5 * @author Michael Hamann <michael@content-space.de> 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_osm extends DokuWiki_Action_Plugin { 13 /** 14 * Register its handlers with the dokuwiki's event controller 15 */ 16 function register(Doku_Event_Handler $controller) { 17 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_hookjs'); 18 } 19 20 /** 21 * Hook js script into page headers. 22 */ 23 function _hookjs(&$event, $param) { 24 $event->data["script"][] = array ("type" => "text/javascript", 25 "charset" => "utf-8", 26 "_data" => "", 27 "src" => 'http://openlayers.org/api/OpenLayers.js' 28 ); 29 $event->data["script"][] = array ("type" => "text/javascript", 30 "charset" => "utf-8", 31 "_data" => "", 32 "src" => ml('http://openstreetmap.org/openlayers/OpenStreetMap.js', array('cache' => 'recache'), true, '&') 33 ); 34 } 35} 36