1<?php
2/**
3 * Helper Component for the QRCode2 Plugin
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author   Simon DELAGE <sdelage@gmail.com>
7 */
8
9// must be run within Dokuwiki
10if(!defined('DOKU_INC')) die();
11
12class helper_plugin_qrcode2 extends DokuWiki_Plugin {
13
14    protected $title_metadata   = array();
15    protected $exclusions       = array();
16    protected $nsignore         = array();
17
18    /**
19     * Build and print or return QRCode
20     *
21     * mostly based on plugin author work Daniel Pätzold <mailto://obel1x@web.de>
22     */
23    function get_img($target, $return = false, $size = 96) {
24		global $conf;
25
26        if(isset($conf['userewrite']) && $conf['userewrite'] == 2) {
27            $src = "../lib/plugins/qrcode2/png.php?id=".$target;
28        }
29        else {
30            $src = "lib/plugins/qrcode2/png.php?id=".$target;
31        }
32
33        if ($return) {
34            return $src;
35        } else {
36            print '<img src="'.$src.'" alt="*QRCode2*" height="'.$size.'" width="'.$size.'" />';
37            return 1;
38        }
39    }
40
41}
42