1<?php 2/** 3 * Userfly Action Plugin: Register UserFly-Javascript 4 * 5 * @author Jürgen A.Lamers <jaloma.ac@googlemail.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_userfly extends DokuWiki_Action_Plugin { 13 14 /** 15 * return some info 16 */ 17 function getInfo(){ 18 return array( 19 'author' => 'Jürgen A.Lamers', 20 'email' => 'jaloma.ac@googlemail.com', 21 'date' => '2009-01-14', 22 'name' => 'Userfly (action plugin component)', 23 'desc' => 'UserFly action functions.', 24 'url' => 'http://www.dokuwiki.org/plugin:userfly', 25 ); 26 } 27 28 /** 29 * Register its handlers with the dokuwiki's event controller 30 */ 31 function register(&$controller) { 32 $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, '_hookjs'); 33 } 34 35 /** 36 * Hook js script into page headers. 37 */ 38 39 function _hookjs(&$event, $param) { 40 global $conf; 41 $userKey = $this->getConf('userFlyUserKey'); 42 $event->data["script"][] = array ("type" => "text/javascript", 43 "charset" => "utf-8", 44 "_data" => "", 45 "src" => 'http://asset.userfly.com/users/'.$userKey.'/userfly.js' 46 ); 47 } 48} 49