@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $bstream->allocate($bits); |
51 | 51 | |
52 | 52 | $mask = 1 << ($bits - 1); |
53 | - for ($i = 0; $i < $bits; $i++) { |
|
53 | + for ($i = 0; $i<$bits; $i++) { |
|
54 | 54 | if ($num & $mask) { |
55 | 55 | $bstream->data[$i] = 1; |
56 | 56 | } else { |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | $bstream->allocate($size * 8); |
70 | 70 | $p = 0; |
71 | 71 | |
72 | - for ($i = 0; $i < $size; $i++) { |
|
72 | + for ($i = 0; $i<$size; $i++) { |
|
73 | 73 | $mask = 0x80; |
74 | - for ($j = 0; $j < 8; $j++) { |
|
74 | + for ($j = 0; $j<8; $j++) { |
|
75 | 75 | if ($data[$i] & $mask) { |
76 | 76 | $bstream->data[$p] = 1; |
77 | 77 | } else { |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | return -1; |
93 | 93 | } |
94 | 94 | |
95 | - if ($arg->size() == 0) { |
|
95 | + if ($arg->size()==0) { |
|
96 | 96 | return 0; |
97 | 97 | } |
98 | 98 | |
99 | - if ($this->size() == 0) { |
|
99 | + if ($this->size()==0) { |
|
100 | 100 | $this->data = $arg->data; |
101 | 101 | |
102 | 102 | return 0; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | //---------------------------------------------------------------------- |
111 | 111 | public function appendNum($bits, $num) |
112 | 112 | { |
113 | - if ($bits == 0) { |
|
113 | + if ($bits==0) { |
|
114 | 114 | return 0; |
115 | 115 | } |
116 | 116 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | //---------------------------------------------------------------------- |
130 | 130 | public function appendBytes($size, $data) |
131 | 131 | { |
132 | - if ($size == 0) { |
|
132 | + if ($size==0) { |
|
133 | 133 | return 0; |
134 | 134 | } |
135 | 135 | |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | { |
151 | 151 | $size = $this->size(); |
152 | 152 | |
153 | - if ($size == 0) { |
|
153 | + if ($size==0) { |
|
154 | 154 | return []; |
155 | 155 | } |
156 | 156 | |
157 | - $data = array_fill(0, (int) (($size + 7) / 8), 0); |
|
158 | - $bytes = (int) ($size / 8); |
|
157 | + $data = array_fill(0, (int)(($size + 7) / 8), 0); |
|
158 | + $bytes = (int)($size / 8); |
|
159 | 159 | |
160 | 160 | $p = 0; |
161 | 161 | |
162 | - for ($i = 0; $i < $bytes; $i++) { |
|
162 | + for ($i = 0; $i<$bytes; $i++) { |
|
163 | 163 | $v = 0; |
164 | - for ($j = 0; $j < 8; $j++) { |
|
164 | + for ($j = 0; $j<8; $j++) { |
|
165 | 165 | $v = $v << 1; |
166 | 166 | $v |= $this->data[$p]; |
167 | 167 | $p++; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | if ($size & 7) { |
173 | 173 | $v = 0; |
174 | - for ($j = 0; $j < ($size & 7); $j++) { |
|
174 | + for ($j = 0; $j<($size & 7); $j++) { |
|
175 | 175 | $v = $v << 1; |
176 | 176 | $v |= $this->data[$p]; |
177 | 177 | $p++; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $blacks = 0; |
47 | 47 | $format = QRspec::getFormatInfo($mask, $level); |
48 | 48 | |
49 | - for ($i = 0; $i < 8; $i++) { |
|
49 | + for ($i = 0; $i<8; $i++) { |
|
50 | 50 | if ($format & 1) { |
51 | 51 | $blacks += 2; |
52 | 52 | $v = 0x85; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | $frame[8][$width - 1 - $i] = chr($v); |
58 | - if ($i < 6) { |
|
58 | + if ($i<6) { |
|
59 | 59 | $frame[$i][8] = chr($v); |
60 | 60 | } else { |
61 | 61 | $frame[$i + 1][8] = chr($v); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $format = $format >> 1; |
64 | 64 | } |
65 | 65 | |
66 | - for ($i = 0; $i < 7; $i++) { |
|
66 | + for ($i = 0; $i<7; $i++) { |
|
67 | 67 | if ($format & 1) { |
68 | 68 | $blacks += 2; |
69 | 69 | $v = 0x85; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | $frame[$width - 7 + $i][8] = chr($v); |
75 | - if ($i == 0) { |
|
75 | + if ($i==0) { |
|
76 | 76 | $frame[8][7] = chr($v); |
77 | 77 | } else { |
78 | 78 | $frame[8][6 - $i] = chr($v); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function mask4($x, $y) |
109 | 109 | { |
110 | - return (((int) ($y / 2)) + ((int) ($x / 3))) & 1; |
|
110 | + return (((int)($y / 2)) + ((int)($x / 3))) & 1; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | public function mask5($x, $y) |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | { |
131 | 131 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
132 | 132 | |
133 | - for ($y = 0; $y < $width; $y++) { |
|
134 | - for ($x = 0; $x < $width; $x++) { |
|
133 | + for ($y = 0; $y<$width; $y++) { |
|
134 | + for ($x = 0; $x<$width; $x++) { |
|
135 | 135 | if (ord($frame[$y][$x]) & 0x80) { |
136 | 136 | $bitMask[$y][$x] = 0; |
137 | 137 | } else { |
138 | 138 | $maskFunc = call_user_func([$this, 'mask'.$maskNo], $x, $y); |
139 | - $bitMask[$y][$x] = ($maskFunc == 0) ? 1 : 0; |
|
139 | + $bitMask[$y][$x] = ($maskFunc==0) ? 1 : 0; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | |
198 | 198 | $d = $s; |
199 | 199 | |
200 | - for ($y = 0; $y < $width; $y++) { |
|
201 | - for ($x = 0; $x < $width; $x++) { |
|
202 | - if ($bitMask[$y][$x] == 1) { |
|
203 | - $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int) $bitMask[$y][$x]); |
|
200 | + for ($y = 0; $y<$width; $y++) { |
|
201 | + for ($x = 0; $x<$width; $x++) { |
|
202 | + if ($bitMask[$y][$x]==1) { |
|
203 | + $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]); |
|
204 | 204 | } |
205 | - $b += (int) (ord($d[$y][$x]) & 1); |
|
205 | + $b += (int)(ord($d[$y][$x]) & 1); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
@@ -224,20 +224,20 @@ discard block |
||
224 | 224 | { |
225 | 225 | $demerit = 0; |
226 | 226 | |
227 | - for ($i = 0; $i < $length; $i++) { |
|
228 | - if ($this->runLength[$i] >= 5) { |
|
227 | + for ($i = 0; $i<$length; $i++) { |
|
228 | + if ($this->runLength[$i]>=5) { |
|
229 | 229 | $demerit += (N1 + ($this->runLength[$i] - 5)); |
230 | 230 | } |
231 | 231 | if ($i & 1) { |
232 | - if (($i >= 3) && ($i < ($length - 2)) && ($this->runLength[$i] % 3 == 0)) { |
|
233 | - $fact = (int) ($this->runLength[$i] / 3); |
|
234 | - if (($this->runLength[$i - 2] == $fact) && |
|
235 | - ($this->runLength[$i - 1] == $fact) && |
|
236 | - ($this->runLength[$i + 1] == $fact) && |
|
237 | - ($this->runLength[$i + 2] == $fact)) { |
|
238 | - if (($this->runLength[$i - 3] < 0) || ($this->runLength[$i - 3] >= (4 * $fact))) { |
|
232 | + if (($i>=3) && ($i<($length - 2)) && ($this->runLength[$i] % 3==0)) { |
|
233 | + $fact = (int)($this->runLength[$i] / 3); |
|
234 | + if (($this->runLength[$i - 2]==$fact) && |
|
235 | + ($this->runLength[$i - 1]==$fact) && |
|
236 | + ($this->runLength[$i + 1]==$fact) && |
|
237 | + ($this->runLength[$i + 2]==$fact)) { |
|
238 | + if (($this->runLength[$i - 3]<0) || ($this->runLength[$i - 3]>=(4 * $fact))) { |
|
239 | 239 | $demerit += N3; |
240 | - } elseif ((($i + 3) >= $length) || ($this->runLength[$i + 3] >= (4 * $fact))) { |
|
240 | + } elseif ((($i + 3)>=$length) || ($this->runLength[$i + 3]>=(4 * $fact))) { |
|
241 | 241 | $demerit += N3; |
242 | 242 | } |
243 | 243 | } |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | $head = 0; |
255 | 255 | $demerit = 0; |
256 | 256 | |
257 | - for ($y = 0; $y < $width; $y++) { |
|
257 | + for ($y = 0; $y<$width; $y++) { |
|
258 | 258 | $head = 0; |
259 | 259 | $this->runLength[0] = 1; |
260 | 260 | |
261 | 261 | $frameY = $frame[$y]; |
262 | 262 | |
263 | - if ($y > 0) { |
|
263 | + if ($y>0) { |
|
264 | 264 | $frameYM = $frame[$y - 1]; |
265 | 265 | } |
266 | 266 | |
267 | - for ($x = 0; $x < $width; $x++) { |
|
268 | - if (($x > 0) && ($y > 0)) { |
|
267 | + for ($x = 0; $x<$width; $x++) { |
|
268 | + if (($x>0) && ($y>0)) { |
|
269 | 269 | $b22 = ord($frameY[$x]) & ord($frameY[$x - 1]) & ord($frameYM[$x]) & ord($frameYM[$x - 1]); |
270 | 270 | $w22 = ord($frameY[$x]) | ord($frameY[$x - 1]) | ord($frameYM[$x]) | ord($frameYM[$x - 1]); |
271 | 271 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | $demerit += N2; |
274 | 274 | } |
275 | 275 | } |
276 | - if (($x == 0) && (ord($frameY[$x]) & 1)) { |
|
276 | + if (($x==0) && (ord($frameY[$x]) & 1)) { |
|
277 | 277 | $this->runLength[0] = -1; |
278 | 278 | $head = 1; |
279 | 279 | $this->runLength[$head] = 1; |
280 | - } elseif ($x > 0) { |
|
280 | + } elseif ($x>0) { |
|
281 | 281 | if ((ord($frameY[$x]) ^ ord($frameY[$x - 1])) & 1) { |
282 | 282 | $head++; |
283 | 283 | $this->runLength[$head] = 1; |
@@ -290,16 +290,16 @@ discard block |
||
290 | 290 | $demerit += $this->calcN1N3($head + 1); |
291 | 291 | } |
292 | 292 | |
293 | - for ($x = 0; $x < $width; $x++) { |
|
293 | + for ($x = 0; $x<$width; $x++) { |
|
294 | 294 | $head = 0; |
295 | 295 | $this->runLength[0] = 1; |
296 | 296 | |
297 | - for ($y = 0; $y < $width; $y++) { |
|
298 | - if ($y == 0 && (ord($frame[$y][$x]) & 1)) { |
|
297 | + for ($y = 0; $y<$width; $y++) { |
|
298 | + if ($y==0 && (ord($frame[$y][$x]) & 1)) { |
|
299 | 299 | $this->runLength[0] = -1; |
300 | 300 | $head = 1; |
301 | 301 | $this->runLength[$head] = 1; |
302 | - } elseif ($y > 0) { |
|
302 | + } elseif ($y>0) { |
|
303 | 303 | if ((ord($frame[$y][$x]) ^ ord($frame[$y - 1][$x])) & 1) { |
304 | 304 | $head++; |
305 | 305 | $this->runLength[$head] = 1; |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | |
325 | 325 | $checked_masks = [0, 1, 2, 3, 4, 5, 6, 7]; |
326 | 326 | |
327 | - if (QR_FIND_FROM_RANDOM !== false) { |
|
327 | + if (QR_FIND_FROM_RANDOM!==false) { |
|
328 | 328 | $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9); |
329 | - for ($i = 0; $i < $howManuOut; $i++) { |
|
329 | + for ($i = 0; $i<$howManuOut; $i++) { |
|
330 | 330 | $remPos = rand(0, count($checked_masks) - 1); |
331 | 331 | unset($checked_masks[$remPos]); |
332 | 332 | $checked_masks = array_values($checked_masks); |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | $blacks = 0; |
343 | 343 | $blacks = $this->makeMaskNo($i, $width, $frame, $mask); |
344 | 344 | $blacks += $this->writeFormatInformation($width, $mask, $i, $level); |
345 | - $blacks = (int) (100 * $blacks / ($width * $width)); |
|
346 | - $demerit = (int) ((int) (abs($blacks - 50) / 5) * N4); |
|
345 | + $blacks = (int)(100 * $blacks / ($width * $width)); |
|
346 | + $demerit = (int)((int)(abs($blacks - 50) / 5) * N4); |
|
347 | 347 | $demerit += $this->evaluateSymbol($width, $mask); |
348 | 348 | |
349 | - if ($demerit < $minDemerit) { |
|
349 | + if ($demerit<$minDemerit) { |
|
350 | 350 | $minDemerit = $demerit; |
351 | 351 | $bestMask = $mask; |
352 | 352 | $bestMaskNum = $i; |
@@ -51,6 +51,6 @@ |
||
51 | 51 | { |
52 | 52 | public static function set(&$srctab, $x, $y, $repl, $replLen = false) |
53 | 53 | { |
54 | - $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false) ? substr($repl, 0, $replLen) : $repl, $x, ($replLen !== false) ? $replLen : strlen($repl)); |
|
54 | + $srctab[$y] = substr_replace($srctab[$y], ($replLen!==false) ? substr($repl, 0, $replLen) : $repl, $x, ($replLen!==false) ? $replLen : strlen($repl)); |
|
55 | 55 | } |
56 | 56 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | { |
4 | 4 | echo "<select name=$var>"; |
5 | 5 | echo "<option value=0 selected>$default</option>"; |
6 | - for ($i = $awal; $i <= $akhir; $i++) { |
|
6 | + for ($i = $awal; $i<=$akhir; $i++) { |
|
7 | 7 | echo "<option value=$i>$i</option>"; |
8 | 8 | } |
9 | 9 | echo '</select> '; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | include '../config/library.php'; |
15 | 15 | echo "<select name=$var>"; |
16 | 16 | echo "<option value=0 selected>$default</option>"; |
17 | - for ($bln = $awal; $bln <= $akhir; $bln++) { |
|
17 | + for ($bln = $awal; $bln<=$akhir; $bln++) { |
|
18 | 18 | echo "<option value=$bln>$nama_bln[$bln]</option>"; |
19 | 19 | } |
20 | 20 | echo '</select> '; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | function combotgl2($awal, $akhir, $var, $terpilih) |
24 | 24 | { |
25 | 25 | echo "<select name=$var class='tselect_tgl'>"; |
26 | - for ($i = $awal; $i <= $akhir; $i++) { |
|
27 | - if ($i == $terpilih) { |
|
26 | + for ($i = $awal; $i<=$akhir; $i++) { |
|
27 | + if ($i==$terpilih) { |
|
28 | 28 | echo "<option value=$i selected>$i</option>"; |
29 | 29 | } else { |
30 | 30 | echo "<option value=$i>$i</option>"; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | include '../config/library.php'; |
39 | 39 | echo "<select name=$var class='tselect_bln'>"; |
40 | - for ($bln = $awal; $bln <= $akhir; $bln++) { |
|
41 | - if ($bln == $terpilih) { |
|
40 | + for ($bln = $awal; $bln<=$akhir; $bln++) { |
|
41 | + if ($bln==$terpilih) { |
|
42 | 42 | echo "<option value=$bln selected>$nama_bln[$bln]</option>"; |
43 | 43 | } else { |
44 | 44 | echo "<option value=$bln>$nama_bln[$bln]</option>"; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | function combothn($awal, $akhir, $var, $terpilih) |
51 | 51 | { |
52 | 52 | echo "<select name=$var class='tselect_thn'>"; |
53 | - for ($i = $awal; $i <= $akhir; $i++) { |
|
54 | - if ($i == $terpilih) { |
|
53 | + for ($i = $awal; $i<=$akhir; $i++) { |
|
54 | + if ($i==$terpilih) { |
|
55 | 55 | echo "<option value=$i selected>$i</option>"; |
56 | 56 | } else { |
57 | 57 | echo "<option value=$i>$i</option>"; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $thumbnailPath = ''; |
14 | 14 | |
15 | 15 | // if a file is given |
16 | - if (trim($image['tmp_name']) != '') { |
|
16 | + if (trim($image['tmp_name'])!='') { |
|
17 | 17 | $ext = substr(strrchr($image['name'], '.'), 1); |
18 | 18 | |
19 | 19 | // generate a random new file name to avoid name conflict |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $tmpDest = pathinfo(strtolower($destFile)); |
73 | 73 | $size = getimagesize($srcFile); |
74 | 74 | |
75 | - if ($tmpDest['extension'] == 'gif' || $tmpDest['extension'] == 'jpg') { |
|
75 | + if ($tmpDest['extension']=='gif' || $tmpDest['extension']=='jpg') { |
|
76 | 76 | $destFile = substr_replace($destFile, 'jpg', -3); |
77 | 77 | $dest = imagecreatetruecolor($w, $h); |
78 | 78 | //imageantialias($dest, TRUE); |
79 | - } elseif ($tmpDest['extension'] == 'png') { |
|
79 | + } elseif ($tmpDest['extension']=='png') { |
|
80 | 80 | $dest = imagecreatetruecolor($w, $h); |
81 | 81 | //imageantialias($dest, TRUE); |
82 | 82 | } else { |
@@ -20,7 +20,7 @@ |
||
20 | 20 | <script type="text/javascript" src="../unit_test.js"></script> |
21 | 21 | <?php |
22 | 22 | $aScripts = explode(':', $_GET['scripts']); |
23 | - for ($i = 0; $i < count($aScripts); $i++) { |
|
23 | + for ($i = 0; $i<count($aScripts); $i++) { |
|
24 | 24 | echo '<script type="text/javascript" src="../'.$aScripts[$i].'?rand='.rand().'"></script>'."\n"; |
25 | 25 | } |
26 | 26 | ?> |
@@ -20,7 +20,7 @@ |
||
20 | 20 | <script type="text/javascript" src="../unit_test.js"></script> |
21 | 21 | <?php |
22 | 22 | $aScripts = explode(':', $_GET['scripts']); |
23 | - for ($i = 0; $i < count($aScripts); $i++) { |
|
23 | + for ($i = 0; $i<count($aScripts); $i++) { |
|
24 | 24 | echo '<script type="text/javascript" src="../'.$aScripts[$i].'?rand='.rand().'"></script>'."\n"; |
25 | 25 | } |
26 | 26 | ?> |
@@ -82,7 +82,7 @@ |
||
82 | 82 | </script> |
83 | 83 | <?php |
84 | 84 | $aScripts = explode(':', $_GET['scripts']); |
85 | - for ($i = 0; $i < count($aScripts); $i++) { |
|
85 | + for ($i = 0; $i<count($aScripts); $i++) { |
|
86 | 86 | echo '<script type="text/javascript" src="../'.$aScripts[$i].'?rand='.rand().'"></script>'."\n"; |
87 | 87 | } |
88 | 88 | ?> |
@@ -20,7 +20,7 @@ |
||
20 | 20 | <script type="text/javascript" src="../unit_test.js"></script> |
21 | 21 | <?php |
22 | 22 | $aScripts = explode(':', $_GET['scripts']); |
23 | - for ($i = 0; $i < count($aScripts); $i++) { |
|
23 | + for ($i = 0; $i<count($aScripts); $i++) { |
|
24 | 24 | echo '<script type="text/javascript" src="../'.$aScripts[$i].'?rand='.rand().'"></script>'."\n"; |
25 | 25 | } |
26 | 26 | ?> |