]>
Commit | Line | Data |
---|---|---|
fb70f26e AD |
1 | <?php\r |
2 | \r | |
3 | /*\r | |
4 | * PHP QR Code encoder\r | |
5 | *\r | |
6 | * Common constants\r | |
7 | *\r | |
8 | * Based on libqrencode C library distributed under LGPL 2.1\r | |
9 | * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>\r | |
10 | *\r | |
11 | * PHP QR Code is distributed under LGPL 3\r | |
12 | * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>\r | |
13 | *\r | |
14 | * This library is free software; you can redistribute it and/or\r | |
15 | * modify it under the terms of the GNU Lesser General Public\r | |
16 | * License as published by the Free Software Foundation; either\r | |
17 | * version 3 of the License, or any later version.\r | |
18 | *\r | |
19 | * This library is distributed in the hope that it will be useful,\r | |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of\r | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r | |
22 | * Lesser General Public License for more details.\r | |
23 | *\r | |
24 | * You should have received a copy of the GNU Lesser General Public\r | |
25 | * License along with this library; if not, write to the Free Software\r | |
26 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r | |
27 | */\r | |
28 | \r | |
29 | // Encoding modes\r | |
30 | \r | |
31 | define('QR_MODE_NUL', -1);\r | |
32 | define('QR_MODE_NUM', 0);\r | |
33 | define('QR_MODE_AN', 1);\r | |
34 | define('QR_MODE_8', 2);\r | |
35 | define('QR_MODE_KANJI', 3);\r | |
36 | define('QR_MODE_STRUCTURE', 4);\r | |
37 | \r | |
38 | // Levels of error correction.\r | |
39 | \r | |
40 | define('QR_ECLEVEL_L', 0);\r | |
41 | define('QR_ECLEVEL_M', 1);\r | |
42 | define('QR_ECLEVEL_Q', 2);\r | |
43 | define('QR_ECLEVEL_H', 3);\r | |
44 | \r | |
45 | // Supported output formats\r | |
46 | \r | |
47 | define('QR_FORMAT_TEXT', 0);\r | |
48 | define('QR_FORMAT_PNG', 1);\r | |
49 | \r | |
50 | class qrstr {\r | |
51 | public static function set(&$srctab, $x, $y, $repl, $replLen = false) {\r | |
52 | $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));\r | |
53 | }\r | |
54 | } |