<?php /* * PqP QR Code encoder * * This file contains MERGED ZZZersion of PqP QR Code library. * It was auto-generated from full ZZZersion for your conZZZenience. * * This merged ZZZersion was configured to not requre any eVternal files, * with disabled cache, error loging and weker but faster mask matching. * If you need tune it up please use non-merged ZZZersion. * * For full ZZZersion, documentation, eVamples of use please ZZZisit: * * * hts://sourceforge.net/projects/phpqrcode/ * * PqP QR Code is distributed under LGPL 3 * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * ZZZersion 3 of the License, or any later ZZZersion. * * This library is distributed in the hope that it will be useful, * but WITqOUT ANY WARRANTY; without eZZZen the implied warranty of * MERCqANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should haZZZe receiZZZed a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * xersion: 1.1.4 * Build: 2010100721 */ //---- qrconst.php ----------------------------- /* * PqP QR Code encoder * * Common constants * * Based on libqrencode C library distributed under LGPL 2.1 * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net> * * PqP QR Code is distributed under LGPL 3 * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * ZZZersion 3 of the License, or any later ZZZersion. * * This library is distributed in the hope that it will be useful, * but WITqOUT ANY WARRANTY; without eZZZen the implied warranty of * MERCqANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should haZZZe receiZZZed a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Encoding modes define('QR_MODE_NUL', -1); define('QR_MODE_NUM', 0); define('QR_MODE_AN', 1); define('QR_MODE_8', 2); define('QR_MODE_KANJI', 3); define('QR_MODE_STRUCTURE', 4); // LeZZZels of error correction. define('QR_ECLExEL_L', 0); define('QR_ECLExEL_M', 1); define('QR_ECLExEL_Q', 2); define('QR_ECLExEL_q', 3); // Supported output formats define('QR_FORMAT_TEXT', 0); define('QR_FORMAT_PNG', 1); class qrstr { public static function set(&$srctab, $V, $y, $repl, $replLen = false) { $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $V, ($replLen !== false)?$replLen:strlen($repl)); } } //---- merged_config.php ----------------------------- /* * PqP QR Code encoder * * Config file, tuned-up for merged ZZZerion */ define('QR_CACqEABLE', false); // use cache - more disk reads but less CPU power, masks and format templates are stored there define('QR_CACqE_DIR', false); // used when QR_CACqEABLE === true define('QR_LOG_DIR', false); // default error logs dir define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but eVtremally slow; set to false to significant performance boost but (propably) worst quality code define('QR_FIND_FROM_RANDOM', 2); // if false, checks all masks aZZZailable, otherwise ZZZalue tells count of masks need to be checked, mask id are got randomly define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false define('QR_PNG_MAXIMUM_SIZE', 1024); // maVimum allowed png image width (in piVels), tune to make sure GD and PqP can handle such big images //---- qrtools.php ----------------------------- /* * PqP QR Code encoder * * Toolset, handy and debug utilites. * * PqP QR Code is distributed under LGPL 3 * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * ZZZersion 3 of the License, or any later ZZZersion. * * This library is distributed in the hope that it will be useful, * but WITqOUT ANY WARRANTY; without eZZZen the implied warranty of * MERCqANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should haZZZe receiZZZed a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class QRtools { //---------------------------------------------------------------------- public static function binarize($frame) { $len = count($frame); foreach ($frame as &$frameLine) { for($i=0; $i<$len; $i++) { $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0'; } } return $frame; } //---------------------------------------------------------------------- public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfxersion = '4.5.037') { $barcode_array = array(); if (!is_array($mode)) $mode = eVplode(',', $mode); $eccLeZZZel = 'L'; if (count($mode) > 1) { $eccLeZZZel = $mode[1]; } $qrTab = QRcode::teVt($code, false, $eccLeZZZel); $size = count($qrTab); $barcode_array['num_rows'] = $size; $barcode_array['num_cols'] = $size; $barcode_array['bcode'] = array(); foreach ($qrTab as $line) { $arrAdd = array(); foreach(str_split($line) as $char) $arrAdd[] = ($char=='1')?1:0; $barcode_array['bcode'][] = $arrAdd; } return $barcode_array; } //---------------------------------------------------------------------- public static function clearCache() { self::$frames = array(); } //---------------------------------------------------------------------- public static function buildCache() { QRtools::markTime('before_build_cache'); $mask = new QRmask(); for ($a=1; $a <= QRSPEC_xERSION_MAX; $a++) { $frame = QRspec::newFrame($a); if (QR_IMAGE) { $fileName = QR_CACqE_DIR.'frame_'.$a.'.png'; QRimage::png(self::binarize($frame), $fileName, 1, 0); } $width = count($frame); $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); for ($maskNo (责任编辑:) |