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		$src = "lib/plugins/qrcode2/png.php?id=".$target;
27        if(isset($conf['userewrite']) && $conf['userewrite'] == 2) {
28            $src = "..".$src;
29        }
30
31        if ($return) {
32            return $src;
33        } else {
34            print '<img src="'.$src.'" alt="*QRCode2*" height="'.$size.'" width="'.$size.'" />';
35            return 1;
36        }
37    }
38
39}
40