1<?php
2/**
3 * Yahoo! Media Player: Plugin for Dokuwiki
4 *
5 * @author      Haiko Hall <haiko.hall@gmail.com>
6 * @version     0.2
7 * @license     GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 *
9 * v 0.2 supports the new webplayer
10 * for more information about the player go to
11 * http://mediaplayer.yahoo.com/
12 * http://yahoomediaplayer.wikia.com/wiki/How_To_Use
13 *
14 */
15
16if(!defined('DOKU_INC')) die();
17if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
18require_once DOKU_PLUGIN.'action.php';
19
20
21class action_plugin_yahoomediaplayer extends DokuWiki_Action_Plugin {
22
23    /**
24     * return some info
25     */
26    function getInfo(){
27        return array('author' => 'Heiko Thielen',
28                     'email'  => 'thielen@datenfahrt.de',
29                     'date'   => '2011-25-04',
30                     'name'   => 'Yahoo! Media Player Plugin',
31                     'desc'   => 'Insert the yahoo media player in your dokuwiki.',
32                     'url'    => 'http://datenfahrt.de/wiki/webdev/stuff/yahoo-mediaplayer-plugin-fuer-dokuwiki');
33    }
34
35    /**
36     * Register Hook
37     */
38    function register(&$controller) {
39            $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this,
40                                      "_hookjs");
41    }
42
43    /**
44     * insert mediaplayer source
45     */
46    function _hookjs(&$event, $param) {
47        $event->data['script'][] = array(
48                            'type'    => 'text/javascript',
49                            'charset' => 'utf-8',
50                            '_data'   => '',
51                            'src'     => 'http://webplayer.yahooapis.com/player.js');
52    }
53}
54
55?>
56