SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/phpqrcode/qrconst.php

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