Skip to content

Commit

Permalink
add compatibility with ekliptor/qr-code
Browse files Browse the repository at this point in the history
  • Loading branch information
skie committed Jun 3, 2024
1 parent 951eabf commit 79c2855
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions include/barcodes/qrcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
/**
* Encoding mode alphanumeric (0-9A-Z $%*+-./:) 45characters. 2 characters are encoded to 11bit length. In theory, 4296 characters or less can be stored in a QRcode.
*/
define('QR_MODE_AN', 1);
defined('QR_MODE_AN') ?: define('QR_MODE_AN', 1);

/**
* Encoding mode 8bit byte data. In theory, 2953 characters or less can be stored in a QRcode.
Expand All @@ -130,22 +130,22 @@
/**
* Error correction level L : About 7% or less errors can be corrected.
*/
define('QR_ECLEVEL_L', 0);
defined('QR_ECLEVEL_L') ?: define('QR_ECLEVEL_L', 0);

/**
* Error correction level M : About 15% or less errors can be corrected.
*/
define('QR_ECLEVEL_M', 1);
defined('QR_ECLEVEL_M') ?: define('QR_ECLEVEL_M', 1);

/**
* Error correction level Q : About 25% or less errors can be corrected.
*/
define('QR_ECLEVEL_Q', 2);
defined('QR_ECLEVEL_Q') ?: define('QR_ECLEVEL_Q', 2);

/**
* Error correction level H : About 30% or less errors can be corrected.
*/
define('QR_ECLEVEL_H', 3);
defined('QR_ECLEVEL_H') ?: define('QR_ECLEVEL_H', 3);

// -----------------------------------------------------

Expand All @@ -157,34 +157,34 @@
/**
* Maximum QR Code version.
*/
define('QRSPEC_VERSION_MAX', 40);
defined('QRSPEC_VERSION_MAX') ?: define('QRSPEC_VERSION_MAX', 40);

/**
* Maximum matrix size for maximum version (version 40 is 177*177 matrix).
*/
define('QRSPEC_WIDTH_MAX', 177);
defined('QRSPEC_WIDTH_MAX') ?: define('QRSPEC_WIDTH_MAX', 177);

// -----------------------------------------------------

/**
* Matrix index to get width from $capacity array.
*/
define('QRCAP_WIDTH', 0);
defined('QRCAP_WIDTH') ?: define('QRCAP_WIDTH', 0);

/**
* Matrix index to get number of words from $capacity array.
*/
define('QRCAP_WORDS', 1);
defined('QRCAP_WORDS') ?: define('QRCAP_WORDS', 1);

/**
* Matrix index to get remainder from $capacity array.
*/
define('QRCAP_REMINDER', 2);
defined('QRCAP_REMINDER') ?: define('QRCAP_REMINDER', 2);

/**
* Matrix index to get error correction level from $capacity array.
*/
define('QRCAP_EC', 3);
defined('QRCAP_EC') ?: define('QRCAP_EC', 3);

// -----------------------------------------------------

Expand All @@ -193,12 +193,12 @@
/**
* Number of header bits for structured mode
*/
define('STRUCTURE_HEADER_BITS', 20);
defined('STRUCTURE_HEADER_BITS') ?: define('STRUCTURE_HEADER_BITS', 20);

/**
* Max number of symbols for structured mode
*/
define('MAX_STRUCTURED_SYMBOLS', 16);
defined('MAX_STRUCTURED_SYMBOLS') ?: define('MAX_STRUCTURED_SYMBOLS', 16);

// -----------------------------------------------------

Expand All @@ -207,22 +207,22 @@
/**
* Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
*/
define('N1', 3);
defined('N1') ?: define('N1', 3);

/**
* Down point base value for case 2 mask pattern (module block of same color)
*/
define('N2', 3);
defined('N2') ?: define('N2', 3);

/**
* Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
*/
define('N3', 40);
defined('N3') ?: define('N3', 40);

/**
* Down point base value for case 4 mask pattern (ration of dark modules in whole)
*/
define('N4', 10);
defined('N4') ?: define('N4', 10);

// -----------------------------------------------------

Expand All @@ -231,17 +231,17 @@
/**
* if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
*/
define('QR_FIND_BEST_MASK', true);
defined('QR_FIND_BEST_MASK') ?: define('QR_FIND_BEST_MASK', true);

/**
* if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
*/
define('QR_FIND_FROM_RANDOM', 2);
defined('QR_FIND_FROM_RANDOM') ?: define('QR_FIND_FROM_RANDOM', 2);

/**
* when QR_FIND_BEST_MASK === false
*/
define('QR_DEFAULT_MASK', 2);
defined('QR_DEFAULT_MASK') ?: define('QR_DEFAULT_MASK', 2);

// -----------------------------------------------------

Expand Down

0 comments on commit 79c2855

Please sign in to comment.