1<?php
2/**
3 * DokuWiki Plugin miniblog
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  lainme <lainme993@gmail.com>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12class helper_plugin_miniblog_comment extends DokuWiki_Plugin {
13    public function comment_script($source, $option) {
14        $doc = '<script type="text/javascript">';
15
16        foreach ($option as $key => $value) {
17            $doc .= 'var '.$key.'="'.$value.'";';
18        }
19
20        $doc .= '(function () { var s = document.createElement("script");';
21        $doc .= 's.async = true; s.type = "text/javascript";';
22        $doc .= 's.src = "//" + disqus_shortname + ".disqus.com/'.$source.'";';
23        $doc .= '(document.getElementsByTagName("HEAD")[0] || document.getElementsByTagName("BODY")[0]).appendChild(s);';
24        $doc .= '}()); </script>';
25
26        return $doc;
27    }
28}
29