1<?php
2/**
3 * Helper Component for the InlineJS Plugin
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  Satoshi Sahara <sahara.satoshi@gmail.com>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12class helper_plugin_inlinejs extends DokuWiki_Plugin
13{
14    /**
15     * render HTML of inline JavaScript
16     */
17    public function renderInlineJsHtml(Doku_Renderer $renderer, $script)
18    {
19        if (empty($script)) return false;
20
21        $html  = '<script type="text/javascript">'.DOKU_LF.'/*<![CDATA[*/'.DOKU_LF;
22        $html .= $script;
23        $html .= '/*!]]>*/'.DOKU_LF.'</script>'.DOKU_LF;
24        $renderer->doc .= $html;
25        return true;
26    }
27
28}
29