';
+
+
+
+Optional configuration
+
+ $this->load->library('ciqrcode');
+
+ $config['cacheable'] = true; //boolean, the default is true
+ $config['cachedir'] = ''; //string, the default is application/cache/
+ $config['errorlog'] = ''; //string, the default is application/logs/
+ $config['quality'] = true; //boolean, the default is true
+ $config['size'] = ''; //interger, the default is 1024
+ $config['black'] = array(224,255,255); // array, default is array(255,255,255)
+ $config['white'] = array(70,130,180); // array, default is array(0,0,0)
+ $this->ciqrcode->initialize($config);
+
+
+Contributors
+------------
+1. [Jared Hatfield](https://github.com/JaredHatfield "Jared Hatfield")
+2. [Collin Price](https://github.com/collinprice "Collin Price")
diff --git a/lib/ciqrcode/ciqrcode.class.php b/lib/ciqrcode/ciqrcode.class.php
new file mode 100644
index 0000000000..ff74d7c7c1
--- /dev/null
+++ b/lib/ciqrcode/ciqrcode.class.php
@@ -0,0 +1,107 @@
+initialize($config);
+ }
+
+ public function initialize($config = array()) {
+ define('FCPATH', '');
+ $this->cacheable = (isset($config['cacheable'])) ? $config['cacheable'] : $this->cacheable;
+ $this->cachedir = (isset($config['cachedir'])) ? $config['cachedir'] : FCPATH.$this->cachedir;
+ $this->errorlog = (isset($config['errorlog'])) ? $config['errorlog'] : FCPATH.$this->errorlog;
+ $this->quality = (isset($config['quality'])) ? $config['quality'] : $this->quality;
+ $this->size = (isset($config['size'])) ? $config['size'] : $this->size;
+
+ // use cache - more disk reads but less CPU power, masks and format templates are stored there
+ if (!defined('QR_CACHEABLE')) define('QR_CACHEABLE', $this->cacheable);
+
+ // used when QR_CACHEABLE === true
+ if (!defined('QR_CACHE_DIR')) define('QR_CACHE_DIR', $this->cachedir);
+
+ // default error logs dir
+ if (!defined('QR_LOG_DIR')) define('QR_LOG_DIR', $this->errorlog);
+
+ // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
+ if ($this->quality) {
+ if (!defined('QR_FIND_BEST_MASK')) define('QR_FIND_BEST_MASK', true);
+ } else {
+ if (!defined('QR_FIND_BEST_MASK')) define('QR_FIND_BEST_MASK', false);
+ if (!defined('QR_DEFAULT_MASK')) define('QR_DEFAULT_MASK', $this->quality);
+ }
+
+ // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
+ if (!defined('QR_FIND_FROM_RANDOM')) define('QR_FIND_FROM_RANDOM', false);
+
+ // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
+ if (!defined('QR_PNG_MAXIMUM_SIZE')) define('QR_PNG_MAXIMUM_SIZE', $this->size);
+
+ // call original library
+ include "qrcode/qrconst.php";
+ include "qrcode/qrtools.php";
+ include "qrcode/qrspec.php";
+ include "qrcode/qrimage.php";
+ include "qrcode/qrinput.php";
+ include "qrcode/qrbitstream.php";
+ include "qrcode/qrsplit.php";
+ include "qrcode/qrrscode.php";
+ include "qrcode/qrmask.php";
+ include "qrcode/qrencode.php";
+ }
+
+ public function generate($params = array()) {
+ if (isset($params['black'])
+ && is_array($params['black'])
+ && count($params['black']) == 3
+ && array_filter($params['black'], 'is_int') === $params['black']) {
+ QRimage::$black = $params['black'];
+ }
+
+ if (isset($params['white'])
+ && is_array($params['white'])
+ && count($params['white']) == 3
+ && array_filter($params['white'], 'is_int') === $params['white']) {
+ QRimage::$white = $params['white'];
+ }
+
+ $params['data'] = (isset($params['data'])) ? $params['data'] : 'QR Code Library';
+ if (isset($params['savename'])) {
+ $level = 'L';
+ if (isset($params['level']) && in_array($params['level'], array('L','M','Q','H'))) $level = $params['level'];
+
+ $size = 4;
+ if (isset($params['size'])) $size = min(max((int)$params['size'], 1), 10);
+
+ QRcode::png($params['data'], $params['savename'], $level, $size, 2);
+ return $params['savename'];
+ } else {
+ $level = 'L';
+ if (isset($params['level']) && in_array($params['level'], array('L','M','Q','H'))) $level = $params['level'];
+
+ $size = 4;
+ if (isset($params['size'])) $size = min(max((int)$params['size'], 1), 10);
+
+ QRcode::png($params['data'], NULL, $level, $size, 2);
+ }
+ }
+}
+
+/* end of file */
diff --git a/lib/ciqrcode/qrcode/phpqrcode.php b/lib/ciqrcode/qrcode/phpqrcode.php
new file mode 100644
index 0000000000..ea8c08f9a2
--- /dev/null
+++ b/lib/ciqrcode/qrcode/phpqrcode.php
@@ -0,0 +1,3312 @@
+
+ *
+ * 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
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received 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
+ */
+
+
+
+/*
+ * Version: 1.1.4
+ * Build: 2010100721
+ */
+
+
+
+//---- qrconst.php -----------------------------
+
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Common constants
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi | BENCHMARK | |
| till '.$markerId.': | '.number_format($thisTime-$lastTime, 6).'s |
|---|---|
| TOTAL: | '.number_format($lastTime-$startTime, 6).'s |
| BENCHMARK | |
| till '.$markerId.': | '.number_format($thisTime-$lastTime, 6).'s |
|---|---|
| TOTAL: | '.number_format($lastTime-$startTime, 6).'s |