xref: /plugin/qc/helper.php (revision 6a7733deedd3256d91eadfb27619deb87ba04931)
1<?php
2/**
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 */
5
6// must be run within Dokuwiki
7if (!defined('DOKU_INC')) die();
8require_once(DOKU_INC.'inc/plugin.php');
9
10class helper_plugin_qc extends DokuWiki_Plugin {
11
12    function tpl(){
13        global $ACT,$INFO,$ID;
14        if (!function_exists('gd_info')) {
15            msg('You have to install php-gd lib to use the QC plugin.');
16            return;
17        }
18        if($ACT != 'show' || !$INFO['exists']) return;
19        if(p_get_metadata($ID, 'relation qcplugin_disabled')) return;
20        if ($this->getConf('adminonly')) {
21            if (!isset($_SERVER['REMOTE_USER']) || !auth_isadmin())
22                return;
23        }
24        echo '<div id="plugin__qc__wrapper">';
25        echo '<img src="'.DOKU_BASE.'lib/plugins/qc/icon.php?id='.$ID.'" width="600" height="25" alt="" id="plugin__qc__icon" />';
26        echo '<div id="plugin__qc__out" style="display:none"></div>';
27        echo '</div>';
28    }
29
30
31
32    function getQCData($theid){
33        global $ID;
34        $oldid = $ID;
35        $ID = $theid;
36        require_once DOKU_INC.'inc/parserutils.php';
37        $data = unserialize(p_cached_output(wikiFN($ID), 'qc', $ID));
38        $ID = $oldid;
39        return $data;
40    }
41
42}
43// vim:ts=4:sw=4:et:enc=utf-8:
44