|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* PHP QR Code encoder |
|
4
|
|
|
* |
|
5
|
|
|
* Reed-Solomon error correction support |
|
6
|
|
|
* |
|
7
|
|
|
* Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q |
|
8
|
|
|
* (libfec is released under the GNU Lesser General Public License.) |
|
9
|
|
|
* |
|
10
|
|
|
* Based on libqrencode C library distributed under LGPL 2.1 |
|
11
|
|
|
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <[email protected]> |
|
12
|
|
|
* |
|
13
|
|
|
* PHP QR Code is distributed under LGPL 3 |
|
14
|
|
|
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm> |
|
15
|
|
|
* |
|
16
|
|
|
* This library is free software; you can redistribute it and/or |
|
17
|
|
|
* modify it under the terms of the GNU Lesser General Public |
|
18
|
|
|
* License as published by the Free Software Foundation; either |
|
19
|
|
|
* version 3 of the License, or any later version. |
|
20
|
|
|
* |
|
21
|
|
|
* This library is distributed in the hope that it will be useful, |
|
22
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
23
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
24
|
|
|
* Lesser General Public License for more details. |
|
25
|
|
|
* |
|
26
|
|
|
* You should have received a copy of the GNU Lesser General Public |
|
27
|
|
|
* License along with this library; if not, write to the Free Software |
|
28
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
29
|
|
|
*/ |
|
30
|
|
|
namespace tinymeng\code\Gateways\qrcode; |
|
31
|
|
|
|
|
32
|
|
|
class QRrs { |
|
33
|
|
|
|
|
34
|
|
|
public static $items = array(); |
|
35
|
|
|
|
|
36
|
|
|
//---------------------------------------------------------------------- |
|
37
|
|
|
public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) |
|
38
|
|
|
{ |
|
39
|
|
|
foreach(self::$items as $rs) { |
|
40
|
|
|
if($rs->pad != $pad) continue; |
|
41
|
|
|
if($rs->nroots != $nroots) continue; |
|
42
|
|
|
if($rs->mm != $symsize) continue; |
|
43
|
|
|
if($rs->gfpoly != $gfpoly) continue; |
|
44
|
|
|
if($rs->fcr != $fcr) continue; |
|
45
|
|
|
if($rs->prim != $prim) continue; |
|
46
|
|
|
|
|
47
|
|
|
return $rs; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad); |
|
51
|
|
|
array_unshift(self::$items, $rs); |
|
52
|
|
|
|
|
53
|
|
|
return $rs; |
|
54
|
|
|
} |
|
55
|
|
|
} |