@@ -43,10 +43,11 @@ discard block |
||
| 43 | 43 | || $link->getAttribute("rel") == "standout")) { |
| 44 | 44 | $base = $this->xpath->evaluate("string(ancestor-or-self::*[@xml:base][1]/@xml:base)", $link); |
| 45 | 45 | |
| 46 | - if ($base) |
|
| 47 | - return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
| 48 | - else |
|
| 49 | - return clean(trim($link->getAttribute("href"))); |
|
| 46 | + if ($base) { |
|
| 47 | + return rewrite_relative_url($base, clean(trim($link->getAttribute("href")))); |
|
| 48 | + } else { |
|
| 49 | + return clean(trim($link->getAttribute("href"))); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | } |
| 52 | 53 | } |
@@ -106,8 +107,9 @@ discard block |
||
| 106 | 107 | $cats = []; |
| 107 | 108 | |
| 108 | 109 | foreach ($categories as $cat) { |
| 109 | - if ($cat->hasAttribute("term")) |
|
| 110 | - array_push($cats, $cat->getAttribute("term")); |
|
| 110 | + if ($cat->hasAttribute("term")) { |
|
| 111 | + array_push($cats, $cat->getAttribute("term")); |
|
| 112 | + } |
|
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | $categories = $this->xpath->query("dc:subject", $this->elem); |
@@ -95,10 +95,11 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $count = getFeedUnread($i); |
| 97 | 97 | |
| 98 | - if ($i == 0 || $i == -1 || $i == -2) |
|
| 99 | - $auxctr = Feeds::getFeedArticles($i, false); |
|
| 100 | - else |
|
| 101 | - $auxctr = 0; |
|
| 98 | + if ($i == 0 || $i == -1 || $i == -2) { |
|
| 99 | + $auxctr = Feeds::getFeedArticles($i, false); |
|
| 100 | + } else { |
|
| 101 | + $auxctr = 0; |
|
| 102 | + } |
|
| 102 | 103 | |
| 103 | 104 | $cv = array("id" => $i, |
| 104 | 105 | "counter" => (int) $count, |
@@ -117,8 +118,9 @@ discard block |
||
| 117 | 118 | $cv = array("id" => PluginHost::pfeed_to_feed_id($feed['id']), |
| 118 | 119 | "counter" => $feed['sender']->get_unread($feed['id'])); |
| 119 | 120 | |
| 120 | - if (method_exists($feed['sender'], 'get_total')) |
|
| 121 | - $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
| 121 | + if (method_exists($feed['sender'], 'get_total')) { |
|
| 122 | + $cv["auxcounter"] = $feed['sender']->get_total($feed['id']); |
|
| 123 | + } |
|
| 122 | 124 | |
| 123 | 125 | array_push($ret_arr, $cv); |
| 124 | 126 | } |
@@ -150,8 +152,9 @@ discard block |
||
| 150 | 152 | "counter" => (int) $line["unread"], |
| 151 | 153 | "auxcounter" => (int) $line["total"]); |
| 152 | 154 | |
| 153 | - if ($descriptions) |
|
| 154 | - $cv["description"] = $line["caption"]; |
|
| 155 | + if ($descriptions) { |
|
| 156 | + $cv["description"] = $line["caption"]; |
|
| 157 | + } |
|
| 155 | 158 | |
| 156 | 159 | array_push($ret_arr, $cv); |
| 157 | 160 | } |
@@ -189,22 +192,25 @@ discard block |
||
| 189 | 192 | $has_img = false; |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | - if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) |
|
| 193 | - $last_updated = ''; |
|
| 195 | + if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2) { |
|
| 196 | + $last_updated = ''; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | $cv = array("id" => $id, |
| 196 | 200 | "updated" => $last_updated, |
| 197 | 201 | "counter" => (int) $count, |
| 198 | 202 | "has_img" => (int) $has_img); |
| 199 | 203 | |
| 200 | - if ($last_error) |
|
| 201 | - $cv["error"] = $last_error; |
|
| 204 | + if ($last_error) { |
|
| 205 | + $cv["error"] = $last_error; |
|
| 206 | + } |
|
| 202 | 207 | |
| 203 | 208 | // if (get_pref('EXTENDED_FEEDLIST')) |
| 204 | 209 | // $cv["xmsg"] = getFeedArticles($id)." ".__("total"); |
| 205 | 210 | |
| 206 | - if ($active_feed && $id == $active_feed) |
|
| 207 | - $cv["title"] = truncate_string($line["title"], 30); |
|
| 211 | + if ($active_feed && $id == $active_feed) { |
|
| 212 | + $cv["title"] = truncate_string($line["title"], 30); |
|
| 213 | + } |
|
| 208 | 214 | |
| 209 | 215 | array_push($ret_arr, $cv); |
| 210 | 216 | |
@@ -43,10 +43,11 @@ |
||
| 43 | 43 | foreach ($lines as $line) { |
| 44 | 44 | if (strpos($line, "--") !== 0 && $line) { |
| 45 | 45 | |
| 46 | - if ($html_output) |
|
| 47 | - print "<pre>$line</pre>"; |
|
| 48 | - else |
|
| 49 | - Debug::log("> $line"); |
|
| 46 | + if ($html_output) { |
|
| 47 | + print "<pre>$line</pre>"; |
|
| 48 | + } else { |
|
| 49 | + Debug::log("> $line"); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | try { |
| 52 | 53 | $this->pdo->query($line); // PDO returns errors as exceptions now |
@@ -24,13 +24,15 @@ discard block |
||
| 24 | 24 | $r = ord($str[2]); |
| 25 | 25 | if (strlen($str) > 3) { |
| 26 | 26 | $a = 127 - (ord($str[3]) / 2); |
| 27 | - if ($a != 0 && $a != 127) |
|
| 28 | - $this->had_alpha = 1; |
|
| 27 | + if ($a != 0 && $a != 127) { |
|
| 28 | + $this->had_alpha = 1; |
|
| 29 | + } |
|
| 29 | 30 | } else { |
| 30 | 31 | $a = 0; |
| 31 | 32 | } |
| 32 | - if ($a != 127) |
|
| 33 | - $this->all_transaprent = 0; |
|
| 33 | + if ($a != 127) { |
|
| 34 | + $this->all_transaprent = 0; |
|
| 35 | + } |
|
| 34 | 36 | return imagecolorallocatealpha($img, $r, $g, $b, $a); |
| 35 | 37 | } |
| 36 | 38 | |
@@ -65,8 +67,9 @@ discard block |
||
| 65 | 67 | $most_pixels = 0; |
| 66 | 68 | for ($i = 0; $i < $h["num"]; $i++) { |
| 67 | 69 | $entry = substr($ico, 6 + 16 * $i, 16); |
| 68 | - if (!$entry || strlen($entry) < 16) |
|
| 69 | - continue; |
|
| 70 | + if (!$entry || strlen($entry) < 16) { |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 70 | 73 | $e = unpack("Cwidth/" . |
| 71 | 74 | "Cheight/" . |
| 72 | 75 | "Ccolors/" . |
@@ -76,10 +79,12 @@ discard block |
||
| 76 | 79 | "Vsize/" . |
| 77 | 80 | "Voffset/", |
| 78 | 81 | $entry); |
| 79 | - if ($e["width"] == 0) |
|
| 80 | - $e["width"] = 256; |
|
| 81 | - if ($e["height"] == 0) |
|
| 82 | - $e["height"] = 256; |
|
| 82 | + if ($e["width"] == 0) { |
|
| 83 | + $e["width"] = 256; |
|
| 84 | + } |
|
| 85 | + if ($e["height"] == 0) { |
|
| 86 | + $e["height"] = 256; |
|
| 87 | + } |
|
| 83 | 88 | if ($e["zero"] != 0) { |
| 84 | 89 | $this->error = "nonzero reserved field"; |
| 85 | 90 | return false; |
@@ -226,8 +231,9 @@ discard block |
||
| 226 | 231 | } |
| 227 | 232 | } |
| 228 | 233 | // End of row padding |
| 229 | - while ($offset & 3) |
|
| 230 | - $offset++; |
|
| 234 | + while ($offset & 3) { |
|
| 235 | + $offset++; |
|
| 236 | + } |
|
| 231 | 237 | } |
| 232 | 238 | |
| 233 | 239 | // Now the "AND" image, which is 1 bit per pixel. Ignore |
@@ -261,8 +267,9 @@ discard block |
||
| 261 | 267 | } |
| 262 | 268 | |
| 263 | 269 | // End of row padding |
| 264 | - while ($offset & 3) |
|
| 265 | - $offset++; |
|
| 270 | + while ($offset & 3) { |
|
| 271 | + $offset++; |
|
| 272 | + } |
|
| 266 | 273 | } |
| 267 | 274 | return $img; |
| 268 | 275 | } |
@@ -108,13 +108,15 @@ discard block |
||
| 108 | 108 | //---------------------------------------------------------------------- |
| 109 | 109 | public function appendNum($bits, $num) |
| 110 | 110 | {
|
| 111 | - if ($bits == 0) |
|
| 112 | - return 0; |
|
| 111 | + if ($bits == 0) { |
|
| 112 | + return 0; |
|
| 113 | + } |
|
| 113 | 114 | |
| 114 | 115 | $b = QRbitstream::newFromNum($bits, $num); |
| 115 | 116 | |
| 116 | - if(is_null($b)) |
|
| 117 | - return -1; |
|
| 117 | + if(is_null($b)) { |
|
| 118 | + return -1; |
|
| 119 | + } |
|
| 118 | 120 | |
| 119 | 121 | $ret = $this->append($b); |
| 120 | 122 | unset($b); |
@@ -125,13 +127,15 @@ discard block |
||
| 125 | 127 | //---------------------------------------------------------------------- |
| 126 | 128 | public function appendBytes($size, $data) |
| 127 | 129 | {
|
| 128 | - if ($size == 0) |
|
| 129 | - return 0; |
|
| 130 | + if ($size == 0) { |
|
| 131 | + return 0; |
|
| 132 | + } |
|
| 130 | 133 | |
| 131 | 134 | $b = QRbitstream::newFromBytes($size, $data); |
| 132 | 135 | |
| 133 | - if(is_null($b)) |
|
| 134 | - return -1; |
|
| 136 | + if(is_null($b)) { |
|
| 137 | + return -1; |
|
| 138 | + } |
|
| 135 | 139 | |
| 136 | 140 | $ret = $this->append($b); |
| 137 | 141 | unset($b); |
@@ -115,8 +115,9 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
|
| 117 | 117 | $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level]; |
| 118 | - if($words >= $size) |
|
| 119 | - return $i; |
|
| 118 | + if($words >= $size) { |
|
| 119 | + return $i; |
|
| 120 | + } |
|
| 120 | 121 | } |
| 121 | 122 | |
| 122 | 123 | return -1; |
@@ -134,8 +135,9 @@ discard block |
||
| 134 | 135 | //---------------------------------------------------------------------- |
| 135 | 136 | public static function lengthIndicator($mode, $version) |
| 136 | 137 | {
|
| 137 | - if ($mode == QR_MODE_STRUCTURE) |
|
| 138 | - return 0; |
|
| 138 | + if ($mode == QR_MODE_STRUCTURE) { |
|
| 139 | + return 0; |
|
| 140 | + } |
|
| 139 | 141 | |
| 140 | 142 | if ($version <= 9) {
|
| 141 | 143 | $l = 0; |
@@ -151,8 +153,9 @@ discard block |
||
| 151 | 153 | //---------------------------------------------------------------------- |
| 152 | 154 | public static function maximumWords($mode, $version) |
| 153 | 155 | {
|
| 154 | - if($mode == QR_MODE_STRUCTURE) |
|
| 155 | - return 3; |
|
| 156 | + if($mode == QR_MODE_STRUCTURE) { |
|
| 157 | + return 3; |
|
| 158 | + } |
|
| 156 | 159 | |
| 157 | 160 | if($version <= 9) {
|
| 158 | 161 | $l = 0; |
@@ -298,8 +301,9 @@ discard block |
||
| 298 | 301 | //---------------------------------------------------------------------- |
| 299 | 302 | public static function putAlignmentPattern($version, &$frame, $width) |
| 300 | 303 | {
|
| 301 | - if($version < 2) |
|
| 302 | - return; |
|
| 304 | + if($version < 2) { |
|
| 305 | + return; |
|
| 306 | + } |
|
| 303 | 307 | |
| 304 | 308 | $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0]; |
| 305 | 309 | if($d < 0) {
|
@@ -351,8 +355,9 @@ discard block |
||
| 351 | 355 | //---------------------------------------------------------------------- |
| 352 | 356 | public static function getVersionPattern($version) |
| 353 | 357 | {
|
| 354 | - if($version < 7 || $version > QRSPEC_VERSION_MAX) |
|
| 355 | - return 0; |
|
| 358 | + if($version < 7 || $version > QRSPEC_VERSION_MAX) { |
|
| 359 | + return 0; |
|
| 360 | + } |
|
| 356 | 361 | |
| 357 | 362 | return self::$versionPattern[$version -7]; |
| 358 | 363 | } |
@@ -369,11 +374,13 @@ discard block |
||
| 369 | 374 | |
| 370 | 375 | public static function getFormatInfo($mask, $level) |
| 371 | 376 | {
|
| 372 | - if($mask < 0 || $mask > 7) |
|
| 373 | - return 0; |
|
| 377 | + if($mask < 0 || $mask > 7) { |
|
| 378 | + return 0; |
|
| 379 | + } |
|
| 374 | 380 | |
| 375 | - if($level < 0 || $level > 3) |
|
| 376 | - return 0; |
|
| 381 | + if($level < 0 || $level > 3) { |
|
| 382 | + return 0; |
|
| 383 | + } |
|
| 377 | 384 | |
| 378 | 385 | return self::$formatInfo[$level][$mask]; |
| 379 | 386 | } |
@@ -553,8 +560,9 @@ discard block |
||
| 553 | 560 | //---------------------------------------------------------------------- |
| 554 | 561 | public static function newFrame($version) |
| 555 | 562 | {
|
| 556 | - if($version < 1 || $version > QRSPEC_VERSION_MAX) |
|
| 557 | - return null; |
|
| 563 | + if($version < 1 || $version > QRSPEC_VERSION_MAX) { |
|
| 564 | + return null; |
|
| 565 | + } |
|
| 558 | 566 | |
| 559 | 567 | if(!isset(self::$frames[$version])) {
|
| 560 | 568 | |
@@ -572,8 +580,9 @@ discard block |
||
| 572 | 580 | } |
| 573 | 581 | } |
| 574 | 582 | |
| 575 | - if(is_null(self::$frames[$version])) |
|
| 576 | - return null; |
|
| 583 | + if(is_null(self::$frames[$version])) { |
|
| 584 | + return null; |
|
| 585 | + } |
|
| 577 | 586 | |
| 578 | 587 | return self::$frames[$version]; |
| 579 | 588 | } |
@@ -119,8 +119,9 @@ discard block |
||
| 119 | 119 | {
|
| 120 | 120 | $codeArr = array(); |
| 121 | 121 | |
| 122 | - foreach ($bitFrame as $line) |
|
| 123 | - $codeArr[] = join('', $line);
|
|
| 122 | + foreach ($bitFrame as $line) { |
|
| 123 | + $codeArr[] = join('', $line); |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | return gzcompress(join("\n", $codeArr), 9);
|
| 126 | 127 | } |
@@ -131,8 +132,9 @@ discard block |
||
| 131 | 132 | $codeArr = array(); |
| 132 | 133 | |
| 133 | 134 | $codeLines = explode("\n", gzuncompress($code));
|
| 134 | - foreach ($codeLines as $line) |
|
| 135 | - $codeArr[] = str_split($line); |
|
| 135 | + foreach ($codeLines as $line) { |
|
| 136 | + $codeArr[] = str_split($line); |
|
| 137 | + } |
|
| 136 | 138 | |
| 137 | 139 | return $codeArr; |
| 138 | 140 | } |
@@ -150,16 +152,18 @@ discard block |
||
| 150 | 152 | $bitMask = self::unserial(file_get_contents($fileName)); |
| 151 | 153 | } else {
|
| 152 | 154 | $bitMask = $this->generateMaskNo($maskNo, $width, $s); |
| 153 | - if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo)) |
|
| 154 | - mkdir(QR_CACHE_DIR.'mask_'.$maskNo); |
|
| 155 | + if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo)) { |
|
| 156 | + mkdir(QR_CACHE_DIR.'mask_'.$maskNo); |
|
| 157 | + } |
|
| 155 | 158 | file_put_contents($fileName, self::serial($bitMask)); |
| 156 | 159 | } |
| 157 | 160 | } else {
|
| 158 | 161 | $bitMask = $this->generateMaskNo($maskNo, $width, $s); |
| 159 | 162 | } |
| 160 | 163 | |
| 161 | - if ($maskGenOnly) |
|
| 162 | - return; |
|
| 164 | + if ($maskGenOnly) { |
|
| 165 | + return; |
|
| 166 | + } |
|
| 163 | 167 | |
| 164 | 168 | $d = $s; |
| 165 | 169 | |
@@ -226,8 +230,9 @@ discard block |
||
| 226 | 230 | |
| 227 | 231 | $frameY = $frame[$y]; |
| 228 | 232 | |
| 229 | - if ($y>0) |
|
| 230 | - $frameYM = $frame[$y-1]; |
|
| 233 | + if ($y>0) { |
|
| 234 | + $frameYM = $frame[$y-1]; |
|
| 235 | + } |
|
| 231 | 236 | |
| 232 | 237 | for($x=0; $x<$width; $x++) {
|
| 233 | 238 | if(($x > 0) && ($y > 0)) {
|
@@ -33,8 +33,9 @@ discard block |
||
| 33 | 33 | include "qrlib.php"; |
| 34 | 34 | |
| 35 | 35 | //ofcourse we need rights to create temp dir |
| 36 | - if (!file_exists($PNG_TEMP_DIR)) |
|
| 37 | - mkdir($PNG_TEMP_DIR); |
|
| 36 | + if (!file_exists($PNG_TEMP_DIR)) { |
|
| 37 | + mkdir($PNG_TEMP_DIR); |
|
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | |
| 40 | 41 | $filename = $PNG_TEMP_DIR.'test.png'; |
@@ -42,19 +43,22 @@ discard block |
||
| 42 | 43 | //processing form input |
| 43 | 44 | //remember to sanitize user input in real-life solution !!! |
| 44 | 45 | $errorCorrectionLevel = 'L'; |
| 45 | - if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
|
|
| 46 | - $errorCorrectionLevel = $_REQUEST['level']; |
|
| 46 | + if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H'))) { |
|
| 47 | + $errorCorrectionLevel = $_REQUEST['level']; |
|
| 48 | + } |
|
| 47 | 49 | |
| 48 | 50 | $matrixPointSize = 4; |
| 49 | - if (isset($_REQUEST['size'])) |
|
| 50 | - $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); |
|
| 51 | + if (isset($_REQUEST['size'])) { |
|
| 52 | + $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); |
|
| 53 | + } |
|
| 51 | 54 | |
| 52 | 55 | |
| 53 | 56 | if (isset($_REQUEST['data'])) {
|
| 54 | 57 | |
| 55 | 58 | //it's very important! |
| 56 | - if (trim($_REQUEST['data']) == '') |
|
| 57 | - die('data cannot be empty! <a href="?">back</a>');
|
|
| 59 | + if (trim($_REQUEST['data']) == '') { |
|
| 60 | + die('data cannot be empty! <a href="?">back</a>'); |
|
| 61 | + } |
|
| 58 | 62 | |
| 59 | 63 | // user data |
| 60 | 64 | $filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png'; |
@@ -82,8 +86,9 @@ discard block |
||
| 82 | 86 | </select> |
| 83 | 87 | Size: <select name="size">'; |
| 84 | 88 | |
| 85 | - for($i=1;$i<=10;$i++) |
|
| 86 | - echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>'; |
|
| 89 | + for($i=1;$i<=10;$i++) { |
|
| 90 | + echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>'; |
|
| 91 | + } |
|
| 87 | 92 | |
| 88 | 93 | echo '</select> |
| 89 | 94 | <input type="submit" value="GENERATE"></form><hr/>'; |
@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | {
|
| 44 | 44 | $barcode_array = array(); |
| 45 | 45 | |
| 46 | - if (!is_array($mode)) |
|
| 47 | - $mode = explode(',', $mode);
|
|
| 46 | + if (!is_array($mode)) { |
|
| 47 | + $mode = explode(',', $mode); |
|
| 48 | + } |
|
| 48 | 49 | |
| 49 | 50 | $eccLevel = 'L'; |
| 50 | 51 | |
@@ -61,8 +62,9 @@ discard block |
||
| 61 | 62 | |
| 62 | 63 | foreach ($qrTab as $line) {
|
| 63 | 64 | $arrAdd = array(); |
| 64 | - foreach(str_split($line) as $char) |
|
| 65 | - $arrAdd[] = ($char=='1')?1:0; |
|
| 65 | + foreach(str_split($line) as $char) { |
|
| 66 | + $arrAdd[] = ($char=='1')?1:0; |
|
| 67 | + } |
|
| 66 | 68 | $barcode_array['bcode'][] = $arrAdd; |
| 67 | 69 | } |
| 68 | 70 | |
@@ -90,8 +92,9 @@ discard block |
||
| 90 | 92 | |
| 91 | 93 | $width = count($frame); |
| 92 | 94 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
| 93 | - for ($maskNo=0; $maskNo<8; $maskNo++) |
|
| 94 | - $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); |
|
| 95 | + for ($maskNo=0; $maskNo<8; $maskNo++) { |
|
| 96 | + $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true); |
|
| 97 | + } |
|
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | QRtools::markTime('after_build_cache');
|
@@ -128,8 +131,9 @@ discard block |
||
| 128 | 131 | list($usec, $sec) = explode(" ", microtime());
|
| 129 | 132 | $time = ((float)$usec + (float)$sec); |
| 130 | 133 | |
| 131 | - if (!isset($GLOBALS['qr_time_bench'])) |
|
| 132 | - $GLOBALS['qr_time_bench'] = array(); |
|
| 134 | + if (!isset($GLOBALS['qr_time_bench'])) { |
|
| 135 | + $GLOBALS['qr_time_bench'] = array(); |
|
| 136 | + } |
|
| 133 | 137 | |
| 134 | 138 | $GLOBALS['qr_time_bench'][$markerId] = $time; |
| 135 | 139 | } |