1<?php
2 /**
3 * DokuWiki Plugin flexpaper (Syntax Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Ethen Guo <Ethen.Guo@Gmail.com>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12if (!defined('DOKU_LF')) define('DOKU_LF', "\n");
13if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t");
14if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
15
16require_once DOKU_PLUGIN.'action.php';
17
18class action_plugin_flexpaper extends DokuWiki_Action_Plugin {
19
20    // Register our handler for the TPL_METAHEADER_OUTPUT event
21    public function register(Doku_Event_Handler &$controller) {
22       $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'load_required_javascript');
23    }
24
25    public function load_required_javascript(Doku_Event &$event, $param) {
26        // Load flexpaper itself
27        $event->data['script'][] = array(
28			'type'    => 'text/javascript',
29			'charset' => 'utf-8',
30			'src'     => DOKU_REL . 'lib/plugins/flexpaper/FlexPaper/js/flexpaper.js',
31			'_data'   => '',
32		);
33        // Load flexpaper_handlers
34        $event->data['script'][] = array(
35			'type'    => 'text/javascript',
36			'charset' => 'utf-8',
37			'src'     => DOKU_REL . 'lib/plugins/flexpaper/FlexPaper/js/flexpaper_handlers.js',
38			'_data'   => '',
39		);
40	}
41}
42
43// vim:ts=4:sw=4:et:
44