@@ -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 | } |
@@ -47,27 +47,27 @@ discard block |
||
| 47 | 47 | //---------------------------------------------------------------------- |
| 48 | 48 | public static function isdigitat($str, $pos) |
| 49 | 49 | { |
| 50 | - if ($pos >= strlen($str)) { |
|
| 50 | + if ($pos>=strlen($str)) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return (ord($str[$pos]) >= ord('0')) && (ord($str[$pos]) <= ord('9')); |
|
| 54 | + return (ord($str[$pos])>=ord('0')) && (ord($str[$pos])<=ord('9')); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | //---------------------------------------------------------------------- |
| 58 | 58 | public static function isalnumat($str, $pos) |
| 59 | 59 | { |
| 60 | - if ($pos >= strlen($str)) { |
|
| 60 | + if ($pos>=strlen($str)) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - return QRinput::lookAnTable(ord($str[$pos])) >= 0; |
|
| 64 | + return QRinput::lookAnTable(ord($str[$pos]))>=0; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //---------------------------------------------------------------------- |
| 68 | 68 | public function identifyMode($pos) |
| 69 | 69 | { |
| 70 | - if ($pos >= strlen($this->dataStr)) { |
|
| 70 | + if ($pos>=strlen($this->dataStr)) { |
|
| 71 | 71 | return QR_MODE_NUL; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | return QR_MODE_NUM; |
| 78 | 78 | } elseif (self::isalnumat($this->dataStr, $pos)) { |
| 79 | 79 | return QR_MODE_AN; |
| 80 | - } elseif ($this->modeHint == QR_MODE_KANJI) { |
|
| 81 | - if ($pos + 1 < strlen($this->dataStr)) { |
|
| 80 | + } elseif ($this->modeHint==QR_MODE_KANJI) { |
|
| 81 | + if ($pos + 1<strlen($this->dataStr)) { |
|
| 82 | 82 | $d = $this->dataStr[$pos + 1]; |
| 83 | 83 | $word = (ord($c) << 8) | ord($d); |
| 84 | - if (($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) { |
|
| 84 | + if (($word>=0x8140 && $word<=0x9ffc) || ($word>=0xe040 && $word<=0xebbf)) { |
|
| 85 | 85 | return QR_MODE_KANJI; |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -103,25 +103,25 @@ discard block |
||
| 103 | 103 | $run = $p; |
| 104 | 104 | $mode = $this->identifyMode($p); |
| 105 | 105 | |
| 106 | - if ($mode == QR_MODE_8) { |
|
| 106 | + if ($mode==QR_MODE_8) { |
|
| 107 | 107 | $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln |
| 108 | 108 | + QRinput::estimateBitsMode8(1) // + 4 + l8 |
| 109 | 109 | - QRinput::estimateBitsMode8($run + 1); // - 4 - l8 |
| 110 | - if ($dif > 0) { |
|
| 110 | + if ($dif>0) { |
|
| 111 | 111 | return $this->eat8(); |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | - if ($mode == QR_MODE_AN) { |
|
| 114 | + if ($mode==QR_MODE_AN) { |
|
| 115 | 115 | $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln |
| 116 | 116 | + QRinput::estimateBitsModeAn(1) // + 4 + la |
| 117 | 117 | - QRinput::estimateBitsModeAn($run + 1); // - 4 - la |
| 118 | - if ($dif > 0) { |
|
| 118 | + if ($dif>0) { |
|
| 119 | 119 | return $this->eatAn(); |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr)); |
| 124 | - if ($ret < 0) { |
|
| 124 | + if ($ret<0) { |
|
| 125 | 125 | return -1; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln |
| 148 | 148 | - QRinput::estimateBitsModeAn($q); // - 4 - la |
| 149 | 149 | |
| 150 | - if ($dif < 0) { |
|
| 150 | + if ($dif<0) { |
|
| 151 | 151 | break; |
| 152 | 152 | } else { |
| 153 | 153 | $p = $q; |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | $dif = QRinput::estimateBitsModeAn($run) + 4 + $la |
| 164 | 164 | + QRinput::estimateBitsMode8(1) // + 4 + l8 |
| 165 | 165 | - QRinput::estimateBitsMode8($run + 1); // - 4 - l8 |
| 166 | - if ($dif > 0) { |
|
| 166 | + if ($dif>0) { |
|
| 167 | 167 | return $this->eat8(); |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr)); |
| 172 | - if ($ret < 0) { |
|
| 172 | + if ($ret<0) { |
|
| 173 | 173 | return -1; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | $p = 0; |
| 183 | 183 | |
| 184 | - while ($this->identifyMode($p) == QR_MODE_KANJI) { |
|
| 184 | + while ($this->identifyMode($p)==QR_MODE_KANJI) { |
|
| 185 | 185 | $p += 2; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr)); |
| 189 | - if ($ret < 0) { |
|
| 189 | + if ($ret<0) { |
|
| 190 | 190 | return -1; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -202,12 +202,12 @@ discard block |
||
| 202 | 202 | $p = 1; |
| 203 | 203 | $dataStrLen = strlen($this->dataStr); |
| 204 | 204 | |
| 205 | - while ($p < $dataStrLen) { |
|
| 205 | + while ($p<$dataStrLen) { |
|
| 206 | 206 | $mode = $this->identifyMode($p); |
| 207 | - if ($mode == QR_MODE_KANJI) { |
|
| 207 | + if ($mode==QR_MODE_KANJI) { |
|
| 208 | 208 | break; |
| 209 | 209 | } |
| 210 | - if ($mode == QR_MODE_NUM) { |
|
| 210 | + if ($mode==QR_MODE_NUM) { |
|
| 211 | 211 | $q = $p; |
| 212 | 212 | while (self::isdigitat($this->dataStr, $q)) { |
| 213 | 213 | $q++; |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | $dif = QRinput::estimateBitsMode8($p) // + 4 + l8 |
| 216 | 216 | + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln |
| 217 | 217 | - QRinput::estimateBitsMode8($q); // - 4 - l8 |
| 218 | - if ($dif < 0) { |
|
| 218 | + if ($dif<0) { |
|
| 219 | 219 | break; |
| 220 | 220 | } else { |
| 221 | 221 | $p = $q; |
| 222 | 222 | } |
| 223 | - } elseif ($mode == QR_MODE_AN) { |
|
| 223 | + } elseif ($mode==QR_MODE_AN) { |
|
| 224 | 224 | $q = $p; |
| 225 | 225 | while (self::isalnumat($this->dataStr, $q)) { |
| 226 | 226 | $q++; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $dif = QRinput::estimateBitsMode8($p) // + 4 + l8 |
| 229 | 229 | + QRinput::estimateBitsModeAn($q - $p) + 4 + $la |
| 230 | 230 | - QRinput::estimateBitsMode8($q); // - 4 - l8 |
| 231 | - if ($dif < 0) { |
|
| 231 | + if ($dif<0) { |
|
| 232 | 232 | break; |
| 233 | 233 | } else { |
| 234 | 234 | $p = $q; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $run = $p; |
| 242 | 242 | $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr)); |
| 243 | 243 | |
| 244 | - if ($ret < 0) { |
|
| 244 | + if ($ret<0) { |
|
| 245 | 245 | return -1; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | //---------------------------------------------------------------------- |
| 252 | 252 | public function splitString() |
| 253 | 253 | { |
| 254 | - while (strlen($this->dataStr) > 0) { |
|
| 255 | - if ($this->dataStr == '') { |
|
| 254 | + while (strlen($this->dataStr)>0) { |
|
| 255 | + if ($this->dataStr=='') { |
|
| 256 | 256 | return 0; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | case QR_MODE_NUM: $length = $this->eatNum(); break; |
| 263 | 263 | case QR_MODE_AN: $length = $this->eatAn(); break; |
| 264 | 264 | case QR_MODE_KANJI: |
| 265 | - if ($mode == QR_MODE_KANJI) { |
|
| 265 | + if ($mode==QR_MODE_KANJI) { |
|
| 266 | 266 | $length = $this->eatKanji(); |
| 267 | 267 | } else { |
| 268 | 268 | $length = $this->eat8(); |
@@ -272,10 +272,10 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if ($length == 0) { |
|
| 275 | + if ($length==0) { |
|
| 276 | 276 | return 0; |
| 277 | 277 | } |
| 278 | - if ($length < 0) { |
|
| 278 | + if ($length<0) { |
|
| 279 | 279 | return -1; |
| 280 | 280 | } |
| 281 | 281 | |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | $stringLen = strlen($this->dataStr); |
| 290 | 290 | $p = 0; |
| 291 | 291 | |
| 292 | - while ($p < $stringLen) { |
|
| 292 | + while ($p<$stringLen) { |
|
| 293 | 293 | $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint); |
| 294 | - if ($mode == QR_MODE_KANJI) { |
|
| 294 | + if ($mode==QR_MODE_KANJI) { |
|
| 295 | 295 | $p += 2; |
| 296 | 296 | } else { |
| 297 | - if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) { |
|
| 297 | + if (ord($this->dataStr[$p])>=ord('a') && ord($this->dataStr[$p])<=ord('z')) { |
|
| 298 | 298 | $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32); |
| 299 | 299 | } |
| 300 | 300 | $p++; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | //---------------------------------------------------------------------- |
| 308 | 308 | public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true) |
| 309 | 309 | { |
| 310 | - if (is_null($string) || $string == '\0' || $string == '') { |
|
| 310 | + if (is_null($string) || $string=='\0' || $string=='') { |
|
| 311 | 311 | throw new Exception('empty string!!!'); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $id = $r['id_modul']; |
| 13 | 13 | $fa_icon = $r['fa_icon']; |
| 14 | 14 | |
| 15 | -if ($r[orientation] == 'P') { |
|
| 15 | +if ($r[orientation]=='P') { |
|
| 16 | 16 | $orientation = 'portrait'; |
| 17 | 17 | } else { |
| 18 | 18 | $orientation = 'landscape'; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | <!--<body onload="cetakspk()">--> |
| 141 | 141 | |
| 142 | -<?php if ($_GET['printto'] == '2') { |
|
| 142 | +<?php if ($_GET['printto']=='2') { |
|
| 143 | 143 | ?> |
| 144 | 144 | <body onload="icetak()"> |
| 145 | 145 | <?php |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | |
| 80 | 80 | if ($id) { |
| 81 | 81 | $query = mysql_query('SELECT * FROM general_setting WHERE id_general_setting = "'.$id.'"'); |
| 82 | - if ($query && mysql_num_rows($query) == 1) { |
|
| 82 | + if ($query && mysql_num_rows($query)==1) { |
|
| 83 | 83 | $data = mysql_fetch_object($query); |
| 84 | 84 | } else { |
| 85 | 85 | die('Data general_setting tidak ditemukan'); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $datetime = date('Y-m-d G:i:s', $hour); |
| 18 | 18 | $userid = $_SESSION['userid']; |
| 19 | 19 | |
| 20 | - if ($module == 'general_setting' and $act == 'input') { |
|
| 20 | + if ($module=='general_setting' and $act=='input') { |
|
| 21 | 21 | $id_module = $_POST['id_module']; |
| 22 | 22 | |
| 23 | 23 | $lokasi_file = $_FILES['fupload']['tmp_name']; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | if ($id) { |
| 46 | 46 | $query = mysql_query('SELECT * FROM poli WHERE id_poli = "'.$id.'"'); |
| 47 | - if ($query && mysql_num_rows($query) == 1) { |
|
| 47 | + if ($query && mysql_num_rows($query)==1) { |
|
| 48 | 48 | $data = mysql_fetch_object($query); |
| 49 | 49 | } else { |
| 50 | 50 | die('Data modul tidak ditemukan'); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | <?php if ($id) { |
| 82 | 82 | ?> |
| 83 | 83 | |
| 84 | - <?php if (@$data->aktif == 'Y') { |
|
| 84 | + <?php if (@$data->aktif=='Y') { |
|
| 85 | 85 | ?> |
| 86 | 86 | |
| 87 | 87 | <div class="form-group"> |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $userid = $_SESSION['userid']; |
| 17 | 17 | |
| 18 | 18 | // Hapus modul |
| 19 | - if ($module == 'poli' and $act == 'hapus') { |
|
| 19 | + if ($module=='poli' and $act=='hapus') { |
|
| 20 | 20 | $id = $_GET['id']; |
| 21 | 21 | $id_module = $_GET['id_module']; |
| 22 | 22 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // Input group |
| 36 | - elseif ($module == 'poli' and $act == 'input') { |
|
| 36 | + elseif ($module=='poli' and $act=='input') { |
|
| 37 | 37 | $id_module = $_POST['id_module']; |
| 38 | 38 | |
| 39 | 39 | if ($_POST['ID']) { |