1<?php
2if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/');
3if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
4require_once(DOKU_PLUGIN.'action.php');
5
6/**
7 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 * @author     Pierre Spring <pierre.spring@liip.ch>
9 */
10
11class action_plugin_npd_meta extends DokuWiki_Action_Plugin {
12    var $js_location      = false;
13
14    function getInfo()
15    {
16        return confToHash(dirname(__FILE__).'../plugin.info.txt');
17    }
18
19    function register(&$controller)
20    {
21        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'meta');
22    }
23
24    /**
25     * meta adds the js file needed to display the "Create New Page"
26     *
27     * @param mixed $event
28     * @access public
29     * @return void
30     */
31    function meta(&$event)
32    {
33        $plugin = $this->getPluginName();
34        $js_base_dir = DOKU_BASE.'lib/plugins/'.$plugin.'/js/';
35        $this->js_location = $js_base_dir . 'button.js';
36        $event->data['script'][] =
37            array(
38                'type'=>'text/javascript',
39                'charset'=>'utf-8',
40                '_data'=>'',
41                'src'=> $this->js_location
42            );
43        return;
44    }
45}
46