@@ -435,7 +435,7 @@ |
||
435 | 435 | $processed++; |
436 | 436 | } |
437 | 437 | |
438 | - print "Processed $processed articles...\n"; |
|
438 | + print "processed $processed articles...\n"; |
|
439 | 439 | |
440 | 440 | if ($processed < $limit) { |
441 | 441 | echo "All done.\n"; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element. |
272 | 272 | */ |
273 | 273 | function str_split($string, $split_length=1) { |
274 | - if ((strlen($string) > $split_length) OR (!$split_length)) { |
|
274 | + if ((strlen($string) > $split_length) or (!$split_length)) { |
|
275 | 275 | do { |
276 | 276 | $c = strlen($string); |
277 | 277 | $parts[] = substr($string, 0, $split_length); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | */ |
656 | 656 | public function __construct($code, $eclevel = 'L') { |
657 | 657 | $barcode_array = array(); |
658 | - if ((is_null($code)) OR ($code == '\0') OR ($code == '')) { |
|
658 | + if ((is_null($code)) or ($code == '\0') or ($code == '')) { |
|
659 | 659 | return false; |
660 | 660 | } |
661 | 661 | // set error correction level |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | if ($this->level === false) { |
664 | 664 | $this->level = QR_ECLEVEL_L; |
665 | 665 | } |
666 | - if (($this->hint != QR_MODE_8B) AND ($this->hint != QR_MODE_KJ)) { |
|
666 | + if (($this->hint != QR_MODE_8B) and ($this->hint != QR_MODE_KJ)) { |
|
667 | 667 | return false; |
668 | 668 | } |
669 | - if (($this->version < 0) OR ($this->version > QRSPEC_VERSION_MAX)) { |
|
669 | + if (($this->version < 0) or ($this->version > QRSPEC_VERSION_MAX)) { |
|
670 | 670 | return false; |
671 | 671 | } |
672 | 672 | $this->items = array(); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | } |
723 | 723 | $ret = $this->splitString(); |
724 | 724 | if ($ret < 0) { |
725 | - return NULL; |
|
725 | + return null; |
|
726 | 726 | } |
727 | 727 | $this->encodeMask(-1); |
728 | 728 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $spec = array(0, 0, 0, 0, 0); |
736 | 736 | $this->datacode = $this->getByteStream($this->items); |
737 | 737 | if (is_null($this->datacode)) { |
738 | - return NULL; |
|
738 | + return null; |
|
739 | 739 | } |
740 | 740 | $spec = $this->getEccSpec($this->version, $this->level, $spec); |
741 | 741 | $this->b1 = $this->rsBlockNum1($spec); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $this->blocks = $this->rsBlockNum($spec); |
746 | 746 | $ret = $this->init($spec); |
747 | 747 | if ($ret < 0) { |
748 | - return NULL; |
|
748 | + return null; |
|
749 | 749 | } |
750 | 750 | $this->count = 0; |
751 | 751 | $this->width = $this->getWidth($this->version); |
@@ -781,8 +781,8 @@ discard block |
||
781 | 781 | } else { |
782 | 782 | $masked = $this->makeMask($this->width, $this->frame, $mask, $this->level); |
783 | 783 | } |
784 | - if ($masked == NULL) { |
|
785 | - return NULL; |
|
784 | + if ($masked == null) { |
|
785 | + return null; |
|
786 | 786 | } |
787 | 787 | $this->data = $masked; |
788 | 788 | } |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | } |
852 | 852 | } |
853 | 853 | } |
854 | - if (($x < 0) OR ($y < 0)) { |
|
855 | - return NULL; |
|
854 | + if (($x < 0) or ($y < 0)) { |
|
855 | + return null; |
|
856 | 856 | } |
857 | 857 | $this->x = $x; |
858 | 858 | $this->y = $y; |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | $dl = $this->rsDataCodes2($spec); |
897 | 897 | $el = $this->rsEccCodes2($spec); |
898 | 898 | $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el); |
899 | - if ($rs == NULL) { |
|
899 | + if ($rs == null) { |
|
900 | 900 | return -1; |
901 | 901 | } |
902 | 902 | $endfor = $this->rsBlockNum2($spec); |
@@ -1144,15 +1144,15 @@ discard block |
||
1144 | 1144 | $demerit += (N1 + ($this->runLength[$i] - 5)); |
1145 | 1145 | } |
1146 | 1146 | if ($i & 1) { |
1147 | - if (($i >= 3) AND ($i < ($length-2)) AND ($this->runLength[$i] % 3 == 0)) { |
|
1147 | + if (($i >= 3) and ($i < ($length-2)) and ($this->runLength[$i] % 3 == 0)) { |
|
1148 | 1148 | $fact = (int)($this->runLength[$i] / 3); |
1149 | 1149 | if (($this->runLength[$i-2] == $fact) |
1150 | - AND ($this->runLength[$i-1] == $fact) |
|
1151 | - AND ($this->runLength[$i+1] == $fact) |
|
1152 | - AND ($this->runLength[$i+2] == $fact)) { |
|
1153 | - if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) { |
|
1150 | + and ($this->runLength[$i-1] == $fact) |
|
1151 | + and ($this->runLength[$i+1] == $fact) |
|
1152 | + and ($this->runLength[$i+2] == $fact)) { |
|
1153 | + if (($this->runLength[$i-3] < 0) or ($this->runLength[$i-3] >= (4 * $fact))) { |
|
1154 | 1154 | $demerit += N3; |
1155 | - } elseif ((($i+3) >= $length) OR ($this->runLength[$i+3] >= (4 * $fact))) { |
|
1155 | + } elseif ((($i+3) >= $length) or ($this->runLength[$i+3] >= (4 * $fact))) { |
|
1156 | 1156 | $demerit += N3; |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1179,14 +1179,14 @@ discard block |
||
1179 | 1179 | $frameYM = $frame[$y-1]; |
1180 | 1180 | } |
1181 | 1181 | for ($x=0; $x<$width; ++$x) { |
1182 | - if (($x > 0) AND ($y > 0)) { |
|
1182 | + if (($x > 0) and ($y > 0)) { |
|
1183 | 1183 | $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]); |
1184 | 1184 | $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]); |
1185 | 1185 | if (($b22 | ($w22 ^ 1)) & 1) { |
1186 | 1186 | $demerit += N2; |
1187 | 1187 | } |
1188 | 1188 | } |
1189 | - if (($x == 0) AND (ord($frameY[$x]) & 1)) { |
|
1189 | + if (($x == 0) and (ord($frameY[$x]) & 1)) { |
|
1190 | 1190 | $this->runLength[0] = -1; |
1191 | 1191 | $head = 1; |
1192 | 1192 | $this->runLength[$head] = 1; |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | $head = 0; |
1206 | 1206 | $this->runLength[0] = 1; |
1207 | 1207 | for ($y=0; $y<$width; ++$y) { |
1208 | - if (($y == 0) AND (ord($frame[$y][$x]) & 1)) { |
|
1208 | + if (($y == 0) and (ord($frame[$y][$x]) & 1)) { |
|
1209 | 1209 | $this->runLength[0] = -1; |
1210 | 1210 | $head = 1; |
1211 | 1211 | $this->runLength[$head] = 1; |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | if ($pos+1 < strlen($this->dataStr)) { |
1311 | 1311 | $d = $this->dataStr[$pos+1]; |
1312 | 1312 | $word = (ord($c) << 8) | ord($d); |
1313 | - if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) { |
|
1313 | + if (($word >= 0x8140 && $word <= 0x9ffc) or ($word >= 0xe040 && $word <= 0xebbf)) { |
|
1314 | 1314 | return QR_MODE_KJ; |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | if ($mode == QR_MODE_KJ) { |
1504 | 1504 | $p += 2; |
1505 | 1505 | } else { |
1506 | - if ((ord($this->dataStr[$p]) >= ord('a')) AND (ord($this->dataStr[$p]) <= ord('z'))) { |
|
1506 | + if ((ord($this->dataStr[$p]) >= ord('a')) and (ord($this->dataStr[$p]) <= ord('z'))) { |
|
1507 | 1507 | $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32); |
1508 | 1508 | } |
1509 | 1509 | $p++; |
@@ -1530,7 +1530,7 @@ discard block |
||
1530 | 1530 | $setData = array_merge($setData, array_fill(0, ($size - count($setData)), 0)); |
1531 | 1531 | } |
1532 | 1532 | if (!$this->check($mode, $size, $setData)) { |
1533 | - return NULL; |
|
1533 | + return null; |
|
1534 | 1534 | } |
1535 | 1535 | $inputitem = array(); |
1536 | 1536 | $inputitem['mode'] = $mode; |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | if ($size > MAX_STRUCTURED_SYMBOLS) { |
1725 | 1725 | return -1; |
1726 | 1726 | } |
1727 | - if (($index <= 0) OR ($index > MAX_STRUCTURED_SYMBOLS)) { |
|
1727 | + if (($index <= 0) or ($index > MAX_STRUCTURED_SYMBOLS)) { |
|
1728 | 1728 | return -1; |
1729 | 1729 | } |
1730 | 1730 | $buf = array($size, $index, $parity); |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | */ |
1759 | 1759 | protected function checkModeNum($size, $data) { |
1760 | 1760 | for ($i=0; $i<$size; ++$i) { |
1761 | - if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))){ |
|
1761 | + if ((ord($data[$i]) < ord('0')) or (ord($data[$i]) > ord('9'))){ |
|
1762 | 1762 | return false; |
1763 | 1763 | } |
1764 | 1764 | } |
@@ -1857,7 +1857,7 @@ discard block |
||
1857 | 1857 | } |
1858 | 1858 | for ($i=0; $i<$size; $i+=2) { |
1859 | 1859 | $val = (ord($data[$i]) << 8) | ord($data[$i+1]); |
1860 | - if (($val < 0x8140) OR (($val > 0x9ffc) AND ($val < 0xe040)) OR ($val > 0xebbf)) { |
|
1860 | + if (($val < 0x8140) or (($val > 0x9ffc) and ($val < 0xe040)) or ($val > 0xebbf)) { |
|
1861 | 1861 | return false; |
1862 | 1862 | } |
1863 | 1863 | } |
@@ -2190,7 +2190,7 @@ discard block |
||
2190 | 2190 | * @return array bitstream |
2191 | 2191 | */ |
2192 | 2192 | protected function appendBitstream($bitstream, $append) { |
2193 | - if ((!is_array($append)) OR (count($append) == 0)) { |
|
2193 | + if ((!is_array($append)) or (count($append) == 0)) { |
|
2194 | 2194 | return $bitstream; |
2195 | 2195 | } |
2196 | 2196 | if (count($bitstream) == 0) { |
@@ -2483,7 +2483,7 @@ discard block |
||
2483 | 2483 | * @return BCH encoded version information pattern |
2484 | 2484 | */ |
2485 | 2485 | protected function getVersionPattern($version) { |
2486 | - if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) { |
|
2486 | + if (($version < 7) or ($version > QRSPEC_VERSION_MAX)) { |
|
2487 | 2487 | return 0; |
2488 | 2488 | } |
2489 | 2489 | return $this->versionPattern[($version - 7)]; |
@@ -2496,10 +2496,10 @@ discard block |
||
2496 | 2496 | * @return BCH encoded format information pattern |
2497 | 2497 | */ |
2498 | 2498 | protected function getFormatInfo($mask, $level) { |
2499 | - if (($mask < 0) OR ($mask > 7)) { |
|
2499 | + if (($mask < 0) or ($mask > 7)) { |
|
2500 | 2500 | return 0; |
2501 | 2501 | } |
2502 | - if (($level < 0) OR ($level > 3)) { |
|
2502 | + if (($level < 0) or ($level > 3)) { |
|
2503 | 2503 | return 0; |
2504 | 2504 | } |
2505 | 2505 | return $this->formatInfo[$level][$mask]; |
@@ -2600,14 +2600,14 @@ discard block |
||
2600 | 2600 | * @return Array of unsigned char. |
2601 | 2601 | */ |
2602 | 2602 | protected function newFrame($version) { |
2603 | - if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) { |
|
2604 | - return NULL; |
|
2603 | + if (($version < 1) or ($version > QRSPEC_VERSION_MAX)) { |
|
2604 | + return null; |
|
2605 | 2605 | } |
2606 | 2606 | if (!isset($this->frames[$version])) { |
2607 | 2607 | $this->frames[$version] = $this->createFrame($version); |
2608 | 2608 | } |
2609 | 2609 | if (is_null($this->frames[$version])) { |
2610 | - return NULL; |
|
2610 | + return null; |
|
2611 | 2611 | } |
2612 | 2612 | return $this->frames[$version]; |
2613 | 2613 | } |
@@ -2709,8 +2709,8 @@ discard block |
||
2709 | 2709 | */ |
2710 | 2710 | protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) { |
2711 | 2711 | foreach ($this->rsitems as $rs) { |
2712 | - if (($rs['pad'] != $pad) OR ($rs['nroots'] != $nroots) OR ($rs['mm'] != $symsize) |
|
2713 | - OR ($rs['gfpoly'] != $gfpoly) OR ($rs['fcr'] != $fcr) OR ($rs['prim'] != $prim)) { |
|
2712 | + if (($rs['pad'] != $pad) or ($rs['nroots'] != $nroots) or ($rs['mm'] != $symsize) |
|
2713 | + or ($rs['gfpoly'] != $gfpoly) or ($rs['fcr'] != $fcr) or ($rs['prim'] != $prim)) { |
|
2714 | 2714 | continue; |
2715 | 2715 | } |
2716 | 2716 | return $rs; |
@@ -2752,19 +2752,19 @@ discard block |
||
2752 | 2752 | // Based on Reed solomon encoder by Phil Karn, KA9Q (GNU-LGPLv2) |
2753 | 2753 | $rs = null; |
2754 | 2754 | // Check parameter ranges |
2755 | - if (($symsize < 0) OR ($symsize > 8)) { |
|
2755 | + if (($symsize < 0) or ($symsize > 8)) { |
|
2756 | 2756 | return $rs; |
2757 | 2757 | } |
2758 | - if (($fcr < 0) OR ($fcr >= (1<<$symsize))) { |
|
2758 | + if (($fcr < 0) or ($fcr >= (1<<$symsize))) { |
|
2759 | 2759 | return $rs; |
2760 | 2760 | } |
2761 | - if (($prim <= 0) OR ($prim >= (1<<$symsize))) { |
|
2761 | + if (($prim <= 0) or ($prim >= (1<<$symsize))) { |
|
2762 | 2762 | return $rs; |
2763 | 2763 | } |
2764 | - if (($nroots < 0) OR ($nroots >= (1<<$symsize))) { |
|
2764 | + if (($nroots < 0) or ($nroots >= (1<<$symsize))) { |
|
2765 | 2765 | return $rs; |
2766 | 2766 | } |
2767 | - if (($pad < 0) OR ($pad >= ((1<<$symsize) -1 - $nroots))) { |
|
2767 | + if (($pad < 0) or ($pad >= ((1<<$symsize) -1 - $nroots))) { |
|
2768 | 2768 | return $rs; |
2769 | 2769 | } |
2770 | 2770 | $rs = array(); |
@@ -2791,7 +2791,7 @@ discard block |
||
2791 | 2791 | } |
2792 | 2792 | if ($sr != 1) { |
2793 | 2793 | // field generator polynomial is not primitive! |
2794 | - return NULL; |
|
2794 | + return null; |
|
2795 | 2795 | } |
2796 | 2796 | // Form RS code generator polynomial from its roots |
2797 | 2797 | $rs['genpoly'] = array_fill(0, ($nroots + 1), 0); |