1<?php
2
3/**
4 * Plugin barcode: 2D-Barcode Implementation
5 *
6 * @author Enrico Croce & Simona Burzio (staff@eiroca.net)
7 * @copyright Copyright (C) 2009-2019 eIrOcA - Enrico Croce & Simona Burzio
8 * @license GPL >=3 (http://www.gnu.org/licenses/)
9 * @version 19.02
10 * @link http://www.eiroca.net
11 */
12class QR_google extends QRProvider {
13
14  // http://code.google.com/intl/it-IT/apis/chart/types.html#qrcodes
15  function render(&$p) {
16    $first = true;
17    $size = $p['size'];
18    $text = $p['text'];
19    //$caption = $p['caption'];
20    $resultStr = 'http://chart.apis.google.com/chart?';
21    $resultStr .= $this->addParam($first, 'cht=qr');
22    switch ($size) {
23      case 'S' :
24        $resultStr .= $this->addParam($first, 'chs=120x120');
25        break;
26      case 'M' :
27        $resultStr .= $this->addParam($first, 'chs=240x240');
28        break;
29      case 'L' :
30        $resultStr .= $this->addParam($first, 'chs=350x350');
31        break;
32      case 'XL' :
33        $resultStr .= $this->addParam($first, 'chs=500x500');
34        break;
35      default :
36        $resultStr .= $this->addParam($first, 'chs=240x240');
37        break;
38    }
39    $resultStr .= $this->addParam($first, 'chl=' . urlencode($text));
40    return $this->_IMG($resultStr, $p['id'], $p['class']);
41  }
42
43}
44?>