@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | function fnReadDir(&$aReturn, $path) |
48 | 48 | { |
49 | 49 | $rDir = opendir($path); |
50 | - while (($file = readdir($rDir)) !== false) { |
|
51 | - if ($file == '.' || $file == '..' || $file == '.DS_Store') { |
|
50 | + while (($file = readdir($rDir))!==false) { |
|
51 | + if ($file=='.' || $file=='..' || $file=='.DS_Store') { |
|
52 | 52 | continue; |
53 | 53 | } elseif (is_dir($path.'/'.$file)) { |
54 | 54 | fnReadDir($aReturn, $path.'/'.$file); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $aFiles = []; |
64 | 64 | fnReadDir($aFiles, 'tests'); |
65 | 65 | |
66 | - for ($i = 0; $i < count($aFiles); $i++) { |
|
66 | + for ($i = 0; $i<count($aFiles); $i++) { |
|
67 | 67 | $sTemplate; |
68 | 68 | $fp = fopen($aFiles[$i], 'r'); |
69 | 69 | fscanf($fp, '// DATA_TEMPLATE: %s', $sTemplate); |
@@ -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 | ?> |
@@ -2,11 +2,11 @@ discard block |
||
2 | 2 | session_start(); |
3 | 3 | include 'config/koneksi.php'; |
4 | 4 | |
5 | -if ($_SESSION[role] == 'dev') { |
|
5 | +if ($_SESSION[role]=='dev') { |
|
6 | 6 | $sql = mysql_query("select * from modul where aktif='Y' order by urutan"); |
7 | -} elseif ($_SESSION[role] == 'admin') { |
|
7 | +} elseif ($_SESSION[role]=='admin') { |
|
8 | 8 | $sql = mysql_query("select * from modul where status !='dev' and aktif='Y' order by urutan"); |
9 | -} elseif ($_SESSION[role] == 'user') { |
|
9 | +} elseif ($_SESSION[role]=='user') { |
|
10 | 10 | $sql = mysql_query("select * from modul where status='user' and aktif='Y' order by urutan"); |
11 | 11 | } else { |
12 | 12 | $sql = mysql_query("SELECT * FROM modul a inner join usermenu b on a.id_modul = b.id_modul where a.status='user' and a.aktif='Y' and b.m_aktif='Y' and b.username='$_SESSION[id_user]' ORDER BY a.urutan"); |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | //$njml = '('.$cjml.')'; |
24 | 24 | //} |
25 | 25 | |
26 | - if ($r[status_menu] == 'M' and !empty($r[link])) { |
|
27 | - if ($r[nama_modul] == 'Notice') { |
|
26 | + if ($r[status_menu]=='M' and !empty($r[link])) { |
|
27 | + if ($r[nama_modul]=='Notice') { |
|
28 | 28 | echo "<a class='menuitem' href='$r[link]'>$r[nama_modul] $njml</a>"; |
29 | 29 | } else { |
30 | 30 | echo "<a class='menuitem' href='$r[link]'>$r[nama_modul]</a>"; |
31 | 31 | } |
32 | - } elseif ($r[status_menu] == 'M' and empty($r[link])) { |
|
32 | + } elseif ($r[status_menu]=='M' and empty($r[link])) { |
|
33 | 33 | echo "<a class='menuitem submenuheader' href='$r[link]'>$r[nama_modul]</a> "; |
34 | 34 | |
35 | - if ($_SESSION[role] == 'dev' or $_SESSION[role] == 'admin') { |
|
35 | + if ($_SESSION[role]=='dev' or $_SESSION[role]=='admin') { |
|
36 | 36 | $detil = mysql_query("select * from modul where id_submenu='$r[id_modul]' and status_menu='C' and aktif='Y' order by urutan"); |
37 | 37 | } else { |
38 | 38 | $detil = mysql_query("select * from modul where id_submenu='$r[id_modul]' and status_menu='C' and aktif='Y' and (id_role = '5' or id_role = '$_SESSION[role]') and (id_group = '1' or id_group = '$_SESSION[group]')order by urutan"); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $size = (isset($_GET['size']) ? $_GET['size'] : '20'); |
15 | 15 | $orientation = (isset($_GET['orientation']) ? $_GET['orientation'] : 'horizontal'); |
16 | 16 | $code_type = (isset($_GET['codetype']) ? $_GET['codetype'] : 'code128'); |
17 | -$print = (isset($_GET['print']) && $_GET['print'] == 'true' ? true : false); |
|
17 | +$print = (isset($_GET['print']) && $_GET['print']=='true' ? true : false); |
|
18 | 18 | $sizefactor = (isset($_GET['sizefactor']) ? $_GET['sizefactor'] : '1'); |
19 | 19 | |
20 | 20 | // This function call can be copied into your project and can be made from anywhere in your code |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $code_array = [' '=>'212222', '!'=>'222122', '"'=>'222221', '#'=>'121223', '$'=>'121322', '%'=>'131222', '&'=>'122213', "'"=>'122312', '('=>'132212', ')'=>'221213', '*'=>'221312', '+'=>'231212', ','=>'112232', '-'=>'122132', '.'=>'122231', '/'=>'113222', '0'=>'123122', '1'=>'123221', '2'=>'223211', '3'=>'221132', '4'=>'221231', '5'=>'213212', '6'=>'223112', '7'=>'312131', '8'=>'311222', '9'=>'321122', ':'=>'321221', ';'=>'312212', '<'=>'322112', '='=>'322211', '>'=>'212123', '?'=>'212321', '@'=>'232121', 'A'=>'111323', 'B'=>'131123', 'C'=>'131321', 'D'=>'112313', 'E'=>'132113', 'F'=>'132311', 'G'=>'211313', 'H'=>'231113', 'I'=>'231311', 'J'=>'112133', 'K'=>'112331', 'L'=>'132131', 'M'=>'113123', 'N'=>'113321', 'O'=>'133121', 'P'=>'313121', 'Q'=>'211331', 'R'=>'231131', 'S'=>'213113', 'T'=>'213311', 'U'=>'213131', 'V'=>'311123', 'W'=>'311321', 'X'=>'331121', 'Y'=>'312113', 'Z'=>'312311', '['=>'332111', '\\'=>'314111', ']'=>'221411', '^'=>'431111', '_'=>'111224', "\`"=>'111422', 'a'=>'121124', 'b'=>'121421', 'c'=>'141122', 'd'=>'141221', 'e'=>'112214', 'f'=>'112412', 'g'=>'122114', 'h'=>'122411', 'i'=>'142112', 'j'=>'142211', 'k'=>'241211', 'l'=>'221114', 'm'=>'413111', 'n'=>'241112', 'o'=>'134111', 'p'=>'111242', 'q'=>'121142', 'r'=>'121241', 's'=>'114212', 't'=>'124112', 'u'=>'124211', 'v'=>'411212', 'w'=>'421112', 'x'=>'421211', 'y'=>'212141', 'z'=>'214121', '{'=>'412121', '|'=>'111143', '}'=>'111341', '~'=>'131141', 'DEL'=>'114113', 'FNC 3'=>'114311', 'FNC 2'=>'411113', 'SHIFT'=>'411311', 'CODE C'=>'113141', 'FNC 4'=>'114131', 'CODE A'=>'311141', 'FNC 1'=>'411131', 'Start A'=>'211412', 'Start B'=>'211214', 'Start C'=>'211232', 'Stop'=>'2331112']; |
31 | 31 | $code_keys = array_keys($code_array); |
32 | 32 | $code_values = array_flip($code_keys); |
33 | - for ($X = 1; $X <= strlen($text); $X++) { |
|
33 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
34 | 34 | $activeKey = substr($text, ($X - 1), 1); |
35 | 35 | $code_string .= $code_array[$activeKey]; |
36 | 36 | $chksum = ($chksum + ($code_values[$activeKey] * $X)); |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
39 | 39 | |
40 | 40 | $code_string = '211214'.$code_string.'2331112'; |
41 | - } elseif (strtolower($code_type) == 'code128a') { |
|
41 | + } elseif (strtolower($code_type)=='code128a') { |
|
42 | 42 | $chksum = 103; |
43 | 43 | $text = strtoupper($text); // Code 128A doesn't support lower case |
44 | 44 | // Must not change order of array elements as the checksum depends on the array's key to validate final code |
45 | 45 | $code_array = [' '=>'212222', '!'=>'222122', '"'=>'222221', '#'=>'121223', '$'=>'121322', '%'=>'131222', '&'=>'122213', "'"=>'122312', '('=>'132212', ')'=>'221213', '*'=>'221312', '+'=>'231212', ','=>'112232', '-'=>'122132', '.'=>'122231', '/'=>'113222', '0'=>'123122', '1'=>'123221', '2'=>'223211', '3'=>'221132', '4'=>'221231', '5'=>'213212', '6'=>'223112', '7'=>'312131', '8'=>'311222', '9'=>'321122', ':'=>'321221', ';'=>'312212', '<'=>'322112', '='=>'322211', '>'=>'212123', '?'=>'212321', '@'=>'232121', 'A'=>'111323', 'B'=>'131123', 'C'=>'131321', 'D'=>'112313', 'E'=>'132113', 'F'=>'132311', 'G'=>'211313', 'H'=>'231113', 'I'=>'231311', 'J'=>'112133', 'K'=>'112331', 'L'=>'132131', 'M'=>'113123', 'N'=>'113321', 'O'=>'133121', 'P'=>'313121', 'Q'=>'211331', 'R'=>'231131', 'S'=>'213113', 'T'=>'213311', 'U'=>'213131', 'V'=>'311123', 'W'=>'311321', 'X'=>'331121', 'Y'=>'312113', 'Z'=>'312311', '['=>'332111', '\\'=>'314111', ']'=>'221411', '^'=>'431111', '_'=>'111224', 'NUL'=>'111422', 'SOH'=>'121124', 'STX'=>'121421', 'ETX'=>'141122', 'EOT'=>'141221', 'ENQ'=>'112214', 'ACK'=>'112412', 'BEL'=>'122114', 'BS'=>'122411', 'HT'=>'142112', 'LF'=>'142211', 'VT'=>'241211', 'FF'=>'221114', 'CR'=>'413111', 'SO'=>'241112', 'SI'=>'134111', 'DLE'=>'111242', 'DC1'=>'121142', 'DC2'=>'121241', 'DC3'=>'114212', 'DC4'=>'124112', 'NAK'=>'124211', 'SYN'=>'411212', 'ETB'=>'421112', 'CAN'=>'421211', 'EM'=>'212141', 'SUB'=>'214121', 'ESC'=>'412121', 'FS'=>'111143', 'GS'=>'111341', 'RS'=>'131141', 'US'=>'114113', 'FNC 3'=>'114311', 'FNC 2'=>'411113', 'SHIFT'=>'411311', 'CODE C'=>'113141', 'CODE B'=>'114131', 'FNC 4'=>'311141', 'FNC 1'=>'411131', 'Start A'=>'211412', 'Start B'=>'211214', 'Start C'=>'211232', 'Stop'=>'2331112']; |
46 | 46 | $code_keys = array_keys($code_array); |
47 | 47 | $code_values = array_flip($code_keys); |
48 | - for ($X = 1; $X <= strlen($text); $X++) { |
|
48 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
49 | 49 | $activeKey = substr($text, ($X - 1), 1); |
50 | 50 | $code_string .= $code_array[$activeKey]; |
51 | 51 | $chksum = ($chksum + ($code_values[$activeKey] * $X)); |
@@ -53,50 +53,50 @@ discard block |
||
53 | 53 | $code_string .= $code_array[$code_keys[($chksum - (intval($chksum / 103) * 103))]]; |
54 | 54 | |
55 | 55 | $code_string = '211412'.$code_string.'2331112'; |
56 | - } elseif (strtolower($code_type) == 'code39') { |
|
56 | + } elseif (strtolower($code_type)=='code39') { |
|
57 | 57 | $code_array = ['0'=>'111221211', '1'=>'211211112', '2'=>'112211112', '3'=>'212211111', '4'=>'111221112', '5'=>'211221111', '6'=>'112221111', '7'=>'111211212', '8'=>'211211211', '9'=>'112211211', 'A'=>'211112112', 'B'=>'112112112', 'C'=>'212112111', 'D'=>'111122112', 'E'=>'211122111', 'F'=>'112122111', 'G'=>'111112212', 'H'=>'211112211', 'I'=>'112112211', 'J'=>'111122211', 'K'=>'211111122', 'L'=>'112111122', 'M'=>'212111121', 'N'=>'111121122', 'O'=>'211121121', 'P'=>'112121121', 'Q'=>'111111222', 'R'=>'211111221', 'S'=>'112111221', 'T'=>'111121221', 'U'=>'221111112', 'V'=>'122111112', 'W'=>'222111111', 'X'=>'121121112', 'Y'=>'221121111', 'Z'=>'122121111', '-'=>'121111212', '.'=>'221111211', ' '=>'122111211', '$'=>'121212111', '/'=>'121211121', '+'=>'121112121', '%'=>'111212121', '*'=>'121121211']; |
58 | 58 | |
59 | 59 | // Convert to uppercase |
60 | 60 | $upper_text = strtoupper($text); |
61 | 61 | |
62 | - for ($X = 1; $X <= strlen($upper_text); $X++) { |
|
62 | + for ($X = 1; $X<=strlen($upper_text); $X++) { |
|
63 | 63 | $code_string .= $code_array[substr($upper_text, ($X - 1), 1)].'1'; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $code_string = '1211212111'.$code_string.'121121211'; |
67 | - } elseif (strtolower($code_type) == 'code25') { |
|
67 | + } elseif (strtolower($code_type)=='code25') { |
|
68 | 68 | $code_array1 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']; |
69 | 69 | $code_array2 = ['3-1-1-1-3', '1-3-1-1-3', '3-3-1-1-1', '1-1-3-1-3', '3-1-3-1-1', '1-3-3-1-1', '1-1-1-3-3', '3-1-1-3-1', '1-3-1-3-1', '1-1-3-3-1']; |
70 | 70 | |
71 | - for ($X = 1; $X <= strlen($text); $X++) { |
|
72 | - for ($Y = 0; $Y < count($code_array1); $Y++) { |
|
73 | - if (substr($text, ($X - 1), 1) == $code_array1[$Y]) { |
|
71 | + for ($X = 1; $X<=strlen($text); $X++) { |
|
72 | + for ($Y = 0; $Y<count($code_array1); $Y++) { |
|
73 | + if (substr($text, ($X - 1), 1)==$code_array1[$Y]) { |
|
74 | 74 | $temp[$X] = $code_array2[$Y]; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - for ($X = 1; $X <= strlen($text); $X += 2) { |
|
79 | + for ($X = 1; $X<=strlen($text); $X += 2) { |
|
80 | 80 | if (isset($temp[$X]) && isset($temp[($X + 1)])) { |
81 | 81 | $temp1 = explode('-', $temp[$X]); |
82 | 82 | $temp2 = explode('-', $temp[($X + 1)]); |
83 | - for ($Y = 0; $Y < count($temp1); $Y++) { |
|
83 | + for ($Y = 0; $Y<count($temp1); $Y++) { |
|
84 | 84 | $code_string .= $temp1[$Y].$temp2[$Y]; |
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | $code_string = '1111'.$code_string.'311'; |
90 | - } elseif (strtolower($code_type) == 'codabar') { |
|
90 | + } elseif (strtolower($code_type)=='codabar') { |
|
91 | 91 | $code_array1 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '$', ':', '/', '.', '+', 'A', 'B', 'C', 'D']; |
92 | 92 | $code_array2 = ['1111221', '1112112', '2211111', '1121121', '2111121', '1211112', '1211211', '1221111', '2112111', '1111122', '1112211', '1122111', '2111212', '2121112', '2121211', '1121212', '1122121', '1212112', '1112122', '1112221']; |
93 | 93 | |
94 | 94 | // Convert to uppercase |
95 | 95 | $upper_text = strtoupper($text); |
96 | 96 | |
97 | - for ($X = 1; $X <= strlen($upper_text); $X++) { |
|
98 | - for ($Y = 0; $Y < count($code_array1); $Y++) { |
|
99 | - if (substr($upper_text, ($X - 1), 1) == $code_array1[$Y]) { |
|
97 | + for ($X = 1; $X<=strlen($upper_text); $X++) { |
|
98 | + for ($Y = 0; $Y<count($code_array1); $Y++) { |
|
99 | + if (substr($upper_text, ($X - 1), 1)==$code_array1[$Y]) { |
|
100 | 100 | $code_string .= $code_array2[$Y].'1'; |
101 | 101 | } |
102 | 102 | } |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | $text_height = 0; |
113 | 113 | } |
114 | 114 | |
115 | - for ($i = 1; $i <= strlen($code_string); $i++) { |
|
116 | - $code_length = $code_length + (int) (substr($code_string, ($i - 1), 1)); |
|
115 | + for ($i = 1; $i<=strlen($code_string); $i++) { |
|
116 | + $code_length = $code_length + (int)(substr($code_string, ($i - 1), 1)); |
|
117 | 117 | } |
118 | 118 | |
119 | - if (strtolower($orientation) == 'horizontal') { |
|
119 | + if (strtolower($orientation)=='horizontal') { |
|
120 | 120 | $img_width = $code_length * $SizeFactor; |
121 | 121 | $img_height = $size; |
122 | 122 | } else { |
@@ -134,18 +134,18 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | $location = 10; |
137 | - for ($position = 1; $position <= strlen($code_string); $position++) { |
|
137 | + for ($position = 1; $position<=strlen($code_string); $position++) { |
|
138 | 138 | $cur_size = $location + (substr($code_string, ($position - 1), 1)); |
139 | - if (strtolower($orientation) == 'horizontal') { |
|
140 | - imagefilledrectangle($image, $location * $SizeFactor, 0, $cur_size * $SizeFactor, $img_height, ($position % 2 == 0 ? $white : $black)); |
|
139 | + if (strtolower($orientation)=='horizontal') { |
|
140 | + imagefilledrectangle($image, $location * $SizeFactor, 0, $cur_size * $SizeFactor, $img_height, ($position % 2==0 ? $white : $black)); |
|
141 | 141 | } else { |
142 | - imagefilledrectangle($image, 0, $location * $SizeFactor, $img_width, $cur_size * $SizeFactor, ($position % 2 == 0 ? $white : $black)); |
|
142 | + imagefilledrectangle($image, 0, $location * $SizeFactor, $img_width, $cur_size * $SizeFactor, ($position % 2==0 ? $white : $black)); |
|
143 | 143 | } |
144 | 144 | $location = $cur_size; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Draw barcode to the screen or save in a file |
148 | - if ($filepath == '') { |
|
148 | + if ($filepath=='') { |
|
149 | 149 | header('Content-type: image/png'); |
150 | 150 | imagepng($image); |
151 | 151 | imagedestroy($image); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $link_halaman = ''; |
34 | 34 | |
35 | - if (($halaman_aktif - 1) > 0) { |
|
35 | + if (($halaman_aktif - 1)>0) { |
|
36 | 36 | $previous = $halaman_aktif - 1; |
37 | 37 | |
38 | 38 | $link_halaman .= "<a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$previous title=Previous><<</a> "; |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | |
67 | 67 | /// |
68 | 68 | |
69 | - $angka = ($halaman > 3 ? ' ... ' : ' '); |
|
70 | - for ($i = $halaman - 2; $i < $halaman; $i++) { |
|
71 | - if ($i < 1) { |
|
69 | + $angka = ($halaman>3 ? ' ... ' : ' '); |
|
70 | + for ($i = $halaman - 2; $i<$halaman; $i++) { |
|
71 | + if ($i<1) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | $angka .= "<a href=$_SERVER[PHP_SELF]?halaman=$i>$i</A> "; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $angka .= " <b>$halaman</b> "; |
78 | - for ($i = $halaman + 1; $i < ($halaman + 3); $i++) { |
|
79 | - if ($i > $jmlhalaman) { |
|
78 | + for ($i = $halaman + 1; $i<($halaman + 3); $i++) { |
|
79 | + if ($i>$jmlhalaman) { |
|
80 | 80 | break; |
81 | 81 | } |
82 | 82 | $angka .= "<a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$i>$i</A> "; |
83 | 83 | } |
84 | 84 | |
85 | - $angka .= ($halaman + 2 < $jmlhalaman ? " ... |
|
85 | + $angka .= ($halaman + 2<$jmlhalaman ? " ... |
|
86 | 86 | <a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$jmlhalaman>$jmlhalaman</A> " : ' '); |
87 | 87 | |
88 | 88 | echo "$angka"; |
89 | 89 | |
90 | 90 | // Link Next dan Last |
91 | 91 | |
92 | - if ($halaman_aktif < $jmlhalaman) { |
|
92 | + if ($halaman_aktif<$jmlhalaman) { |
|
93 | 93 | $next = $halaman_aktif + 1; |
94 | 94 | |
95 | 95 | $link_halaman .= " <a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$next title=Next>>></a> "; |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | { |
32 | 32 | $vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color, $cmyk); |
33 | 33 | |
34 | - if ($filename === false) { |
|
34 | + if ($filename===false) { |
|
35 | 35 | header('Content-Type: application/postscript'); |
36 | 36 | header('Content-Disposition: filename="qrcode.eps"'); |
37 | 37 | echo $vect; |
38 | 38 | } else { |
39 | - if ($saveandprint === true) { |
|
39 | + if ($saveandprint===true) { |
|
40 | 40 | QRtools::save($vect, $filename); |
41 | 41 | header('Content-Type: application/postscript'); |
42 | 42 | header('Content-Disposition: filename="qrcode.eps"'); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | // Convert the matrix into pixels |
114 | 114 | |
115 | - for ($i = 0; $i < $h; $i++) { |
|
116 | - for ($j = 0; $j < $w; $j++) { |
|
117 | - if ($frame[$i][$j] == '1') { |
|
115 | + for ($i = 0; $i<$h; $i++) { |
|
116 | + for ($j = 0; $j<$w; $j++) { |
|
117 | + if ($frame[$i][$j]=='1') { |
|
118 | 118 | $y = $h - 1 - $i; |
119 | 119 | $x = $j; |
120 | 120 | $output .= $x.' '.$y.' 1 1 F'."\n"; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | { |
133 | 133 | $vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color); |
134 | 134 | |
135 | - if ($filename === false) { |
|
135 | + if ($filename===false) { |
|
136 | 136 | header('Content-Type: image/svg+xml'); |
137 | 137 | //header('Content-Disposition: attachment, filename="qrcode.svg"'); |
138 | 138 | echo $vect; |
139 | 139 | } else { |
140 | - if ($saveandprint === true) { |
|
140 | + if ($saveandprint===true) { |
|
141 | 141 | QRtools::save($vect, $filename); |
142 | 142 | header('Content-Type: image/svg+xml'); |
143 | 143 | //header('Content-Disposition: filename="'.$filename.'"'); |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | |
183 | 183 | // Convert the matrix into pixels |
184 | 184 | |
185 | - for ($i = 0; $i < $h; $i++) { |
|
186 | - for ($j = 0; $j < $w; $j++) { |
|
187 | - if ($frame[$i][$j] == '1') { |
|
185 | + for ($i = 0; $i<$h; $i++) { |
|
186 | + for ($j = 0; $j<$w; $j++) { |
|
187 | + if ($frame[$i][$j]=='1') { |
|
188 | 188 | $y = ($i + $outerFrame) * $pixelPerPoint; |
189 | 189 | $x = ($j + $outerFrame) * $pixelPerPoint; |
190 | 190 | $output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n"; |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | |
50 | 50 | $matrixPointSize = 4; |
51 | 51 | if (isset($_REQUEST['size'])) { |
52 | - $matrixPointSize = min(max((int) $_REQUEST['size'], 1), 10); |
|
52 | + $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (isset($_REQUEST['data'])) { |
56 | 56 | |
57 | 57 | //it's very important! |
58 | - if (trim($_REQUEST['data']) == '') { |
|
58 | + if (trim($_REQUEST['data'])=='') { |
|
59 | 59 | die('data cannot be empty! <a href="?">back</a>'); |
60 | 60 | } |
61 | 61 | |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | echo '<form action="index.php" method="post"> |
77 | 77 | Data: <input name="data" value="'.(isset($_REQUEST['data']) ? htmlspecialchars($_REQUEST['data']) : 'PHP QR Code :)').'" /> |
78 | 78 | ECC: <select name="level"> |
79 | - <option value="L"'.(($errorCorrectionLevel == 'L') ? ' selected' : '').'>L - smallest</option> |
|
80 | - <option value="M"'.(($errorCorrectionLevel == 'M') ? ' selected' : '').'>M</option> |
|
81 | - <option value="Q"'.(($errorCorrectionLevel == 'Q') ? ' selected' : '').'>Q</option> |
|
82 | - <option value="H"'.(($errorCorrectionLevel == 'H') ? ' selected' : '').'>H - best</option> |
|
79 | + <option value="L"'.(($errorCorrectionLevel=='L') ? ' selected' : '').'>L - smallest</option> |
|
80 | + <option value="M"'.(($errorCorrectionLevel=='M') ? ' selected' : '').'>M</option> |
|
81 | + <option value="Q"'.(($errorCorrectionLevel=='Q') ? ' selected' : '').'>Q</option> |
|
82 | + <option value="H"'.(($errorCorrectionLevel=='H') ? ' selected' : '').'>H - best</option> |
|
83 | 83 | </select> |
84 | 84 | Size: <select name="size">'; |
85 | 85 | |
86 | - for ($i = 1; $i <= 10; $i++) { |
|
87 | - echo '<option value="'.$i.'"'.(($matrixPointSize == $i) ? ' selected' : '').'>'.$i.'</option>'; |
|
86 | + for ($i = 1; $i<=10; $i++) { |
|
87 | + echo '<option value="'.$i.'"'.(($matrixPointSize==$i) ? ' selected' : '').'>'.$i.'</option>'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | echo '</select> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->blocks = QRspec::rsBlockNum($spec); |
78 | 78 | |
79 | 79 | $ret = $this->init($spec); |
80 | - if ($ret < 0) { |
|
80 | + if ($ret<0) { |
|
81 | 81 | throw new Exception('block alloc error'); |
82 | 82 | return; |
83 | 83 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $blockNo = 0; |
96 | 96 | $dataPos = 0; |
97 | 97 | $eccPos = 0; |
98 | - for ($i = 0; $i < QRspec::rsBlockNum1($spec); $i++) { |
|
98 | + for ($i = 0; $i<QRspec::rsBlockNum1($spec); $i++) { |
|
99 | 99 | $ecc = array_slice($this->ecccode, $eccPos); |
100 | 100 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
101 | 101 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $blockNo++; |
106 | 106 | } |
107 | 107 | |
108 | - if (QRspec::rsBlockNum2($spec) == 0) { |
|
108 | + if (QRspec::rsBlockNum2($spec)==0) { |
|
109 | 109 | return 0; |
110 | 110 | } |
111 | 111 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $el = QRspec::rsEccCodes2($spec); |
114 | 114 | $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el); |
115 | 115 | |
116 | - if ($rs == null) { |
|
116 | + if ($rs==null) { |
|
117 | 117 | return -1; |
118 | 118 | } |
119 | 119 | |
120 | - for ($i = 0; $i < QRspec::rsBlockNum2($spec); $i++) { |
|
120 | + for ($i = 0; $i<QRspec::rsBlockNum2($spec); $i++) { |
|
121 | 121 | $ecc = array_slice($this->ecccode, $eccPos); |
122 | 122 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
123 | 123 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | { |
136 | 136 | $ret; |
137 | 137 | |
138 | - if ($this->count < $this->dataLength) { |
|
138 | + if ($this->count<$this->dataLength) { |
|
139 | 139 | $row = $this->count % $this->blocks; |
140 | 140 | $col = $this->count / $this->blocks; |
141 | - if ($col >= $this->rsblocks[0]->dataLength) { |
|
141 | + if ($col>=$this->rsblocks[0]->dataLength) { |
|
142 | 142 | $row += $this->b1; |
143 | 143 | } |
144 | 144 | $ret = $this->rsblocks[$row]->data[$col]; |
145 | - } elseif ($this->count < $this->dataLength + $this->eccLength) { |
|
145 | + } elseif ($this->count<$this->dataLength + $this->eccLength) { |
|
146 | 146 | $row = ($this->count - $this->dataLength) % $this->blocks; |
147 | 147 | $col = ($this->count - $this->dataLength) / $this->blocks; |
148 | 148 | $ret = $this->rsblocks[$row]->ecc[$col]; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | //---------------------------------------------------------------------- |
167 | 167 | public function encodeMask(QRinput $input, $mask) |
168 | 168 | { |
169 | - if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) { |
|
169 | + if ($input->getVersion()<0 || $input->getVersion()>QRSPEC_VERSION_MAX) { |
|
170 | 170 | throw new Exception('wrong version'); |
171 | 171 | } |
172 | - if ($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) { |
|
172 | + if ($input->getErrorCorrectionLevel()>QR_ECLEVEL_H) { |
|
173 | 173 | throw new Exception('wrong level'); |
174 | 174 | } |
175 | 175 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | // inteleaved data and ecc codes |
190 | - for ($i = 0; $i < $raw->dataLength + $raw->eccLength; $i++) { |
|
190 | + for ($i = 0; $i<$raw->dataLength + $raw->eccLength; $i++) { |
|
191 | 191 | $code = $raw->getCode(); |
192 | 192 | $bit = 0x80; |
193 | - for ($j = 0; $j < 8; $j++) { |
|
193 | + for ($j = 0; $j<8; $j++) { |
|
194 | 194 | $addr = $filler->next(); |
195 | - $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0)); |
|
195 | + $filler->setFrameAt($addr, 0x02 | (($bit & $code)!=0)); |
|
196 | 196 | $bit = $bit >> 1; |
197 | 197 | } |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | // remainder bits |
205 | 205 | $j = QRspec::getRemainder($version); |
206 | - for ($i = 0; $i < $j; $i++) { |
|
206 | + for ($i = 0; $i<$j; $i++) { |
|
207 | 207 | $addr = $filler->next(); |
208 | 208 | $filler->setFrameAt($addr, 0x02); |
209 | 209 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | // masking |
215 | 215 | $maskObj = new QRmask(); |
216 | - if ($mask < 0) { |
|
216 | + if ($mask<0) { |
|
217 | 217 | if (QR_FIND_BEST_MASK) { |
218 | 218 | $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel()); |
219 | 219 | } else { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel()); |
224 | 224 | } |
225 | 225 | |
226 | - if ($masked == null) { |
|
226 | + if ($masked==null) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | //---------------------------------------------------------------------- |
246 | 246 | public function encodeString8bit($string, $version, $level) |
247 | 247 | { |
248 | - if (string == null) { |
|
248 | + if (string==null) { |
|
249 | 249 | throw new Exception('empty string!'); |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | 253 | $input = new QRinput($version, $level); |
254 | - if ($input == null) { |
|
254 | + if ($input==null) { |
|
255 | 255 | return; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); |
259 | - if ($ret < 0) { |
|
259 | + if ($ret<0) { |
|
260 | 260 | unset($input); |
261 | 261 | |
262 | 262 | return; |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | //---------------------------------------------------------------------- |
269 | 269 | public function encodeString($string, $version, $level, $hint, $casesensitive) |
270 | 270 | { |
271 | - if ($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) { |
|
271 | + if ($hint!=QR_MODE_8 && $hint!=QR_MODE_KANJI) { |
|
272 | 272 | throw new Exception('bad hint'); |
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | $input = new QRinput($version, $level); |
277 | - if ($input == null) { |
|
277 | + if ($input==null) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | 281 | $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive); |
282 | - if ($ret < 0) { |
|
282 | + if ($ret<0) { |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | public function next() |
366 | 366 | { |
367 | 367 | do { |
368 | - if ($this->bit == -1) { |
|
368 | + if ($this->bit==-1) { |
|
369 | 369 | $this->bit = 0; |
370 | 370 | |
371 | 371 | return ['x'=>$this->x, 'y'=>$this->y]; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $y = $this->y; |
376 | 376 | $w = $this->width; |
377 | 377 | |
378 | - if ($this->bit == 0) { |
|
378 | + if ($this->bit==0) { |
|
379 | 379 | $x--; |
380 | 380 | $this->bit++; |
381 | 381 | } else { |
@@ -384,28 +384,28 @@ discard block |
||
384 | 384 | $this->bit--; |
385 | 385 | } |
386 | 386 | |
387 | - if ($this->dir < 0) { |
|
388 | - if ($y < 0) { |
|
387 | + if ($this->dir<0) { |
|
388 | + if ($y<0) { |
|
389 | 389 | $y = 0; |
390 | 390 | $x -= 2; |
391 | 391 | $this->dir = 1; |
392 | - if ($x == 6) { |
|
392 | + if ($x==6) { |
|
393 | 393 | $x--; |
394 | 394 | $y = 9; |
395 | 395 | } |
396 | 396 | } |
397 | 397 | } else { |
398 | - if ($y == $w) { |
|
398 | + if ($y==$w) { |
|
399 | 399 | $y = $w - 1; |
400 | 400 | $x -= 2; |
401 | 401 | $this->dir = -1; |
402 | - if ($x == 6) { |
|
402 | + if ($x==6) { |
|
403 | 403 | $x--; |
404 | 404 | $y -= 8; |
405 | 405 | } |
406 | 406 | } |
407 | 407 | } |
408 | - if ($x < 0 || $y < 0) { |
|
408 | + if ($x<0 || $y<0) { |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | QRtools::markTime('after_encode'); |
502 | 502 | |
503 | - if ($outfile !== false) { |
|
503 | + if ($outfile!==false) { |
|
504 | 504 | file_put_contents($outfile, implode("\n", QRtools::binarize($code->data))); |
505 | 505 | } else { |
506 | 506 | return QRtools::binarize($code->data); |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | $err = ob_get_contents(); |
517 | 517 | ob_end_clean(); |
518 | 518 | |
519 | - if ($err != '') { |
|
519 | + if ($err!='') { |
|
520 | 520 | QRtools::log($outfile, $err); |
521 | 521 | } |
522 | 522 | |
523 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
523 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
524 | 524 | |
525 | 525 | QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
526 | 526 | } catch (Exception $e) { |
@@ -537,11 +537,11 @@ discard block |
||
537 | 537 | $err = ob_get_contents(); |
538 | 538 | ob_end_clean(); |
539 | 539 | |
540 | - if ($err != '') { |
|
540 | + if ($err!='') { |
|
541 | 541 | QRtools::log($outfile, $err); |
542 | 542 | } |
543 | 543 | |
544 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
544 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
545 | 545 | |
546 | 546 | QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color, $this->cmyk); |
547 | 547 | } catch (Exception $e) { |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | $err = ob_get_contents(); |
559 | 559 | ob_end_clean(); |
560 | 560 | |
561 | - if ($err != '') { |
|
561 | + if ($err!='') { |
|
562 | 562 | QRtools::log($outfile, $err); |
563 | 563 | } |
564 | 564 | |
565 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
565 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
566 | 566 | |
567 | 567 | QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
568 | 568 | } catch (Exception $e) { |