@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | session_start(); |
3 | 3 | include 'config/koneksi.php'; |
4 | 4 | |
5 | - if ($_SESSION['role'] == 'SA') { |
|
5 | + if ($_SESSION['role']=='SA') { |
|
6 | 6 | $sql = mysql_query("select * from modul where aktif='Y' and status_menu = 'M' order by urutan"); |
7 | 7 | |
8 | 8 | $gjml = '1'; |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | while ($r = mysql_fetch_array($sql)) { |
26 | - if ($r[status_menu] == 'M' and !empty($r[link])) { |
|
26 | + if ($r[status_menu]=='M' and !empty($r[link])) { |
|
27 | 27 | echo "<li><a href='$r[link]&id_module=$r[id_modul]'><i class='$r[icon]'></i> $r[nama_modul]</a>"; |
28 | - } elseif ($r[status_menu] == 'M' and empty($r[link])) { |
|
28 | + } elseif ($r[status_menu]=='M' and empty($r[link])) { |
|
29 | 29 | echo "<li><a href='#'><i class='$r[icon]'></i> $r[nama_modul] <span class='fa fa-chevron-down'></span></a>"; |
30 | 30 | } |
31 | 31 | |
32 | 32 | echo'<ul class="nav child_menu" style="display: none">'; |
33 | 33 | |
34 | - if ($_SESSION['role'] == 'SA') { |
|
34 | + if ($_SESSION['role']=='SA') { |
|
35 | 35 | $detil = mysql_query("select * from modul where aktif='Y' and status_menu = 'C' and parentid = '$r[id_modul]' order by urutan"); |
36 | 36 | } else { |
37 | 37 | $detil = mysql_query("select distinct c.* |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | order by c.urutan"); |
46 | 46 | } |
47 | 47 | while ($d = mysql_fetch_array($detil)) { |
48 | - if ($d[is_form] == 'Y') { |
|
48 | + if ($d[is_form]=='Y') { |
|
49 | 49 | echo"<li><a href='modul/mod_$d[link]/form_$d[link].php?width=$d[f_width]&height=$d[f_height]&module=$d[link]&imodule=$imodule&id_module=$id&imenu=$imenu&isub=$isub&TB_iframe=true' title='$d[nama_modul]' class='thickbox' ><i class='$d[fa_icon]'></i>  $d[nama_modul]</a></li>"; |
50 | 50 | } else { |
51 | 51 | echo"<li><a href='$d[link]&id_module=$d[id_modul]'><i class='$d[fa_icon]'></i>  $d[nama_modul]</a></li>"; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | // echo"modul/mod_$mod.php<br>"; |
14 | 14 | // |
15 | 15 | |
16 | - if ($_GET['module'] == $mod) { |
|
16 | + if ($_GET['module']==$mod) { |
|
17 | 17 | //include "modul/mod_$mod.php"; |
18 | 18 | include "modul/mod_$mod/$mod.php"; |
19 | 19 | } |
@@ -1460,7 +1460,7 @@ |
||
1460 | 1460 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1461 | 1461 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
1462 | 1462 | 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, |
1463 | - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, |
|
1463 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, |
|
1464 | 1464 | -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
1465 | 1465 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, |
1466 | 1466 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | public static function set(&$srctab, $x, $y, $repl, $replLen = false) |
94 | 94 | { |
95 | - $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false) ? substr($repl, 0, $replLen) : $repl, $x, ($replLen !== false) ? $replLen : strlen($repl)); |
|
95 | + $srctab[$y] = substr_replace($srctab[$y], ($replLen!==false) ? substr($repl, 0, $replLen) : $repl, $x, ($replLen!==false) ? $replLen : strlen($repl)); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | $len = count($frame); |
148 | 148 | foreach ($frame as &$frameLine) { |
149 | - for ($i = 0; $i < $len; $i++) { |
|
149 | + for ($i = 0; $i<$len; $i++) { |
|
150 | 150 | $frameLine[$i] = (ord($frameLine[$i]) & 1) ? '1' : '0'; |
151 | 151 | } |
152 | 152 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | $eccLevel = 'L'; |
167 | 167 | |
168 | - if (count($mode) > 1) { |
|
168 | + if (count($mode)>1) { |
|
169 | 169 | $eccLevel = $mode[1]; |
170 | 170 | } |
171 | 171 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | foreach ($qrTab as $line) { |
180 | 180 | $arrAdd = []; |
181 | 181 | foreach (str_split($line) as $char) { |
182 | - $arrAdd[] = ($char == '1') ? 1 : 0; |
|
182 | + $arrAdd[] = ($char=='1') ? 1 : 0; |
|
183 | 183 | } |
184 | 184 | $barcode_array['bcode'][] = $arrAdd; |
185 | 185 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | self::markTime('before_build_cache'); |
200 | 200 | |
201 | 201 | $mask = new QRmask(); |
202 | - for ($a = 1; $a <= QRSPEC_VERSION_MAX; $a++) { |
|
202 | + for ($a = 1; $a<=QRSPEC_VERSION_MAX; $a++) { |
|
203 | 203 | $frame = QRspec::newFrame($a); |
204 | 204 | if (QR_IMAGE) { |
205 | 205 | $fileName = QR_CACHE_DIR.'frame_'.$a.'.png'; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $width = count($frame); |
210 | 210 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
211 | - for ($maskNo = 0; $maskNo < 8; $maskNo++) { |
|
211 | + for ($maskNo = 0; $maskNo<8; $maskNo++) { |
|
212 | 212 | $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); |
213 | 213 | } |
214 | 214 | } |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | //---------------------------------------------------------------------- |
220 | 220 | public static function log($outfile, $err) |
221 | 221 | { |
222 | - if (QR_LOG_DIR !== false) { |
|
223 | - if ($err != '') { |
|
224 | - if ($outfile !== false) { |
|
222 | + if (QR_LOG_DIR!==false) { |
|
223 | + if ($err!='') { |
|
224 | + if ($outfile!==false) { |
|
225 | 225 | file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND); |
226 | 226 | } else { |
227 | 227 | file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | public static function dumpMask($frame) |
235 | 235 | { |
236 | 236 | $width = count($frame); |
237 | - for ($y = 0; $y < $width; $y++) { |
|
238 | - for ($x = 0; $x < $width; $x++) { |
|
237 | + for ($y = 0; $y<$width; $y++) { |
|
238 | + for ($x = 0; $x<$width; $x++) { |
|
239 | 239 | echo ord($frame[$y][$x]).','; |
240 | 240 | } |
241 | 241 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | public static function markTime($markerId) |
246 | 246 | { |
247 | 247 | list($usec, $sec) = explode(' ', microtime()); |
248 | - $time = ((float) $usec + (float) $sec); |
|
248 | + $time = ((float)$usec + (float)$sec); |
|
249 | 249 | |
250 | 250 | if (!isset($GLOBALS['qr_time_bench'])) { |
251 | 251 | $GLOBALS['qr_time_bench'] = []; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | <tbody>'; |
269 | 269 | |
270 | 270 | foreach ($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) { |
271 | - if ($p > 0) { |
|
271 | + if ($p>0) { |
|
272 | 272 | echo '<tr><th style="text-align:right">till '.$markerId.': </th><td>'.number_format($thisTime - $lastTime, 6).'s</td></tr>'; |
273 | 273 | } else { |
274 | 274 | $startTime = $thisTime; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | //---------------------------------------------------------------------- |
418 | 418 | public static function getMinimumVersion($size, $level) |
419 | 419 | { |
420 | - for ($i = 1; $i <= QRSPEC_VERSION_MAX; $i++) { |
|
420 | + for ($i = 1; $i<=QRSPEC_VERSION_MAX; $i++) { |
|
421 | 421 | $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level]; |
422 | - if ($words >= $size) { |
|
422 | + if ($words>=$size) { |
|
423 | 423 | return $i; |
424 | 424 | } |
425 | 425 | } |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | //---------------------------------------------------------------------- |
440 | 440 | public static function lengthIndicator($mode, $version) |
441 | 441 | { |
442 | - if ($mode == QR_MODE_STRUCTURE) { |
|
442 | + if ($mode==QR_MODE_STRUCTURE) { |
|
443 | 443 | return 0; |
444 | 444 | } |
445 | 445 | |
446 | - if ($version <= 9) { |
|
446 | + if ($version<=9) { |
|
447 | 447 | $l = 0; |
448 | - } elseif ($version <= 26) { |
|
448 | + } elseif ($version<=26) { |
|
449 | 449 | $l = 1; |
450 | 450 | } else { |
451 | 451 | $l = 2; |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | //---------------------------------------------------------------------- |
458 | 458 | public static function maximumWords($mode, $version) |
459 | 459 | { |
460 | - if ($mode == QR_MODE_STRUCTURE) { |
|
460 | + if ($mode==QR_MODE_STRUCTURE) { |
|
461 | 461 | return 3; |
462 | 462 | } |
463 | 463 | |
464 | - if ($version <= 9) { |
|
464 | + if ($version<=9) { |
|
465 | 465 | $l = 0; |
466 | - } elseif ($version <= 26) { |
|
466 | + } elseif ($version<=26) { |
|
467 | 467 | $l = 1; |
468 | 468 | } else { |
469 | 469 | $l = 2; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $bits = self::$lengthTableBits[$mode][$l]; |
473 | 473 | $words = (1 << $bits) - 1; |
474 | 474 | |
475 | - if ($mode == QR_MODE_KANJI) { |
|
475 | + if ($mode==QR_MODE_KANJI) { |
|
476 | 476 | $words *= 2; // the number of bytes is required |
477 | 477 | } |
478 | 478 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | public static function getEccSpec($version, $level, array &$spec) |
534 | 534 | { |
535 | - if (count($spec) < 5) { |
|
535 | + if (count($spec)<5) { |
|
536 | 536 | $spec = [0, 0, 0, 0, 0]; |
537 | 537 | } |
538 | 538 | |
@@ -541,16 +541,16 @@ discard block |
||
541 | 541 | $data = self::getDataLength($version, $level); |
542 | 542 | $ecc = self::getECCLength($version, $level); |
543 | 543 | |
544 | - if ($b2 == 0) { |
|
544 | + if ($b2==0) { |
|
545 | 545 | $spec[0] = $b1; |
546 | - $spec[1] = (int) ($data / $b1); |
|
547 | - $spec[2] = (int) ($ecc / $b1); |
|
546 | + $spec[1] = (int)($data / $b1); |
|
547 | + $spec[2] = (int)($ecc / $b1); |
|
548 | 548 | $spec[3] = 0; |
549 | 549 | $spec[4] = 0; |
550 | 550 | } else { |
551 | 551 | $spec[0] = $b1; |
552 | - $spec[1] = (int) ($data / ($b1 + $b2)); |
|
553 | - $spec[2] = (int) ($ecc / ($b1 + $b2)); |
|
552 | + $spec[1] = (int)($data / ($b1 + $b2)); |
|
553 | + $spec[2] = (int)($ecc / ($b1 + $b2)); |
|
554 | 554 | $spec[3] = $b2; |
555 | 555 | $spec[4] = $spec[1] + 1; |
556 | 556 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $yStart = $oy - 2; |
598 | 598 | $xStart = $ox - 2; |
599 | 599 | |
600 | - for ($y = 0; $y < 5; $y++) { |
|
600 | + for ($y = 0; $y<5; $y++) { |
|
601 | 601 | QRstr::set($frame, $xStart, $yStart + $y, $finder[$y]); |
602 | 602 | } |
603 | 603 | } |
@@ -605,18 +605,18 @@ discard block |
||
605 | 605 | //---------------------------------------------------------------------- |
606 | 606 | public static function putAlignmentPattern($version, &$frame, $width) |
607 | 607 | { |
608 | - if ($version < 2) { |
|
608 | + if ($version<2) { |
|
609 | 609 | return; |
610 | 610 | } |
611 | 611 | |
612 | 612 | $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0]; |
613 | - if ($d < 0) { |
|
613 | + if ($d<0) { |
|
614 | 614 | $w = 2; |
615 | 615 | } else { |
616 | - $w = (int) (($width - self::$alignmentPattern[$version][0]) / $d + 2); |
|
616 | + $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2); |
|
617 | 617 | } |
618 | 618 | |
619 | - if ($w * $w - 3 == 1) { |
|
619 | + if ($w * $w - 3==1) { |
|
620 | 620 | $x = self::$alignmentPattern[$version][0]; |
621 | 621 | $y = self::$alignmentPattern[$version][0]; |
622 | 622 | self::putAlignmentMarker($frame, $x, $y); |
@@ -625,16 +625,16 @@ discard block |
||
625 | 625 | } |
626 | 626 | |
627 | 627 | $cx = self::$alignmentPattern[$version][0]; |
628 | - for ($x = 1; $x < $w - 1; $x++) { |
|
628 | + for ($x = 1; $x<$w - 1; $x++) { |
|
629 | 629 | self::putAlignmentMarker($frame, 6, $cx); |
630 | 630 | self::putAlignmentMarker($frame, $cx, 6); |
631 | 631 | $cx += $d; |
632 | 632 | } |
633 | 633 | |
634 | 634 | $cy = self::$alignmentPattern[$version][0]; |
635 | - for ($y = 0; $y < $w - 1; $y++) { |
|
635 | + for ($y = 0; $y<$w - 1; $y++) { |
|
636 | 636 | $cx = self::$alignmentPattern[$version][0]; |
637 | - for ($x = 0; $x < $w - 1; $x++) { |
|
637 | + for ($x = 0; $x<$w - 1; $x++) { |
|
638 | 638 | self::putAlignmentMarker($frame, $cx, $cy); |
639 | 639 | $cx += $d; |
640 | 640 | } |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | //---------------------------------------------------------------------- |
661 | 661 | public static function getVersionPattern($version) |
662 | 662 | { |
663 | - if ($version < 7 || $version > QRSPEC_VERSION_MAX) { |
|
663 | + if ($version<7 || $version>QRSPEC_VERSION_MAX) { |
|
664 | 664 | return 0; |
665 | 665 | } |
666 | 666 | |
@@ -679,11 +679,11 @@ discard block |
||
679 | 679 | |
680 | 680 | public static function getFormatInfo($mask, $level) |
681 | 681 | { |
682 | - if ($mask < 0 || $mask > 7) { |
|
682 | + if ($mask<0 || $mask>7) { |
|
683 | 683 | return 0; |
684 | 684 | } |
685 | 685 | |
686 | - if ($level < 0 || $level > 3) { |
|
686 | + if ($level<0 || $level>3) { |
|
687 | 687 | return 0; |
688 | 688 | } |
689 | 689 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | "\xc1\xc1\xc1\xc1\xc1\xc1\xc1", |
715 | 715 | ]; |
716 | 716 | |
717 | - for ($y = 0; $y < 7; $y++) { |
|
717 | + for ($y = 0; $y<7; $y++) { |
|
718 | 718 | QRstr::set($frame, $ox, $oy + $y, $finder[$y]); |
719 | 719 | } |
720 | 720 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | // Separator |
735 | 735 | $yOffset = $width - 7; |
736 | 736 | |
737 | - for ($y = 0; $y < 7; $y++) { |
|
737 | + for ($y = 0; $y<7; $y++) { |
|
738 | 738 | $frame[$y][7] = "\xc0"; |
739 | 739 | $frame[$y][$width - 8] = "\xc0"; |
740 | 740 | $frame[$yOffset][7] = "\xc0"; |
@@ -754,14 +754,14 @@ discard block |
||
754 | 754 | |
755 | 755 | $yOffset = $width - 8; |
756 | 756 | |
757 | - for ($y = 0; $y < 8; $y++, $yOffset++) { |
|
757 | + for ($y = 0; $y<8; $y++, $yOffset++) { |
|
758 | 758 | $frame[$y][8] = "\x84"; |
759 | 759 | $frame[$yOffset][8] = "\x84"; |
760 | 760 | } |
761 | 761 | |
762 | 762 | // Timing pattern |
763 | 763 | |
764 | - for ($i = 1; $i < $width - 15; $i++) { |
|
764 | + for ($i = 1; $i<$width - 15; $i++) { |
|
765 | 765 | $frame[6][7 + $i] = chr(0x90 | ($i & 1)); |
766 | 766 | $frame[7 + $i][6] = chr(0x90 | ($i & 1)); |
767 | 767 | } |
@@ -770,21 +770,21 @@ discard block |
||
770 | 770 | self::putAlignmentPattern($version, $frame, $width); |
771 | 771 | |
772 | 772 | // Version information |
773 | - if ($version >= 7) { |
|
773 | + if ($version>=7) { |
|
774 | 774 | $vinf = self::getVersionPattern($version); |
775 | 775 | |
776 | 776 | $v = $vinf; |
777 | 777 | |
778 | - for ($x = 0; $x < 6; $x++) { |
|
779 | - for ($y = 0; $y < 3; $y++) { |
|
778 | + for ($x = 0; $x<6; $x++) { |
|
779 | + for ($y = 0; $y<3; $y++) { |
|
780 | 780 | $frame[($width - 11) + $y][$x] = chr(0x88 | ($v & 1)); |
781 | 781 | $v = $v >> 1; |
782 | 782 | } |
783 | 783 | } |
784 | 784 | |
785 | 785 | $v = $vinf; |
786 | - for ($y = 0; $y < 6; $y++) { |
|
787 | - for ($x = 0; $x < 3; $x++) { |
|
786 | + for ($y = 0; $y<6; $y++) { |
|
787 | + for ($x = 0; $x<3; $x++) { |
|
788 | 788 | $frame[$y][$x + ($width - 11)] = chr(0x88 | ($v & 1)); |
789 | 789 | $v = $v >> 1; |
790 | 790 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | //---------------------------------------------------------------------- |
859 | 859 | public static function newFrame($version) |
860 | 860 | { |
861 | - if ($version < 1 || $version > QRSPEC_VERSION_MAX) { |
|
861 | + if ($version<1 || $version>QRSPEC_VERSION_MAX) { |
|
862 | 862 | return; |
863 | 863 | } |
864 | 864 | |
@@ -965,11 +965,11 @@ discard block |
||
965 | 965 | { |
966 | 966 | $image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color); |
967 | 967 | |
968 | - if ($filename === false) { |
|
968 | + if ($filename===false) { |
|
969 | 969 | header('Content-type: image/png'); |
970 | 970 | imagepng($image); |
971 | 971 | } else { |
972 | - if ($saveandprint === true) { |
|
972 | + if ($saveandprint===true) { |
|
973 | 973 | imagepng($image, $filename); |
974 | 974 | header('Content-type: image/png'); |
975 | 975 | imagepng($image); |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | { |
987 | 987 | $image = self::image($frame, $pixelPerPoint, $outerFrame); |
988 | 988 | |
989 | - if ($filename === false) { |
|
989 | + if ($filename===false) { |
|
990 | 990 | header('Content-type: image/jpeg'); |
991 | 991 | imagejpeg($image, null, $q); |
992 | 992 | } else { |
@@ -1022,9 +1022,9 @@ discard block |
||
1022 | 1022 | |
1023 | 1023 | imagefill($base_image, 0, 0, $col[0]); |
1024 | 1024 | |
1025 | - for ($y = 0; $y < $h; $y++) { |
|
1026 | - for ($x = 0; $x < $w; $x++) { |
|
1027 | - if ($frame[$y][$x] == '1') { |
|
1025 | + for ($y = 0; $y<$h; $y++) { |
|
1026 | + for ($x = 0; $x<$w; $x++) { |
|
1027 | + if ($frame[$y][$x]=='1') { |
|
1028 | 1028 | imagesetpixel($base_image, $x + $outerFrame, $y + $outerFrame, $col[1]); |
1029 | 1029 | } |
1030 | 1030 | } |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | { |
1081 | 1081 | $setData = array_slice($data, 0, $size); |
1082 | 1082 | |
1083 | - if (count($setData) < $size) { |
|
1083 | + if (count($setData)<$size) { |
|
1084 | 1084 | $setData = array_merge($setData, array_fill(0, $size - count($setData), 0)); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1099,24 +1099,24 @@ discard block |
||
1099 | 1099 | public function encodeModeNum($version) |
1100 | 1100 | { |
1101 | 1101 | try { |
1102 | - $words = (int) ($this->size / 3); |
|
1102 | + $words = (int)($this->size / 3); |
|
1103 | 1103 | $bs = new QRbitstream(); |
1104 | 1104 | |
1105 | 1105 | $val = 0x1; |
1106 | 1106 | $bs->appendNum(4, $val); |
1107 | 1107 | $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size); |
1108 | 1108 | |
1109 | - for ($i = 0; $i < $words; $i++) { |
|
1109 | + for ($i = 0; $i<$words; $i++) { |
|
1110 | 1110 | $val = (ord($this->data[$i * 3]) - ord('0')) * 100; |
1111 | 1111 | $val += (ord($this->data[$i * 3 + 1]) - ord('0')) * 10; |
1112 | 1112 | $val += (ord($this->data[$i * 3 + 2]) - ord('0')); |
1113 | 1113 | $bs->appendNum(10, $val); |
1114 | 1114 | } |
1115 | 1115 | |
1116 | - if ($this->size - $words * 3 == 1) { |
|
1116 | + if ($this->size - $words * 3==1) { |
|
1117 | 1117 | $val = ord($this->data[$words * 3]) - ord('0'); |
1118 | 1118 | $bs->appendNum(4, $val); |
1119 | - } elseif ($this->size - $words * 3 == 2) { |
|
1119 | + } elseif ($this->size - $words * 3==2) { |
|
1120 | 1120 | $val = (ord($this->data[$words * 3]) - ord('0')) * 10; |
1121 | 1121 | $val += (ord($this->data[$words * 3 + 1]) - ord('0')); |
1122 | 1122 | $bs->appendNum(7, $val); |
@@ -1134,15 +1134,15 @@ discard block |
||
1134 | 1134 | public function encodeModeAn($version) |
1135 | 1135 | { |
1136 | 1136 | try { |
1137 | - $words = (int) ($this->size / 2); |
|
1137 | + $words = (int)($this->size / 2); |
|
1138 | 1138 | $bs = new QRbitstream(); |
1139 | 1139 | |
1140 | 1140 | $bs->appendNum(4, 0x02); |
1141 | 1141 | $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size); |
1142 | 1142 | |
1143 | - for ($i = 0; $i < $words; $i++) { |
|
1144 | - $val = (int) QRinput::lookAnTable(ord($this->data[$i * 2])) * 45; |
|
1145 | - $val += (int) QRinput::lookAnTable(ord($this->data[$i * 2 + 1])); |
|
1143 | + for ($i = 0; $i<$words; $i++) { |
|
1144 | + $val = (int)QRinput::lookAnTable(ord($this->data[$i * 2])) * 45; |
|
1145 | + $val += (int)QRinput::lookAnTable(ord($this->data[$i * 2 + 1])); |
|
1146 | 1146 | |
1147 | 1147 | $bs->appendNum(11, $val); |
1148 | 1148 | } |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | $bs->appendNum(4, 0x4); |
1170 | 1170 | $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size); |
1171 | 1171 | |
1172 | - for ($i = 0; $i < $this->size; $i++) { |
|
1172 | + for ($i = 0; $i<$this->size; $i++) { |
|
1173 | 1173 | $bs->appendNum(8, ord($this->data[$i])); |
1174 | 1174 | } |
1175 | 1175 | |
@@ -1188,11 +1188,11 @@ discard block |
||
1188 | 1188 | $bs = new QRbitrtream(); |
1189 | 1189 | |
1190 | 1190 | $bs->appendNum(4, 0x8); |
1191 | - $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int) ($this->size / 2)); |
|
1191 | + $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2)); |
|
1192 | 1192 | |
1193 | - for ($i = 0; $i < $this->size; $i += 2) { |
|
1193 | + for ($i = 0; $i<$this->size; $i += 2) { |
|
1194 | 1194 | $val = (ord($this->data[$i]) << 8) | ord($this->data[$i + 1]); |
1195 | - if ($val <= 0x9ffc) { |
|
1195 | + if ($val<=0x9ffc) { |
|
1196 | 1196 | $val -= 0x8140; |
1197 | 1197 | } else { |
1198 | 1198 | $val -= 0xc140; |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | { |
1237 | 1237 | $bits = 0; |
1238 | 1238 | |
1239 | - if ($version == 0) { |
|
1239 | + if ($version==0) { |
|
1240 | 1240 | $version = 1; |
1241 | 1241 | } |
1242 | 1242 | |
@@ -1252,7 +1252,7 @@ discard block |
||
1252 | 1252 | |
1253 | 1253 | $l = QRspec::lengthIndicator($this->mode, $version); |
1254 | 1254 | $m = 1 << $l; |
1255 | - $num = (int) (($this->size + $m - 1) / $m); |
|
1255 | + $num = (int)(($this->size + $m - 1) / $m); |
|
1256 | 1256 | |
1257 | 1257 | $bits += $num * (4 + $l); |
1258 | 1258 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | unset($this->bstream); |
1267 | 1267 | $words = QRspec::maximumWords($this->mode, $version); |
1268 | 1268 | |
1269 | - if ($this->size > $words) { |
|
1269 | + if ($this->size>$words) { |
|
1270 | 1270 | $st1 = new self($this->mode, $words, $this->data); |
1271 | 1271 | $st2 = new self($this->mode, $this->size - $words, array_slice($this->data, $words)); |
1272 | 1272 | |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | break; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | - if ($ret < 0) { |
|
1296 | + if ($ret<0) { |
|
1297 | 1297 | return -1; |
1298 | 1298 | } |
1299 | 1299 | } |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | //---------------------------------------------------------------------- |
1318 | 1318 | public function __construct($version = 0, $level = QR_ECLEVEL_L) |
1319 | 1319 | { |
1320 | - if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) { |
|
1320 | + if ($version<0 || $version>QRSPEC_VERSION_MAX || $level>QR_ECLEVEL_H) { |
|
1321 | 1321 | throw new Exception('Invalid version no'); |
1322 | 1322 | return; |
1323 | 1323 | } |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | //---------------------------------------------------------------------- |
1336 | 1336 | public function setVersion($version) |
1337 | 1337 | { |
1338 | - if ($version < 0 || $version > QRSPEC_VERSION_MAX) { |
|
1338 | + if ($version<0 || $version>QRSPEC_VERSION_MAX) { |
|
1339 | 1339 | throw new Exception('Invalid version no'); |
1340 | 1340 | return -1; |
1341 | 1341 | } |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | //---------------------------------------------------------------------- |
1355 | 1355 | public function setErrorCorrectionLevel($level) |
1356 | 1356 | { |
1357 | - if ($level > QR_ECLEVEL_H) { |
|
1357 | + if ($level>QR_ECLEVEL_H) { |
|
1358 | 1358 | throw new Exception('Invalid ECLEVEL'); |
1359 | 1359 | return -1; |
1360 | 1360 | } |
@@ -1387,11 +1387,11 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | public function insertStructuredAppendHeader($size, $index, $parity) |
1389 | 1389 | { |
1390 | - if ($size > MAX_STRUCTURED_SYMBOLS) { |
|
1390 | + if ($size>MAX_STRUCTURED_SYMBOLS) { |
|
1391 | 1391 | throw new Exception('insertStructuredAppendHeader wrong size'); |
1392 | 1392 | } |
1393 | 1393 | |
1394 | - if ($index <= 0 || $index > MAX_STRUCTURED_SYMBOLS) { |
|
1394 | + if ($index<=0 || $index>MAX_STRUCTURED_SYMBOLS) { |
|
1395 | 1395 | throw new Exception('insertStructuredAppendHeader wrong index'); |
1396 | 1396 | } |
1397 | 1397 | |
@@ -1413,8 +1413,8 @@ discard block |
||
1413 | 1413 | $parity = 0; |
1414 | 1414 | |
1415 | 1415 | foreach ($this->items as $item) { |
1416 | - if ($item->mode != QR_MODE_STRUCTURE) { |
|
1417 | - for ($i = $item->size - 1; $i >= 0; $i--) { |
|
1416 | + if ($item->mode!=QR_MODE_STRUCTURE) { |
|
1417 | + for ($i = $item->size - 1; $i>=0; $i--) { |
|
1418 | 1418 | $parity ^= $item->data[$i]; |
1419 | 1419 | } |
1420 | 1420 | } |
@@ -1426,8 +1426,8 @@ discard block |
||
1426 | 1426 | //---------------------------------------------------------------------- |
1427 | 1427 | public static function checkModeNum($size, $data) |
1428 | 1428 | { |
1429 | - for ($i = 0; $i < $size; $i++) { |
|
1430 | - if ((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))) { |
|
1429 | + for ($i = 0; $i<$size; $i++) { |
|
1430 | + if ((ord($data[$i])<ord('0')) || (ord($data[$i])>ord('9'))) { |
|
1431 | 1431 | return false; |
1432 | 1432 | } |
1433 | 1433 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | //---------------------------------------------------------------------- |
1439 | 1439 | public static function estimateBitsModeNum($size) |
1440 | 1440 | { |
1441 | - $w = (int) $size / 3; |
|
1441 | + $w = (int)$size / 3; |
|
1442 | 1442 | $bits = $w * 10; |
1443 | 1443 | |
1444 | 1444 | switch ($size - $w * 3) { |
@@ -1470,14 +1470,14 @@ discard block |
||
1470 | 1470 | //---------------------------------------------------------------------- |
1471 | 1471 | public static function lookAnTable($c) |
1472 | 1472 | { |
1473 | - return ($c > 127) ? -1 : self::$anTable[$c]; |
|
1473 | + return ($c>127) ? -1 : self::$anTable[$c]; |
|
1474 | 1474 | } |
1475 | 1475 | |
1476 | 1476 | //---------------------------------------------------------------------- |
1477 | 1477 | public static function checkModeAn($size, $data) |
1478 | 1478 | { |
1479 | - for ($i = 0; $i < $size; $i++) { |
|
1480 | - if (self::lookAnTable(ord($data[$i])) == -1) { |
|
1479 | + for ($i = 0; $i<$size; $i++) { |
|
1480 | + if (self::lookAnTable(ord($data[$i]))==-1) { |
|
1481 | 1481 | return false; |
1482 | 1482 | } |
1483 | 1483 | } |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | //---------------------------------------------------------------------- |
1489 | 1489 | public static function estimateBitsModeAn($size) |
1490 | 1490 | { |
1491 | - $w = (int) ($size / 2); |
|
1491 | + $w = (int)($size / 2); |
|
1492 | 1492 | $bits = $w * 11; |
1493 | 1493 | |
1494 | 1494 | if ($size & 1) { |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | //---------------------------------------------------------------------- |
1508 | 1508 | public function estimateBitsModeKanji($size) |
1509 | 1509 | { |
1510 | - return (int) (($size / 2) * 13); |
|
1510 | + return (int)(($size / 2) * 13); |
|
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | //---------------------------------------------------------------------- |
@@ -1517,11 +1517,11 @@ discard block |
||
1517 | 1517 | return false; |
1518 | 1518 | } |
1519 | 1519 | |
1520 | - for ($i = 0; $i < $size; $i += 2) { |
|
1520 | + for ($i = 0; $i<$size; $i += 2) { |
|
1521 | 1521 | $val = (ord($data[$i]) << 8) | ord($data[$i + 1]); |
1522 | - if ($val < 0x8140 |
|
1523 | - || ($val > 0x9ffc && $val < 0xe040) |
|
1524 | - || $val > 0xebbf) { |
|
1522 | + if ($val<0x8140 |
|
1523 | + || ($val>0x9ffc && $val<0xe040) |
|
1524 | + || $val>0xebbf) { |
|
1525 | 1525 | return false; |
1526 | 1526 | } |
1527 | 1527 | } |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | |
1536 | 1536 | public static function check($mode, $size, $data) |
1537 | 1537 | { |
1538 | - if ($size <= 0) { |
|
1538 | + if ($size<=0) { |
|
1539 | 1539 | return false; |
1540 | 1540 | } |
1541 | 1541 | |
@@ -1573,11 +1573,11 @@ discard block |
||
1573 | 1573 | do { |
1574 | 1574 | $prev = $version; |
1575 | 1575 | $bits = $this->estimateBitStreamSize($prev); |
1576 | - $version = QRspec::getMinimumVersion((int) (($bits + 7) / 8), $this->level); |
|
1577 | - if ($version < 0) { |
|
1576 | + $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level); |
|
1577 | + if ($version<0) { |
|
1578 | 1578 | return -1; |
1579 | 1579 | } |
1580 | - } while ($version > $prev); |
|
1580 | + } while ($version>$prev); |
|
1581 | 1581 | |
1582 | 1582 | return $version; |
1583 | 1583 | } |
@@ -1588,31 +1588,31 @@ discard block |
||
1588 | 1588 | $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version); |
1589 | 1589 | switch ($mode) { |
1590 | 1590 | case QR_MODE_NUM: |
1591 | - $chunks = (int) ($payload / 10); |
|
1591 | + $chunks = (int)($payload / 10); |
|
1592 | 1592 | $remain = $payload - $chunks * 10; |
1593 | 1593 | $size = $chunks * 3; |
1594 | - if ($remain >= 7) { |
|
1594 | + if ($remain>=7) { |
|
1595 | 1595 | $size += 2; |
1596 | - } elseif ($remain >= 4) { |
|
1596 | + } elseif ($remain>=4) { |
|
1597 | 1597 | $size += 1; |
1598 | 1598 | } |
1599 | 1599 | break; |
1600 | 1600 | case QR_MODE_AN: |
1601 | - $chunks = (int) ($payload / 11); |
|
1601 | + $chunks = (int)($payload / 11); |
|
1602 | 1602 | $remain = $payload - $chunks * 11; |
1603 | 1603 | $size = $chunks * 2; |
1604 | - if ($remain >= 6) { |
|
1604 | + if ($remain>=6) { |
|
1605 | 1605 | $size++; |
1606 | 1606 | } |
1607 | 1607 | break; |
1608 | 1608 | case QR_MODE_8: |
1609 | - $size = (int) ($payload / 8); |
|
1609 | + $size = (int)($payload / 8); |
|
1610 | 1610 | break; |
1611 | 1611 | case QR_MODE_KANJI: |
1612 | - $size = (int) (($payload / 13) * 2); |
|
1612 | + $size = (int)(($payload / 13) * 2); |
|
1613 | 1613 | break; |
1614 | 1614 | case QR_MODE_STRUCTURE: |
1615 | - $size = (int) ($payload / 8); |
|
1615 | + $size = (int)($payload / 8); |
|
1616 | 1616 | break; |
1617 | 1617 | default: |
1618 | 1618 | $size = 0; |
@@ -1620,10 +1620,10 @@ discard block |
||
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | $maxsize = QRspec::maximumWords($mode, $version); |
1623 | - if ($size < 0) { |
|
1623 | + if ($size<0) { |
|
1624 | 1624 | $size = 0; |
1625 | 1625 | } |
1626 | - if ($size > $maxsize) { |
|
1626 | + if ($size>$maxsize) { |
|
1627 | 1627 | $size = $maxsize; |
1628 | 1628 | } |
1629 | 1629 | |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | foreach ($this->items as $item) { |
1639 | 1639 | $bits = $item->encodeBitStream($this->version); |
1640 | 1640 | |
1641 | - if ($bits < 0) { |
|
1641 | + if ($bits<0) { |
|
1642 | 1642 | return -1; |
1643 | 1643 | } |
1644 | 1644 | |
@@ -1652,22 +1652,22 @@ discard block |
||
1652 | 1652 | public function convertData() |
1653 | 1653 | { |
1654 | 1654 | $ver = $this->estimateVersion(); |
1655 | - if ($ver > $this->getVersion()) { |
|
1655 | + if ($ver>$this->getVersion()) { |
|
1656 | 1656 | $this->setVersion($ver); |
1657 | 1657 | } |
1658 | 1658 | |
1659 | - for (; ;) { |
|
1659 | + for (;;) { |
|
1660 | 1660 | $bits = $this->createBitStream(); |
1661 | 1661 | |
1662 | - if ($bits < 0) { |
|
1662 | + if ($bits<0) { |
|
1663 | 1663 | return -1; |
1664 | 1664 | } |
1665 | 1665 | |
1666 | - $ver = QRspec::getMinimumVersion((int) (($bits + 7) / 8), $this->level); |
|
1667 | - if ($ver < 0) { |
|
1666 | + $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level); |
|
1667 | + if ($ver<0) { |
|
1668 | 1668 | throw new Exception('WRONG VERSION'); |
1669 | 1669 | return -1; |
1670 | - } elseif ($ver > $this->getVersion()) { |
|
1670 | + } elseif ($ver>$this->getVersion()) { |
|
1671 | 1671 | $this->setVersion($ver); |
1672 | 1672 | } else { |
1673 | 1673 | break; |
@@ -1684,35 +1684,35 @@ discard block |
||
1684 | 1684 | $maxwords = QRspec::getDataLength($this->version, $this->level); |
1685 | 1685 | $maxbits = $maxwords * 8; |
1686 | 1686 | |
1687 | - if ($maxbits == $bits) { |
|
1687 | + if ($maxbits==$bits) { |
|
1688 | 1688 | return 0; |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - if ($maxbits - $bits < 5) { |
|
1691 | + if ($maxbits - $bits<5) { |
|
1692 | 1692 | return $bstream->appendNum($maxbits - $bits, 0); |
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | $bits += 4; |
1696 | - $words = (int) (($bits + 7) / 8); |
|
1696 | + $words = (int)(($bits + 7) / 8); |
|
1697 | 1697 | |
1698 | 1698 | $padding = new QRbitstream(); |
1699 | 1699 | $ret = $padding->appendNum($words * 8 - $bits + 4, 0); |
1700 | 1700 | |
1701 | - if ($ret < 0) { |
|
1701 | + if ($ret<0) { |
|
1702 | 1702 | return $ret; |
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | $padlen = $maxwords - $words; |
1706 | 1706 | |
1707 | - if ($padlen > 0) { |
|
1707 | + if ($padlen>0) { |
|
1708 | 1708 | $padbuf = []; |
1709 | - for ($i = 0; $i < $padlen; $i++) { |
|
1709 | + for ($i = 0; $i<$padlen; $i++) { |
|
1710 | 1710 | $padbuf[$i] = ($i & 1) ? 0x11 : 0xec; |
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | $ret = $padding->appendBytes($padlen, $padbuf); |
1714 | 1714 | |
1715 | - if ($ret < 0) { |
|
1715 | + if ($ret<0) { |
|
1716 | 1716 | return $ret; |
1717 | 1717 | } |
1718 | 1718 | } |
@@ -1725,7 +1725,7 @@ discard block |
||
1725 | 1725 | //---------------------------------------------------------------------- |
1726 | 1726 | public function mergeBitStream() |
1727 | 1727 | { |
1728 | - if ($this->convertData() < 0) { |
|
1728 | + if ($this->convertData()<0) { |
|
1729 | 1729 | return; |
1730 | 1730 | } |
1731 | 1731 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | |
1734 | 1734 | foreach ($this->items as $item) { |
1735 | 1735 | $ret = $bstream->append($item->bstream); |
1736 | - if ($ret < 0) { |
|
1736 | + if ($ret<0) { |
|
1737 | 1737 | return; |
1738 | 1738 | } |
1739 | 1739 | } |
@@ -1746,12 +1746,12 @@ discard block |
||
1746 | 1746 | { |
1747 | 1747 | $bstream = $this->mergeBitStream(); |
1748 | 1748 | |
1749 | - if ($bstream == null) { |
|
1749 | + if ($bstream==null) { |
|
1750 | 1750 | return; |
1751 | 1751 | } |
1752 | 1752 | |
1753 | 1753 | $ret = $this->appendPaddingBit($bstream); |
1754 | - if ($ret < 0) { |
|
1754 | + if ($ret<0) { |
|
1755 | 1755 | return; |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | public function getByteStream() |
1763 | 1763 | { |
1764 | 1764 | $bstream = $this->getBitStream(); |
1765 | - if ($bstream == null) { |
|
1765 | + if ($bstream==null) { |
|
1766 | 1766 | return; |
1767 | 1767 | } |
1768 | 1768 | |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | $bstream->allocate($bits); |
1824 | 1824 | |
1825 | 1825 | $mask = 1 << ($bits - 1); |
1826 | - for ($i = 0; $i < $bits; $i++) { |
|
1826 | + for ($i = 0; $i<$bits; $i++) { |
|
1827 | 1827 | if ($num & $mask) { |
1828 | 1828 | $bstream->data[$i] = 1; |
1829 | 1829 | } else { |
@@ -1842,9 +1842,9 @@ discard block |
||
1842 | 1842 | $bstream->allocate($size * 8); |
1843 | 1843 | $p = 0; |
1844 | 1844 | |
1845 | - for ($i = 0; $i < $size; $i++) { |
|
1845 | + for ($i = 0; $i<$size; $i++) { |
|
1846 | 1846 | $mask = 0x80; |
1847 | - for ($j = 0; $j < 8; $j++) { |
|
1847 | + for ($j = 0; $j<8; $j++) { |
|
1848 | 1848 | if ($data[$i] & $mask) { |
1849 | 1849 | $bstream->data[$p] = 1; |
1850 | 1850 | } else { |
@@ -1865,11 +1865,11 @@ discard block |
||
1865 | 1865 | return -1; |
1866 | 1866 | } |
1867 | 1867 | |
1868 | - if ($arg->size() == 0) { |
|
1868 | + if ($arg->size()==0) { |
|
1869 | 1869 | return 0; |
1870 | 1870 | } |
1871 | 1871 | |
1872 | - if ($this->size() == 0) { |
|
1872 | + if ($this->size()==0) { |
|
1873 | 1873 | $this->data = $arg->data; |
1874 | 1874 | |
1875 | 1875 | return 0; |
@@ -1883,7 +1883,7 @@ discard block |
||
1883 | 1883 | //---------------------------------------------------------------------- |
1884 | 1884 | public function appendNum($bits, $num) |
1885 | 1885 | { |
1886 | - if ($bits == 0) { |
|
1886 | + if ($bits==0) { |
|
1887 | 1887 | return 0; |
1888 | 1888 | } |
1889 | 1889 | |
@@ -1902,7 +1902,7 @@ discard block |
||
1902 | 1902 | //---------------------------------------------------------------------- |
1903 | 1903 | public function appendBytes($size, $data) |
1904 | 1904 | { |
1905 | - if ($size == 0) { |
|
1905 | + if ($size==0) { |
|
1906 | 1906 | return 0; |
1907 | 1907 | } |
1908 | 1908 | |
@@ -1923,18 +1923,18 @@ discard block |
||
1923 | 1923 | { |
1924 | 1924 | $size = $this->size(); |
1925 | 1925 | |
1926 | - if ($size == 0) { |
|
1926 | + if ($size==0) { |
|
1927 | 1927 | return []; |
1928 | 1928 | } |
1929 | 1929 | |
1930 | - $data = array_fill(0, (int) (($size + 7) / 8), 0); |
|
1931 | - $bytes = (int) ($size / 8); |
|
1930 | + $data = array_fill(0, (int)(($size + 7) / 8), 0); |
|
1931 | + $bytes = (int)($size / 8); |
|
1932 | 1932 | |
1933 | 1933 | $p = 0; |
1934 | 1934 | |
1935 | - for ($i = 0; $i < $bytes; $i++) { |
|
1935 | + for ($i = 0; $i<$bytes; $i++) { |
|
1936 | 1936 | $v = 0; |
1937 | - for ($j = 0; $j < 8; $j++) { |
|
1937 | + for ($j = 0; $j<8; $j++) { |
|
1938 | 1938 | $v = $v << 1; |
1939 | 1939 | $v |= $this->data[$p]; |
1940 | 1940 | $p++; |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | |
1945 | 1945 | if ($size & 7) { |
1946 | 1946 | $v = 0; |
1947 | - for ($j = 0; $j < ($size & 7); $j++) { |
|
1947 | + for ($j = 0; $j<($size & 7); $j++) { |
|
1948 | 1948 | $v = $v << 1; |
1949 | 1949 | $v |= $this->data[$p]; |
1950 | 1950 | $p++; |
@@ -2006,27 +2006,27 @@ discard block |
||
2006 | 2006 | //---------------------------------------------------------------------- |
2007 | 2007 | public static function isdigitat($str, $pos) |
2008 | 2008 | { |
2009 | - if ($pos >= strlen($str)) { |
|
2009 | + if ($pos>=strlen($str)) { |
|
2010 | 2010 | return false; |
2011 | 2011 | } |
2012 | 2012 | |
2013 | - return (ord($str[$pos]) >= ord('0')) && (ord($str[$pos]) <= ord('9')); |
|
2013 | + return (ord($str[$pos])>=ord('0')) && (ord($str[$pos])<=ord('9')); |
|
2014 | 2014 | } |
2015 | 2015 | |
2016 | 2016 | //---------------------------------------------------------------------- |
2017 | 2017 | public static function isalnumat($str, $pos) |
2018 | 2018 | { |
2019 | - if ($pos >= strlen($str)) { |
|
2019 | + if ($pos>=strlen($str)) { |
|
2020 | 2020 | return false; |
2021 | 2021 | } |
2022 | 2022 | |
2023 | - return QRinput::lookAnTable(ord($str[$pos])) >= 0; |
|
2023 | + return QRinput::lookAnTable(ord($str[$pos]))>=0; |
|
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | //---------------------------------------------------------------------- |
2027 | 2027 | public function identifyMode($pos) |
2028 | 2028 | { |
2029 | - if ($pos >= strlen($this->dataStr)) { |
|
2029 | + if ($pos>=strlen($this->dataStr)) { |
|
2030 | 2030 | return QR_MODE_NUL; |
2031 | 2031 | } |
2032 | 2032 | |
@@ -2036,11 +2036,11 @@ discard block |
||
2036 | 2036 | return QR_MODE_NUM; |
2037 | 2037 | } elseif (self::isalnumat($this->dataStr, $pos)) { |
2038 | 2038 | return QR_MODE_AN; |
2039 | - } elseif ($this->modeHint == QR_MODE_KANJI) { |
|
2040 | - if ($pos + 1 < strlen($this->dataStr)) { |
|
2039 | + } elseif ($this->modeHint==QR_MODE_KANJI) { |
|
2040 | + if ($pos + 1<strlen($this->dataStr)) { |
|
2041 | 2041 | $d = $this->dataStr[$pos + 1]; |
2042 | 2042 | $word = (ord($c) << 8) | ord($d); |
2043 | - if (($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) { |
|
2043 | + if (($word>=0x8140 && $word<=0x9ffc) || ($word>=0xe040 && $word<=0xebbf)) { |
|
2044 | 2044 | return QR_MODE_KANJI; |
2045 | 2045 | } |
2046 | 2046 | } |
@@ -2062,25 +2062,25 @@ discard block |
||
2062 | 2062 | $run = $p; |
2063 | 2063 | $mode = $this->identifyMode($p); |
2064 | 2064 | |
2065 | - if ($mode == QR_MODE_8) { |
|
2065 | + if ($mode==QR_MODE_8) { |
|
2066 | 2066 | $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln |
2067 | 2067 | + QRinput::estimateBitsMode8(1) // + 4 + l8 |
2068 | 2068 | - QRinput::estimateBitsMode8($run + 1); // - 4 - l8 |
2069 | - if ($dif > 0) { |
|
2069 | + if ($dif>0) { |
|
2070 | 2070 | return $this->eat8(); |
2071 | 2071 | } |
2072 | 2072 | } |
2073 | - if ($mode == QR_MODE_AN) { |
|
2073 | + if ($mode==QR_MODE_AN) { |
|
2074 | 2074 | $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln |
2075 | 2075 | + QRinput::estimateBitsModeAn(1) // + 4 + la |
2076 | 2076 | - QRinput::estimateBitsModeAn($run + 1); // - 4 - la |
2077 | - if ($dif > 0) { |
|
2077 | + if ($dif>0) { |
|
2078 | 2078 | return $this->eatAn(); |
2079 | 2079 | } |
2080 | 2080 | } |
2081 | 2081 | |
2082 | 2082 | $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr)); |
2083 | - if ($ret < 0) { |
|
2083 | + if ($ret<0) { |
|
2084 | 2084 | return -1; |
2085 | 2085 | } |
2086 | 2086 | |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln |
2107 | 2107 | - QRinput::estimateBitsModeAn($q); // - 4 - la |
2108 | 2108 | |
2109 | - if ($dif < 0) { |
|
2109 | + if ($dif<0) { |
|
2110 | 2110 | break; |
2111 | 2111 | } else { |
2112 | 2112 | $p = $q; |
@@ -2122,13 +2122,13 @@ discard block |
||
2122 | 2122 | $dif = QRinput::estimateBitsModeAn($run) + 4 + $la |
2123 | 2123 | + QRinput::estimateBitsMode8(1) // + 4 + l8 |
2124 | 2124 | - QRinput::estimateBitsMode8($run + 1); // - 4 - l8 |
2125 | - if ($dif > 0) { |
|
2125 | + if ($dif>0) { |
|
2126 | 2126 | return $this->eat8(); |
2127 | 2127 | } |
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr)); |
2131 | - if ($ret < 0) { |
|
2131 | + if ($ret<0) { |
|
2132 | 2132 | return -1; |
2133 | 2133 | } |
2134 | 2134 | |
@@ -2140,12 +2140,12 @@ discard block |
||
2140 | 2140 | { |
2141 | 2141 | $p = 0; |
2142 | 2142 | |
2143 | - while ($this->identifyMode($p) == QR_MODE_KANJI) { |
|
2143 | + while ($this->identifyMode($p)==QR_MODE_KANJI) { |
|
2144 | 2144 | $p += 2; |
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr)); |
2148 | - if ($ret < 0) { |
|
2148 | + if ($ret<0) { |
|
2149 | 2149 | return -1; |
2150 | 2150 | } |
2151 | 2151 | |
@@ -2161,12 +2161,12 @@ discard block |
||
2161 | 2161 | $p = 1; |
2162 | 2162 | $dataStrLen = strlen($this->dataStr); |
2163 | 2163 | |
2164 | - while ($p < $dataStrLen) { |
|
2164 | + while ($p<$dataStrLen) { |
|
2165 | 2165 | $mode = $this->identifyMode($p); |
2166 | - if ($mode == QR_MODE_KANJI) { |
|
2166 | + if ($mode==QR_MODE_KANJI) { |
|
2167 | 2167 | break; |
2168 | 2168 | } |
2169 | - if ($mode == QR_MODE_NUM) { |
|
2169 | + if ($mode==QR_MODE_NUM) { |
|
2170 | 2170 | $q = $p; |
2171 | 2171 | while (self::isdigitat($this->dataStr, $q)) { |
2172 | 2172 | $q++; |
@@ -2174,12 +2174,12 @@ discard block |
||
2174 | 2174 | $dif = QRinput::estimateBitsMode8($p) // + 4 + l8 |
2175 | 2175 | + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln |
2176 | 2176 | - QRinput::estimateBitsMode8($q); // - 4 - l8 |
2177 | - if ($dif < 0) { |
|
2177 | + if ($dif<0) { |
|
2178 | 2178 | break; |
2179 | 2179 | } else { |
2180 | 2180 | $p = $q; |
2181 | 2181 | } |
2182 | - } elseif ($mode == QR_MODE_AN) { |
|
2182 | + } elseif ($mode==QR_MODE_AN) { |
|
2183 | 2183 | $q = $p; |
2184 | 2184 | while (self::isalnumat($this->dataStr, $q)) { |
2185 | 2185 | $q++; |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | $dif = QRinput::estimateBitsMode8($p) // + 4 + l8 |
2188 | 2188 | + QRinput::estimateBitsModeAn($q - $p) + 4 + $la |
2189 | 2189 | - QRinput::estimateBitsMode8($q); // - 4 - l8 |
2190 | - if ($dif < 0) { |
|
2190 | + if ($dif<0) { |
|
2191 | 2191 | break; |
2192 | 2192 | } else { |
2193 | 2193 | $p = $q; |
@@ -2200,7 +2200,7 @@ discard block |
||
2200 | 2200 | $run = $p; |
2201 | 2201 | $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr)); |
2202 | 2202 | |
2203 | - if ($ret < 0) { |
|
2203 | + if ($ret<0) { |
|
2204 | 2204 | return -1; |
2205 | 2205 | } |
2206 | 2206 | |
@@ -2210,8 +2210,8 @@ discard block |
||
2210 | 2210 | //---------------------------------------------------------------------- |
2211 | 2211 | public function splitString() |
2212 | 2212 | { |
2213 | - while (strlen($this->dataStr) > 0) { |
|
2214 | - if ($this->dataStr == '') { |
|
2213 | + while (strlen($this->dataStr)>0) { |
|
2214 | + if ($this->dataStr=='') { |
|
2215 | 2215 | return 0; |
2216 | 2216 | } |
2217 | 2217 | |
@@ -2221,7 +2221,7 @@ discard block |
||
2221 | 2221 | case QR_MODE_NUM: $length = $this->eatNum(); break; |
2222 | 2222 | case QR_MODE_AN: $length = $this->eatAn(); break; |
2223 | 2223 | case QR_MODE_KANJI: |
2224 | - if ($mode == QR_MODE_KANJI) { |
|
2224 | + if ($mode==QR_MODE_KANJI) { |
|
2225 | 2225 | $length = $this->eatKanji(); |
2226 | 2226 | } else { |
2227 | 2227 | $length = $this->eat8(); |
@@ -2231,10 +2231,10 @@ discard block |
||
2231 | 2231 | |
2232 | 2232 | } |
2233 | 2233 | |
2234 | - if ($length == 0) { |
|
2234 | + if ($length==0) { |
|
2235 | 2235 | return 0; |
2236 | 2236 | } |
2237 | - if ($length < 0) { |
|
2237 | + if ($length<0) { |
|
2238 | 2238 | return -1; |
2239 | 2239 | } |
2240 | 2240 | |
@@ -2248,12 +2248,12 @@ discard block |
||
2248 | 2248 | $stringLen = strlen($this->dataStr); |
2249 | 2249 | $p = 0; |
2250 | 2250 | |
2251 | - while ($p < $stringLen) { |
|
2251 | + while ($p<$stringLen) { |
|
2252 | 2252 | $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint); |
2253 | - if ($mode == QR_MODE_KANJI) { |
|
2253 | + if ($mode==QR_MODE_KANJI) { |
|
2254 | 2254 | $p += 2; |
2255 | 2255 | } else { |
2256 | - if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) { |
|
2256 | + if (ord($this->dataStr[$p])>=ord('a') && ord($this->dataStr[$p])<=ord('z')) { |
|
2257 | 2257 | $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32); |
2258 | 2258 | } |
2259 | 2259 | $p++; |
@@ -2266,7 +2266,7 @@ discard block |
||
2266 | 2266 | //---------------------------------------------------------------------- |
2267 | 2267 | public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true) |
2268 | 2268 | { |
2269 | - if (is_null($string) || $string == '\0' || $string == '') { |
|
2269 | + if (is_null($string) || $string=='\0' || $string=='') { |
|
2270 | 2270 | throw new Exception('empty string!!!'); |
2271 | 2271 | } |
2272 | 2272 | |
@@ -2328,7 +2328,7 @@ discard block |
||
2328 | 2328 | //---------------------------------------------------------------------- |
2329 | 2329 | public function modnn($x) |
2330 | 2330 | { |
2331 | - while ($x >= $this->nn) { |
|
2331 | + while ($x>=$this->nn) { |
|
2332 | 2332 | $x -= $this->nn; |
2333 | 2333 | $x = ($x >> $this->mm) + ($x & $this->nn); |
2334 | 2334 | } |
@@ -2346,19 +2346,19 @@ discard block |
||
2346 | 2346 | $rs = null; |
2347 | 2347 | |
2348 | 2348 | // Check parameter ranges |
2349 | - if ($symsize < 0 || $symsize > 8) { |
|
2349 | + if ($symsize<0 || $symsize>8) { |
|
2350 | 2350 | return $rs; |
2351 | 2351 | } |
2352 | - if ($fcr < 0 || $fcr >= (1 << $symsize)) { |
|
2352 | + if ($fcr<0 || $fcr>=(1 << $symsize)) { |
|
2353 | 2353 | return $rs; |
2354 | 2354 | } |
2355 | - if ($prim <= 0 || $prim >= (1 << $symsize)) { |
|
2355 | + if ($prim<=0 || $prim>=(1 << $symsize)) { |
|
2356 | 2356 | return $rs; |
2357 | 2357 | } |
2358 | - if ($nroots < 0 || $nroots >= (1 << $symsize)) { |
|
2358 | + if ($nroots<0 || $nroots>=(1 << $symsize)) { |
|
2359 | 2359 | return $rs; |
2360 | 2360 | } // Can't have more roots than symbol values! |
2361 | - if ($pad < 0 || $pad >= ((1 << $symsize) - 1 - $nroots)) { |
|
2361 | + if ($pad<0 || $pad>=((1 << $symsize) - 1 - $nroots)) { |
|
2362 | 2362 | return $rs; |
2363 | 2363 | } // Too much padding |
2364 | 2364 | |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | $rs->alpha_to[$A0] = 0; // alpha**-inf = 0 |
2380 | 2380 | $sr = 1; |
2381 | 2381 | |
2382 | - for ($i = 0; $i < $rs->nn; $i++) { |
|
2382 | + for ($i = 0; $i<$rs->nn; $i++) { |
|
2383 | 2383 | $rs->index_of[$sr] = $i; |
2384 | 2384 | $rs->alpha_to[$i] = $sr; |
2385 | 2385 | $sr <<= 1; |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | $sr &= $rs->nn; |
2390 | 2390 | } |
2391 | 2391 | |
2392 | - if ($sr != 1) { |
|
2392 | + if ($sr!=1) { |
|
2393 | 2393 | // field generator polynomial is not primitive! |
2394 | 2394 | $rs = null; |
2395 | 2395 | |
@@ -2405,17 +2405,17 @@ discard block |
||
2405 | 2405 | $rs->gfpoly = $gfpoly; |
2406 | 2406 | |
2407 | 2407 | /* Find prim-th root of 1, used in decoding */ |
2408 | - for ($iprim = 1; ($iprim % $prim) != 0; $iprim += $rs->nn); // intentional empty-body loop! |
|
2408 | + for ($iprim = 1; ($iprim % $prim)!=0; $iprim += $rs->nn); // intentional empty-body loop! |
|
2409 | 2409 | |
2410 | - $rs->iprim = (int) ($iprim / $prim); |
|
2410 | + $rs->iprim = (int)($iprim / $prim); |
|
2411 | 2411 | $rs->genpoly[0] = 1; |
2412 | 2412 | |
2413 | - for ($i = 0, $root = $fcr * $prim; $i < $nroots; $i++, $root += $prim) { |
|
2413 | + for ($i = 0, $root = $fcr * $prim; $i<$nroots; $i++, $root += $prim) { |
|
2414 | 2414 | $rs->genpoly[$i + 1] = 1; |
2415 | 2415 | |
2416 | 2416 | // Multiply rs->genpoly[] by @**(root + x) |
2417 | - for ($j = $i; $j > 0; $j--) { |
|
2418 | - if ($rs->genpoly[$j] != 0) { |
|
2417 | + for ($j = $i; $j>0; $j--) { |
|
2418 | + if ($rs->genpoly[$j]!=0) { |
|
2419 | 2419 | $rs->genpoly[$j] = $rs->genpoly[$j - 1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)]; |
2420 | 2420 | } else { |
2421 | 2421 | $rs->genpoly[$j] = $rs->genpoly[$j - 1]; |
@@ -2426,7 +2426,7 @@ discard block |
||
2426 | 2426 | } |
2427 | 2427 | |
2428 | 2428 | // convert rs->genpoly[] to index form for quicker encoding |
2429 | - for ($i = 0; $i <= $nroots; $i++) { |
|
2429 | + for ($i = 0; $i<=$nroots; $i++) { |
|
2430 | 2430 | $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]]; |
2431 | 2431 | } |
2432 | 2432 | |
@@ -2450,23 +2450,23 @@ discard block |
||
2450 | 2450 | |
2451 | 2451 | $parity = array_fill(0, $NROOTS, 0); |
2452 | 2452 | |
2453 | - for ($i = 0; $i < ($NN - $NROOTS - $PAD); $i++) { |
|
2453 | + for ($i = 0; $i<($NN - $NROOTS - $PAD); $i++) { |
|
2454 | 2454 | $feedback = $INDEX_OF[$data[$i] ^ $parity[0]]; |
2455 | - if ($feedback != $A0) { |
|
2455 | + if ($feedback!=$A0) { |
|
2456 | 2456 | // feedback term is non-zero |
2457 | 2457 | |
2458 | 2458 | // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must |
2459 | 2459 | // always be for the polynomials constructed by init_rs() |
2460 | 2460 | $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback); |
2461 | 2461 | |
2462 | - for ($j = 1; $j < $NROOTS; $j++) { |
|
2462 | + for ($j = 1; $j<$NROOTS; $j++) { |
|
2463 | 2463 | $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS - $j])]; |
2464 | 2464 | } |
2465 | 2465 | } |
2466 | 2466 | |
2467 | 2467 | // Shift |
2468 | 2468 | array_shift($parity); |
2469 | - if ($feedback != $A0) { |
|
2469 | + if ($feedback!=$A0) { |
|
2470 | 2470 | array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]); |
2471 | 2471 | } else { |
2472 | 2472 | array_push($parity, 0); |
@@ -2485,22 +2485,22 @@ discard block |
||
2485 | 2485 | public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) |
2486 | 2486 | { |
2487 | 2487 | foreach (self::$items as $rs) { |
2488 | - if ($rs->pad != $pad) { |
|
2488 | + if ($rs->pad!=$pad) { |
|
2489 | 2489 | continue; |
2490 | 2490 | } |
2491 | - if ($rs->nroots != $nroots) { |
|
2491 | + if ($rs->nroots!=$nroots) { |
|
2492 | 2492 | continue; |
2493 | 2493 | } |
2494 | - if ($rs->mm != $symsize) { |
|
2494 | + if ($rs->mm!=$symsize) { |
|
2495 | 2495 | continue; |
2496 | 2496 | } |
2497 | - if ($rs->gfpoly != $gfpoly) { |
|
2497 | + if ($rs->gfpoly!=$gfpoly) { |
|
2498 | 2498 | continue; |
2499 | 2499 | } |
2500 | - if ($rs->fcr != $fcr) { |
|
2500 | + if ($rs->fcr!=$fcr) { |
|
2501 | 2501 | continue; |
2502 | 2502 | } |
2503 | - if ($rs->prim != $prim) { |
|
2503 | + if ($rs->prim!=$prim) { |
|
2504 | 2504 | continue; |
2505 | 2505 | } |
2506 | 2506 | |
@@ -2563,7 +2563,7 @@ discard block |
||
2563 | 2563 | $blacks = 0; |
2564 | 2564 | $format = QRspec::getFormatInfo($mask, $level); |
2565 | 2565 | |
2566 | - for ($i = 0; $i < 8; $i++) { |
|
2566 | + for ($i = 0; $i<8; $i++) { |
|
2567 | 2567 | if ($format & 1) { |
2568 | 2568 | $blacks += 2; |
2569 | 2569 | $v = 0x85; |
@@ -2572,7 +2572,7 @@ discard block |
||
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | $frame[8][$width - 1 - $i] = chr($v); |
2575 | - if ($i < 6) { |
|
2575 | + if ($i<6) { |
|
2576 | 2576 | $frame[$i][8] = chr($v); |
2577 | 2577 | } else { |
2578 | 2578 | $frame[$i + 1][8] = chr($v); |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | $format = $format >> 1; |
2581 | 2581 | } |
2582 | 2582 | |
2583 | - for ($i = 0; $i < 7; $i++) { |
|
2583 | + for ($i = 0; $i<7; $i++) { |
|
2584 | 2584 | if ($format & 1) { |
2585 | 2585 | $blacks += 2; |
2586 | 2586 | $v = 0x85; |
@@ -2589,7 +2589,7 @@ discard block |
||
2589 | 2589 | } |
2590 | 2590 | |
2591 | 2591 | $frame[$width - 7 + $i][8] = chr($v); |
2592 | - if ($i == 0) { |
|
2592 | + if ($i==0) { |
|
2593 | 2593 | $frame[8][7] = chr($v); |
2594 | 2594 | } else { |
2595 | 2595 | $frame[8][6 - $i] = chr($v); |
@@ -2624,7 +2624,7 @@ discard block |
||
2624 | 2624 | |
2625 | 2625 | public function mask4($x, $y) |
2626 | 2626 | { |
2627 | - return (((int) ($y / 2)) + ((int) ($x / 3))) & 1; |
|
2627 | + return (((int)($y / 2)) + ((int)($x / 3))) & 1; |
|
2628 | 2628 | } |
2629 | 2629 | |
2630 | 2630 | public function mask5($x, $y) |
@@ -2647,13 +2647,13 @@ discard block |
||
2647 | 2647 | { |
2648 | 2648 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
2649 | 2649 | |
2650 | - for ($y = 0; $y < $width; $y++) { |
|
2651 | - for ($x = 0; $x < $width; $x++) { |
|
2650 | + for ($y = 0; $y<$width; $y++) { |
|
2651 | + for ($x = 0; $x<$width; $x++) { |
|
2652 | 2652 | if (ord($frame[$y][$x]) & 0x80) { |
2653 | 2653 | $bitMask[$y][$x] = 0; |
2654 | 2654 | } else { |
2655 | 2655 | $maskFunc = call_user_func([$this, 'mask'.$maskNo], $x, $y); |
2656 | - $bitMask[$y][$x] = ($maskFunc == 0) ? 1 : 0; |
|
2656 | + $bitMask[$y][$x] = ($maskFunc==0) ? 1 : 0; |
|
2657 | 2657 | } |
2658 | 2658 | } |
2659 | 2659 | } |
@@ -2714,12 +2714,12 @@ discard block |
||
2714 | 2714 | |
2715 | 2715 | $d = $s; |
2716 | 2716 | |
2717 | - for ($y = 0; $y < $width; $y++) { |
|
2718 | - for ($x = 0; $x < $width; $x++) { |
|
2719 | - if ($bitMask[$y][$x] == 1) { |
|
2720 | - $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int) $bitMask[$y][$x]); |
|
2717 | + for ($y = 0; $y<$width; $y++) { |
|
2718 | + for ($x = 0; $x<$width; $x++) { |
|
2719 | + if ($bitMask[$y][$x]==1) { |
|
2720 | + $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]); |
|
2721 | 2721 | } |
2722 | - $b += (int) (ord($d[$y][$x]) & 1); |
|
2722 | + $b += (int)(ord($d[$y][$x]) & 1); |
|
2723 | 2723 | } |
2724 | 2724 | } |
2725 | 2725 | |
@@ -2741,20 +2741,20 @@ discard block |
||
2741 | 2741 | { |
2742 | 2742 | $demerit = 0; |
2743 | 2743 | |
2744 | - for ($i = 0; $i < $length; $i++) { |
|
2745 | - if ($this->runLength[$i] >= 5) { |
|
2744 | + for ($i = 0; $i<$length; $i++) { |
|
2745 | + if ($this->runLength[$i]>=5) { |
|
2746 | 2746 | $demerit += (N1 + ($this->runLength[$i] - 5)); |
2747 | 2747 | } |
2748 | 2748 | if ($i & 1) { |
2749 | - if (($i >= 3) && ($i < ($length - 2)) && ($this->runLength[$i] % 3 == 0)) { |
|
2750 | - $fact = (int) ($this->runLength[$i] / 3); |
|
2751 | - if (($this->runLength[$i - 2] == $fact) && |
|
2752 | - ($this->runLength[$i - 1] == $fact) && |
|
2753 | - ($this->runLength[$i + 1] == $fact) && |
|
2754 | - ($this->runLength[$i + 2] == $fact)) { |
|
2755 | - if (($this->runLength[$i - 3] < 0) || ($this->runLength[$i - 3] >= (4 * $fact))) { |
|
2749 | + if (($i>=3) && ($i<($length - 2)) && ($this->runLength[$i] % 3==0)) { |
|
2750 | + $fact = (int)($this->runLength[$i] / 3); |
|
2751 | + if (($this->runLength[$i - 2]==$fact) && |
|
2752 | + ($this->runLength[$i - 1]==$fact) && |
|
2753 | + ($this->runLength[$i + 1]==$fact) && |
|
2754 | + ($this->runLength[$i + 2]==$fact)) { |
|
2755 | + if (($this->runLength[$i - 3]<0) || ($this->runLength[$i - 3]>=(4 * $fact))) { |
|
2756 | 2756 | $demerit += N3; |
2757 | - } elseif ((($i + 3) >= $length) || ($this->runLength[$i + 3] >= (4 * $fact))) { |
|
2757 | + } elseif ((($i + 3)>=$length) || ($this->runLength[$i + 3]>=(4 * $fact))) { |
|
2758 | 2758 | $demerit += N3; |
2759 | 2759 | } |
2760 | 2760 | } |
@@ -2771,18 +2771,18 @@ discard block |
||
2771 | 2771 | $head = 0; |
2772 | 2772 | $demerit = 0; |
2773 | 2773 | |
2774 | - for ($y = 0; $y < $width; $y++) { |
|
2774 | + for ($y = 0; $y<$width; $y++) { |
|
2775 | 2775 | $head = 0; |
2776 | 2776 | $this->runLength[0] = 1; |
2777 | 2777 | |
2778 | 2778 | $frameY = $frame[$y]; |
2779 | 2779 | |
2780 | - if ($y > 0) { |
|
2780 | + if ($y>0) { |
|
2781 | 2781 | $frameYM = $frame[$y - 1]; |
2782 | 2782 | } |
2783 | 2783 | |
2784 | - for ($x = 0; $x < $width; $x++) { |
|
2785 | - if (($x > 0) && ($y > 0)) { |
|
2784 | + for ($x = 0; $x<$width; $x++) { |
|
2785 | + if (($x>0) && ($y>0)) { |
|
2786 | 2786 | $b22 = ord($frameY[$x]) & ord($frameY[$x - 1]) & ord($frameYM[$x]) & ord($frameYM[$x - 1]); |
2787 | 2787 | $w22 = ord($frameY[$x]) | ord($frameY[$x - 1]) | ord($frameYM[$x]) | ord($frameYM[$x - 1]); |
2788 | 2788 | |
@@ -2790,11 +2790,11 @@ discard block |
||
2790 | 2790 | $demerit += N2; |
2791 | 2791 | } |
2792 | 2792 | } |
2793 | - if (($x == 0) && (ord($frameY[$x]) & 1)) { |
|
2793 | + if (($x==0) && (ord($frameY[$x]) & 1)) { |
|
2794 | 2794 | $this->runLength[0] = -1; |
2795 | 2795 | $head = 1; |
2796 | 2796 | $this->runLength[$head] = 1; |
2797 | - } elseif ($x > 0) { |
|
2797 | + } elseif ($x>0) { |
|
2798 | 2798 | if ((ord($frameY[$x]) ^ ord($frameY[$x - 1])) & 1) { |
2799 | 2799 | $head++; |
2800 | 2800 | $this->runLength[$head] = 1; |
@@ -2807,16 +2807,16 @@ discard block |
||
2807 | 2807 | $demerit += $this->calcN1N3($head + 1); |
2808 | 2808 | } |
2809 | 2809 | |
2810 | - for ($x = 0; $x < $width; $x++) { |
|
2810 | + for ($x = 0; $x<$width; $x++) { |
|
2811 | 2811 | $head = 0; |
2812 | 2812 | $this->runLength[0] = 1; |
2813 | 2813 | |
2814 | - for ($y = 0; $y < $width; $y++) { |
|
2815 | - if ($y == 0 && (ord($frame[$y][$x]) & 1)) { |
|
2814 | + for ($y = 0; $y<$width; $y++) { |
|
2815 | + if ($y==0 && (ord($frame[$y][$x]) & 1)) { |
|
2816 | 2816 | $this->runLength[0] = -1; |
2817 | 2817 | $head = 1; |
2818 | 2818 | $this->runLength[$head] = 1; |
2819 | - } elseif ($y > 0) { |
|
2819 | + } elseif ($y>0) { |
|
2820 | 2820 | if ((ord($frame[$y][$x]) ^ ord($frame[$y - 1][$x])) & 1) { |
2821 | 2821 | $head++; |
2822 | 2822 | $this->runLength[$head] = 1; |
@@ -2841,9 +2841,9 @@ discard block |
||
2841 | 2841 | |
2842 | 2842 | $checked_masks = [0, 1, 2, 3, 4, 5, 6, 7]; |
2843 | 2843 | |
2844 | - if (QR_FIND_FROM_RANDOM !== false) { |
|
2844 | + if (QR_FIND_FROM_RANDOM!==false) { |
|
2845 | 2845 | $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9); |
2846 | - for ($i = 0; $i < $howManuOut; $i++) { |
|
2846 | + for ($i = 0; $i<$howManuOut; $i++) { |
|
2847 | 2847 | $remPos = rand(0, count($checked_masks) - 1); |
2848 | 2848 | unset($checked_masks[$remPos]); |
2849 | 2849 | $checked_masks = array_values($checked_masks); |
@@ -2859,11 +2859,11 @@ discard block |
||
2859 | 2859 | $blacks = 0; |
2860 | 2860 | $blacks = $this->makeMaskNo($i, $width, $frame, $mask); |
2861 | 2861 | $blacks += $this->writeFormatInformation($width, $mask, $i, $level); |
2862 | - $blacks = (int) (100 * $blacks / ($width * $width)); |
|
2863 | - $demerit = (int) ((int) (abs($blacks - 50) / 5) * N4); |
|
2862 | + $blacks = (int)(100 * $blacks / ($width * $width)); |
|
2863 | + $demerit = (int)((int)(abs($blacks - 50) / 5) * N4); |
|
2864 | 2864 | $demerit += $this->evaluateSymbol($width, $mask); |
2865 | 2865 | |
2866 | - if ($demerit < $minDemerit) { |
|
2866 | + if ($demerit<$minDemerit) { |
|
2867 | 2867 | $minDemerit = $demerit; |
2868 | 2868 | $bestMask = $mask; |
2869 | 2869 | $bestMaskNum = $i; |
@@ -2956,7 +2956,7 @@ discard block |
||
2956 | 2956 | $this->blocks = QRspec::rsBlockNum($spec); |
2957 | 2957 | |
2958 | 2958 | $ret = $this->init($spec); |
2959 | - if ($ret < 0) { |
|
2959 | + if ($ret<0) { |
|
2960 | 2960 | throw new Exception('block alloc error'); |
2961 | 2961 | return; |
2962 | 2962 | } |
@@ -2974,7 +2974,7 @@ discard block |
||
2974 | 2974 | $blockNo = 0; |
2975 | 2975 | $dataPos = 0; |
2976 | 2976 | $eccPos = 0; |
2977 | - for ($i = 0; $i < QRspec::rsBlockNum1($spec); $i++) { |
|
2977 | + for ($i = 0; $i<QRspec::rsBlockNum1($spec); $i++) { |
|
2978 | 2978 | $ecc = array_slice($this->ecccode, $eccPos); |
2979 | 2979 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
2980 | 2980 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -2984,7 +2984,7 @@ discard block |
||
2984 | 2984 | $blockNo++; |
2985 | 2985 | } |
2986 | 2986 | |
2987 | - if (QRspec::rsBlockNum2($spec) == 0) { |
|
2987 | + if (QRspec::rsBlockNum2($spec)==0) { |
|
2988 | 2988 | return 0; |
2989 | 2989 | } |
2990 | 2990 | |
@@ -2992,11 +2992,11 @@ discard block |
||
2992 | 2992 | $el = QRspec::rsEccCodes2($spec); |
2993 | 2993 | $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el); |
2994 | 2994 | |
2995 | - if ($rs == null) { |
|
2995 | + if ($rs==null) { |
|
2996 | 2996 | return -1; |
2997 | 2997 | } |
2998 | 2998 | |
2999 | - for ($i = 0; $i < QRspec::rsBlockNum2($spec); $i++) { |
|
2999 | + for ($i = 0; $i<QRspec::rsBlockNum2($spec); $i++) { |
|
3000 | 3000 | $ecc = array_slice($this->ecccode, $eccPos); |
3001 | 3001 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
3002 | 3002 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -3014,14 +3014,14 @@ discard block |
||
3014 | 3014 | { |
3015 | 3015 | $ret; |
3016 | 3016 | |
3017 | - if ($this->count < $this->dataLength) { |
|
3017 | + if ($this->count<$this->dataLength) { |
|
3018 | 3018 | $row = $this->count % $this->blocks; |
3019 | 3019 | $col = $this->count / $this->blocks; |
3020 | - if ($col >= $this->rsblocks[0]->dataLength) { |
|
3020 | + if ($col>=$this->rsblocks[0]->dataLength) { |
|
3021 | 3021 | $row += $this->b1; |
3022 | 3022 | } |
3023 | 3023 | $ret = $this->rsblocks[$row]->data[$col]; |
3024 | - } elseif ($this->count < $this->dataLength + $this->eccLength) { |
|
3024 | + } elseif ($this->count<$this->dataLength + $this->eccLength) { |
|
3025 | 3025 | $row = ($this->count - $this->dataLength) % $this->blocks; |
3026 | 3026 | $col = ($this->count - $this->dataLength) / $this->blocks; |
3027 | 3027 | $ret = $this->rsblocks[$row]->ecc[$col]; |
@@ -3045,10 +3045,10 @@ discard block |
||
3045 | 3045 | //---------------------------------------------------------------------- |
3046 | 3046 | public function encodeMask(QRinput $input, $mask) |
3047 | 3047 | { |
3048 | - if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) { |
|
3048 | + if ($input->getVersion()<0 || $input->getVersion()>QRSPEC_VERSION_MAX) { |
|
3049 | 3049 | throw new Exception('wrong version'); |
3050 | 3050 | } |
3051 | - if ($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) { |
|
3051 | + if ($input->getErrorCorrectionLevel()>QR_ECLEVEL_H) { |
|
3052 | 3052 | throw new Exception('wrong level'); |
3053 | 3053 | } |
3054 | 3054 | |
@@ -3066,12 +3066,12 @@ discard block |
||
3066 | 3066 | } |
3067 | 3067 | |
3068 | 3068 | // inteleaved data and ecc codes |
3069 | - for ($i = 0; $i < $raw->dataLength + $raw->eccLength; $i++) { |
|
3069 | + for ($i = 0; $i<$raw->dataLength + $raw->eccLength; $i++) { |
|
3070 | 3070 | $code = $raw->getCode(); |
3071 | 3071 | $bit = 0x80; |
3072 | - for ($j = 0; $j < 8; $j++) { |
|
3072 | + for ($j = 0; $j<8; $j++) { |
|
3073 | 3073 | $addr = $filler->next(); |
3074 | - $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0)); |
|
3074 | + $filler->setFrameAt($addr, 0x02 | (($bit & $code)!=0)); |
|
3075 | 3075 | $bit = $bit >> 1; |
3076 | 3076 | } |
3077 | 3077 | } |
@@ -3082,7 +3082,7 @@ discard block |
||
3082 | 3082 | |
3083 | 3083 | // remainder bits |
3084 | 3084 | $j = QRspec::getRemainder($version); |
3085 | - for ($i = 0; $i < $j; $i++) { |
|
3085 | + for ($i = 0; $i<$j; $i++) { |
|
3086 | 3086 | $addr = $filler->next(); |
3087 | 3087 | $filler->setFrameAt($addr, 0x02); |
3088 | 3088 | } |
@@ -3092,7 +3092,7 @@ discard block |
||
3092 | 3092 | |
3093 | 3093 | // masking |
3094 | 3094 | $maskObj = new QRmask(); |
3095 | - if ($mask < 0) { |
|
3095 | + if ($mask<0) { |
|
3096 | 3096 | if (QR_FIND_BEST_MASK) { |
3097 | 3097 | $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel()); |
3098 | 3098 | } else { |
@@ -3102,7 +3102,7 @@ discard block |
||
3102 | 3102 | $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel()); |
3103 | 3103 | } |
3104 | 3104 | |
3105 | - if ($masked == null) { |
|
3105 | + if ($masked==null) { |
|
3106 | 3106 | return; |
3107 | 3107 | } |
3108 | 3108 | |
@@ -3124,18 +3124,18 @@ discard block |
||
3124 | 3124 | //---------------------------------------------------------------------- |
3125 | 3125 | public function encodeString8bit($string, $version, $level) |
3126 | 3126 | { |
3127 | - if (string == null) { |
|
3127 | + if (string==null) { |
|
3128 | 3128 | throw new Exception('empty string!'); |
3129 | 3129 | return; |
3130 | 3130 | } |
3131 | 3131 | |
3132 | 3132 | $input = new QRinput($version, $level); |
3133 | - if ($input == null) { |
|
3133 | + if ($input==null) { |
|
3134 | 3134 | return; |
3135 | 3135 | } |
3136 | 3136 | |
3137 | 3137 | $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); |
3138 | - if ($ret < 0) { |
|
3138 | + if ($ret<0) { |
|
3139 | 3139 | unset($input); |
3140 | 3140 | |
3141 | 3141 | return; |
@@ -3147,18 +3147,18 @@ discard block |
||
3147 | 3147 | //---------------------------------------------------------------------- |
3148 | 3148 | public function encodeString($string, $version, $level, $hint, $casesensitive) |
3149 | 3149 | { |
3150 | - if ($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) { |
|
3150 | + if ($hint!=QR_MODE_8 && $hint!=QR_MODE_KANJI) { |
|
3151 | 3151 | throw new Exception('bad hint'); |
3152 | 3152 | return; |
3153 | 3153 | } |
3154 | 3154 | |
3155 | 3155 | $input = new QRinput($version, $level); |
3156 | - if ($input == null) { |
|
3156 | + if ($input==null) { |
|
3157 | 3157 | return; |
3158 | 3158 | } |
3159 | 3159 | |
3160 | 3160 | $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive); |
3161 | - if ($ret < 0) { |
|
3161 | + if ($ret<0) { |
|
3162 | 3162 | return; |
3163 | 3163 | } |
3164 | 3164 | |
@@ -3244,7 +3244,7 @@ discard block |
||
3244 | 3244 | public function next() |
3245 | 3245 | { |
3246 | 3246 | do { |
3247 | - if ($this->bit == -1) { |
|
3247 | + if ($this->bit==-1) { |
|
3248 | 3248 | $this->bit = 0; |
3249 | 3249 | |
3250 | 3250 | return ['x'=>$this->x, 'y'=>$this->y]; |
@@ -3254,7 +3254,7 @@ discard block |
||
3254 | 3254 | $y = $this->y; |
3255 | 3255 | $w = $this->width; |
3256 | 3256 | |
3257 | - if ($this->bit == 0) { |
|
3257 | + if ($this->bit==0) { |
|
3258 | 3258 | $x--; |
3259 | 3259 | $this->bit++; |
3260 | 3260 | } else { |
@@ -3263,28 +3263,28 @@ discard block |
||
3263 | 3263 | $this->bit--; |
3264 | 3264 | } |
3265 | 3265 | |
3266 | - if ($this->dir < 0) { |
|
3267 | - if ($y < 0) { |
|
3266 | + if ($this->dir<0) { |
|
3267 | + if ($y<0) { |
|
3268 | 3268 | $y = 0; |
3269 | 3269 | $x -= 2; |
3270 | 3270 | $this->dir = 1; |
3271 | - if ($x == 6) { |
|
3271 | + if ($x==6) { |
|
3272 | 3272 | $x--; |
3273 | 3273 | $y = 9; |
3274 | 3274 | } |
3275 | 3275 | } |
3276 | 3276 | } else { |
3277 | - if ($y == $w) { |
|
3277 | + if ($y==$w) { |
|
3278 | 3278 | $y = $w - 1; |
3279 | 3279 | $x -= 2; |
3280 | 3280 | $this->dir = -1; |
3281 | - if ($x == 6) { |
|
3281 | + if ($x==6) { |
|
3282 | 3282 | $x--; |
3283 | 3283 | $y -= 8; |
3284 | 3284 | } |
3285 | 3285 | } |
3286 | 3286 | } |
3287 | - if ($x < 0 || $y < 0) { |
|
3287 | + if ($x<0 || $y<0) { |
|
3288 | 3288 | return; |
3289 | 3289 | } |
3290 | 3290 | |
@@ -3379,7 +3379,7 @@ discard block |
||
3379 | 3379 | |
3380 | 3380 | QRtools::markTime('after_encode'); |
3381 | 3381 | |
3382 | - if ($outfile !== false) { |
|
3382 | + if ($outfile!==false) { |
|
3383 | 3383 | file_put_contents($outfile, implode("\n", QRtools::binarize($code->data))); |
3384 | 3384 | } else { |
3385 | 3385 | return QRtools::binarize($code->data); |
@@ -3395,11 +3395,11 @@ discard block |
||
3395 | 3395 | $err = ob_get_contents(); |
3396 | 3396 | ob_end_clean(); |
3397 | 3397 | |
3398 | - if ($err != '') { |
|
3398 | + if ($err!='') { |
|
3399 | 3399 | QRtools::log($outfile, $err); |
3400 | 3400 | } |
3401 | 3401 | |
3402 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3402 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3403 | 3403 | |
3404 | 3404 | QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
3405 | 3405 | } catch (Exception $e) { |
@@ -3416,11 +3416,11 @@ discard block |
||
3416 | 3416 | $err = ob_get_contents(); |
3417 | 3417 | ob_end_clean(); |
3418 | 3418 | |
3419 | - if ($err != '') { |
|
3419 | + if ($err!='') { |
|
3420 | 3420 | QRtools::log($outfile, $err); |
3421 | 3421 | } |
3422 | 3422 | |
3423 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3423 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3424 | 3424 | |
3425 | 3425 | QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color, $this->cmyk); |
3426 | 3426 | } catch (Exception $e) { |
@@ -3437,11 +3437,11 @@ discard block |
||
3437 | 3437 | $err = ob_get_contents(); |
3438 | 3438 | ob_end_clean(); |
3439 | 3439 | |
3440 | - if ($err != '') { |
|
3440 | + if ($err!='') { |
|
3441 | 3441 | QRtools::log($outfile, $err); |
3442 | 3442 | } |
3443 | 3443 | |
3444 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3444 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
3445 | 3445 | |
3446 | 3446 | QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
3447 | 3447 | } catch (Exception $e) { |
@@ -3484,12 +3484,12 @@ discard block |
||
3484 | 3484 | { |
3485 | 3485 | $vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color, $cmyk); |
3486 | 3486 | |
3487 | - if ($filename === false) { |
|
3487 | + if ($filename===false) { |
|
3488 | 3488 | header('Content-Type: application/postscript'); |
3489 | 3489 | header('Content-Disposition: filename="qrcode.eps"'); |
3490 | 3490 | echo $vect; |
3491 | 3491 | } else { |
3492 | - if ($saveandprint === true) { |
|
3492 | + if ($saveandprint===true) { |
|
3493 | 3493 | QRtools::save($vect, $filename); |
3494 | 3494 | header('Content-Type: application/postscript'); |
3495 | 3495 | header('Content-Disposition: filename="qrcode.eps"'); |
@@ -3565,9 +3565,9 @@ discard block |
||
3565 | 3565 | |
3566 | 3566 | // Convert the matrix into pixels |
3567 | 3567 | |
3568 | - for ($i = 0; $i < $h; $i++) { |
|
3569 | - for ($j = 0; $j < $w; $j++) { |
|
3570 | - if ($frame[$i][$j] == '1') { |
|
3568 | + for ($i = 0; $i<$h; $i++) { |
|
3569 | + for ($j = 0; $j<$w; $j++) { |
|
3570 | + if ($frame[$i][$j]=='1') { |
|
3571 | 3571 | $y = $h - 1 - $i; |
3572 | 3572 | $x = $j; |
3573 | 3573 | $output .= $x.' '.$y.' 1 1 F'."\n"; |
@@ -3585,12 +3585,12 @@ discard block |
||
3585 | 3585 | { |
3586 | 3586 | $vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color); |
3587 | 3587 | |
3588 | - if ($filename === false) { |
|
3588 | + if ($filename===false) { |
|
3589 | 3589 | header('Content-Type: image/svg+xml'); |
3590 | 3590 | //header('Content-Disposition: attachment, filename="qrcode.svg"'); |
3591 | 3591 | echo $vect; |
3592 | 3592 | } else { |
3593 | - if ($saveandprint === true) { |
|
3593 | + if ($saveandprint===true) { |
|
3594 | 3594 | QRtools::save($vect, $filename); |
3595 | 3595 | header('Content-Type: image/svg+xml'); |
3596 | 3596 | //header('Content-Disposition: filename="'.$filename.'"'); |
@@ -3635,9 +3635,9 @@ discard block |
||
3635 | 3635 | |
3636 | 3636 | // Convert the matrix into pixels |
3637 | 3637 | |
3638 | - for ($i = 0; $i < $h; $i++) { |
|
3639 | - for ($j = 0; $j < $w; $j++) { |
|
3640 | - if ($frame[$i][$j] == '1') { |
|
3638 | + for ($i = 0; $i<$h; $i++) { |
|
3639 | + for ($j = 0; $j<$w; $j++) { |
|
3640 | + if ($frame[$i][$j]=='1') { |
|
3641 | 3641 | $y = ($i + $outerFrame) * $pixelPerPoint; |
3642 | 3642 | $x = ($j + $outerFrame) * $pixelPerPoint; |
3643 | 3643 | $output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n"; |
@@ -30,24 +30,24 @@ |
||
30 | 30 | '112412', '122114', '122411', '142112', '142211', '241211', '221114', '413111', '241112', '134111', // 70-79 |
31 | 31 | '111242', '121142', '121241', '114212', '124112', '124211', '411212', '421112', '421211', '212141', // 80-89 |
32 | 32 | '214121', '412121', '111143', '111341', '131141', '114113', '114311', '411113', '411311', '113141', // 90-99 |
33 | - '114131', '311141', '411131', '211412', '211214', '211232', '23311120', ]; // 100-106 |
|
33 | + '114131', '311141', '411131', '211412', '211214', '211232', '23311120', ]; // 100-106 |
|
34 | 34 | |
35 | 35 | ////Define Function |
36 | 36 | function bar128($text) |
37 | 37 | { // Part 1, make list of widths |
38 | - global $char128asc,$char128wid; |
|
39 | - $w = $char128wid[$sum = 104]; // START symbol |
|
38 | + global $char128asc, $char128wid; |
|
39 | + $w = $char128wid[$sum = 104]; // START symbol |
|
40 | 40 | $onChar = 1; |
41 | - for ($x = 0; $x < strlen($text); $x++) { // GO THRU TEXT GET LETTERS |
|
42 | - if (!(($pos = strpos($char128asc, $text[$x])) === false)) { // SKIP NOT FOUND CHARS |
|
41 | + for ($x = 0; $x<strlen($text); $x++) { // GO THRU TEXT GET LETTERS |
|
42 | + if (!(($pos = strpos($char128asc, $text[$x]))===false)) { // SKIP NOT FOUND CHARS |
|
43 | 43 | $w .= $char128wid[$pos]; |
44 | 44 | $sum += $onChar++ * $pos; |
45 | 45 | } |
46 | 46 | } |
47 | - $w .= $char128wid[$sum % 103].$char128wid[106]; //Check Code, then END |
|
47 | + $w .= $char128wid[$sum % 103].$char128wid[106]; //Check Code, then END |
|
48 | 48 | //Part 2, Write rows |
49 | 49 | $html = '<table cellpadding=0 cellspacing=0><tr>'; |
50 | - for ($x = 0; $x < strlen($w); $x += 2) { // code 128 widths: black border, then white space |
|
50 | + for ($x = 0; $x<strlen($w); $x += 2) { // code 128 widths: black border, then white space |
|
51 | 51 | $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x + 1]}\"></div>"; |
52 | 52 | } |
53 | 53 |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | <select name="itipe_barang" class="form-control" onChange="document.myform.submit();"> |
111 | 111 | <?php |
112 | 112 | $query = mysql_query('SELECT * FROM tipe_barang ORDER BY id_tipe_barang'); |
113 | - if ($query && mysql_num_rows($query) > 0) { |
|
113 | + if ($query && mysql_num_rows($query)>0) { |
|
114 | 114 | while ($row = mysql_fetch_object($query)) { |
115 | 115 | echo '<option value="'.$row->id_tipe_barang.'"'; |
116 | - if ($row->id_tipe_barang == $tipe_barang) { |
|
116 | + if ($row->id_tipe_barang==$tipe_barang) { |
|
117 | 117 | echo ' selected'; |
118 | 118 | } |
119 | 119 | echo '>'.$row->tipe_barang.'</option>'; |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | <select name="ioutlet" class="form-control" onChange="document.myform.submit();"> |
128 | 128 | <?php |
129 | 129 | $query = mysql_query('SELECT * FROM outlet ORDER BY id_outlet'); |
130 | - if ($query && mysql_num_rows($query) > 0) { |
|
130 | + if ($query && mysql_num_rows($query)>0) { |
|
131 | 131 | while ($row = mysql_fetch_object($query)) { |
132 | 132 | echo '<option value="'.$row->id_outlet.'"'; |
133 | - if ($row->id_outlet == $outlet) { |
|
133 | + if ($row->id_outlet==$outlet) { |
|
134 | 134 | echo ' selected'; |
135 | 135 | } |
136 | 136 | echo '>'.$row->outlet.'</option>'; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | $sisa_stok = $r['stok'] - $reserve; |
236 | 236 | |
237 | - if ($sisa_stok == '0') { |
|
237 | + if ($sisa_stok=='0') { |
|
238 | 238 | echo ''; |
239 | 239 | } else { |
240 | 240 | echo'<tr>'; |
@@ -53,7 +53,7 @@ |
||
53 | 53 | echo"<td style='text-align:center;'>$r[aktif]</td>"; |
54 | 54 | echo" <td style='text-align:center;'>"; |
55 | 55 | |
56 | - if ($r_edit == 'Y') { |
|
56 | + if ($r_edit=='Y') { |
|
57 | 57 | echo"<a class='thickbox' href='modul/mod_$module/form_$module.php?id_poli=$r[id_poli]&id_module=$id&width=720&height=560&module=$module&TB_iframe=true' title='Update $nmmodule'><span class='icon'><i class='fa fa-pencil'></i></span></a>"; |
58 | 58 | } |
59 | 59 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | echo"<td style='text-align:center;'>$r[aktif]</td>"; |
54 | 54 | echo" <td style='text-align:center;'>"; |
55 | 55 | |
56 | - if ($r_edit == 'Y') { |
|
56 | + if ($r_edit=='Y') { |
|
57 | 57 | echo"<a class='thickbox' href='modul/mod_$module/form_$module.php?id_kategori=$r[id_kategori]&id_module=$id&width=720&height=560&module=$module&TB_iframe=true' title='Update $nmmodule'><span class='icon'><i class='fa fa-pencil'></i></span></a>"; |
58 | 58 | } |
59 | 59 |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | <?php |
391 | 391 | |
392 | - if ($r[id_shift] == '1') { |
|
392 | + if ($r[id_shift]=='1') { |
|
393 | 393 | $id_shift = '1'; |
394 | 394 | } else { |
395 | 395 | $id_shift = '%'; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | ?> |
502 | 502 | |
503 | - <?php if ($id_shift == '%') { |
|
503 | + <?php if ($id_shift=='%') { |
|
504 | 504 | ?> |
505 | 505 | <tr> |
506 | 506 | <th></th> |
@@ -2,18 +2,18 @@ |
||
2 | 2 | <?php |
3 | 3 | switch ($_GET[act]) { |
4 | 4 | |
5 | -default: |
|
5 | + default: |
|
6 | 6 | |
7 | - $gtampil = mysql_query("SELECT * FROM informasi_perusahaan where id_informasi_perusahaan = '1'"); |
|
8 | - $g = mysql_fetch_array($gtampil); |
|
7 | + $gtampil = mysql_query("SELECT * FROM informasi_perusahaan where id_informasi_perusahaan = '1'"); |
|
8 | + $g = mysql_fetch_array($gtampil); |
|
9 | 9 | |
10 | -if ($g['pict']) { |
|
11 | - $pict = $g['pict']; |
|
10 | + if ($g['pict']) { |
|
11 | + $pict = $g['pict']; |
|
12 | 12 | } else { |
13 | - $pict = ''; |
|
13 | + $pict = ''; |
|
14 | 14 | } |
15 | 15 | |
16 | -?> |
|
16 | + ?> |
|
17 | 17 | <div class="col-md-12 col-sm-12 col-xs-12 center-block"> |
18 | 18 | <div class="x_panel"> |
19 | 19 | <div class="x_title"> |