Completed
Push — master ( 598c1e...182b8c )
by Thomas
15:55 queued 08:34
created
htdocs/lib2/imagebmp.inc.php 1 patch
Braces   +129 added lines, -130 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 $IsTransparent=$Transparent!=-1;
37 37
 
38 38
 
39
-if($IsTransparent) $ColorCount--;
39
+if($IsTransparent) {
40
+    $ColorCount--;
41
+}
40 42
 
41 43
 if($ColorCount==0) {$ColorCount=0; $BitCount=24;};
42 44
 if(($ColorCount>0)and($ColorCount<=2)) {$ColorCount=2; $BitCount=1;};
@@ -49,7 +51,9 @@  discard block
 block discarded – undo
49 51
 
50 52
                 $Zbytek=(4-($Width/(8/$BitCount))%4)%4;
51 53
 
52
-                if($BitCount<24) $palsize=pow(2,$BitCount)*4;
54
+                if($BitCount<24) {
55
+                    $palsize=pow(2,$BitCount)*4;
56
+                }
53 57
 
54 58
                 $size=(floor($Width/(8/$BitCount))+$Zbytek)*$Height+54;
55 59
                 $size+=$palsize;
@@ -76,14 +80,16 @@  discard block
 block discarded – undo
76 80
 
77 81
                 $CC=$ColorCount;
78 82
                 $sl1=strlen($ret);
79
-                if($CC==0) $CC=256;
80
-                if($BitCount<24)
81
-                   {
83
+                if($CC==0) {
84
+                    $CC=256;
85
+                }
86
+                if($BitCount<24) {
82 87
                     $ColorTotal=imagecolorstotal($img);
83
-                     if($IsTransparent) $ColorTotal--;
88
+                     if($IsTransparent) {
89
+                         $ColorTotal--;
90
+                     }
84 91
 
85
-                     for($p=0;$p<$ColorTotal;$p++)
86
-                     {
92
+                     for($p=0;$p<$ColorTotal;$p++) {
87 93
                       $color=imagecolorsforindex($img,$p);
88 94
                        $ret.=inttobyte($color["blue"]);
89 95
                        $ret.=inttobyte($color["green"]);
@@ -92,8 +98,7 @@  discard block
 block discarded – undo
92 98
                      };
93 99
 
94 100
                     $CT=$ColorTotal;
95
-                  for($p=$ColorTotal;$p<$CC;$p++)
96
-                       {
101
+                  for($p=$ColorTotal;$p<$CC;$p++) {
97 102
                       $ret.=inttobyte(0);
98 103
                       $ret.=inttobyte(0);
99 104
                       $ret.=inttobyte(0);
@@ -102,75 +107,63 @@  discard block
 block discarded – undo
102 107
                    };
103 108
 
104 109
 
105
-if($BitCount<=8)
106
-{
110
+if($BitCount<=8) {
107 111
 
108
- for($y=$Height-1;$y>=0;$y--)
109
- {
112
+ for($y=$Height-1;$y>=0;$y--) {
110 113
   $bWrite="";
111
-  for($x=0;$x<$Width;$x++)
112
-   {
114
+  for($x=0;$x<$Width;$x++) {
113 115
    $color=imagecolorat($img,$x,$y);
114 116
    $bWrite.=decbinx($color,$BitCount);
115
-   if(strlen($bWrite)==8)
116
-    {
117
+   if(strlen($bWrite)==8) {
117 118
      $retd.=inttobyte(bindec($bWrite));
118 119
      $bWrite="";
119 120
     };
120 121
    };
121 122
 
122
-  if((strlen($bWrite)<8)and(strlen($bWrite)!=0))
123
-    {
123
+  if((strlen($bWrite)<8)and(strlen($bWrite)!=0)) {
124 124
      $sl=strlen($bWrite);
125
-     for($t=0;$t<8-$sl;$t++)
126
-      $sl.="0";
125
+     for($t=0;$t<8-$sl;$t++) {
126
+           $sl.="0";
127
+     }
127 128
      $retd.=inttobyte(bindec($bWrite));
128 129
     };
129
- for($z=0;$z<$Zbytek;$z++)
130
-   $retd.=inttobyte(0);
130
+ for($z=0;$z<$Zbytek;$z++) {
131
+    $retd.=inttobyte(0);
132
+ }
131 133
  };
132 134
 };
133 135
 
134
-if(($RLE==1)and($BitCount==8))
135
-{
136
- for($t=0;$t<strlen($retd);$t+=4)
137
-  {
138
-   if($t!=0)
139
-   if(($t)%$Width==0)
136
+if(($RLE==1)and($BitCount==8)) {
137
+ for($t=0;$t<strlen($retd);$t+=4) {
138
+   if($t!=0) {
139
+      if(($t)%$Width==0)
140 140
     $ret.=chr(0).chr(0);
141
+   }
141 142
 
142
-   if(($t+5)%$Width==0)
143
-   {
143
+   if(($t+5)%$Width==0) {
144 144
      $ret.=chr(0).chr(5).substr($retd,$t,5).chr(0);
145 145
      $t+=1;
146 146
    }
147
-   if(($t+6)%$Width==0)
148
-    {
147
+   if(($t+6)%$Width==0) {
149 148
      $ret.=chr(0).chr(6).substr($retd,$t,6);
150 149
      $t+=2;
151
-    }
152
-    else
153
-    {
150
+    } else {
154 151
      $ret.=chr(0).chr(4).substr($retd,$t,4);
155 152
     };
156 153
   };
157 154
   $ret.=chr(0).chr(1);
158
-}
159
-else
160
-{
155
+} else {
161 156
 $ret.=$retd;
162 157
 };
163 158
 
164 159
 
165
-                if($BitCount==24)
166
-                {
167
-                for($z=0;$z<$Zbytek;$z++)
168
-                 $Dopl.=chr(0);
160
+                if($BitCount==24) {
161
+                for($z=0;$z<$Zbytek;$z++) {
162
+                                 $Dopl.=chr(0);
163
+                }
169 164
 
170
-                for($y=$Height-1;$y>=0;$y--)
171
-                 {
172
-                 for($x=0;$x<$Width;$x++)
173
-                        {
165
+                for($y=$Height-1;$y>=0;$y--) {
166
+                 for($x=0;$x<$Width;$x++) {
174 167
                            $color=imagecolorsforindex($img,ImageColorAt($img,$x,$y));
175 168
                            $ret.=chr($color["blue"]).chr($color["green"]).chr($color["red"]);
176 169
                         }
@@ -179,15 +172,12 @@  discard block
 block discarded – undo
179 172
 
180 173
                  };
181 174
 
182
-  if($file!="")
183
-   {
175
+  if($file!="") {
184 176
     $r=($f=fopen($file,"w"));
185 177
     $r=$r and fwrite($f,$ret);
186 178
     $r=$r and fclose($f);
187 179
     return $r;
188
-   }
189
-  else
190
-  {
180
+   } else {
191 181
    echo $ret;
192 182
   };
193 183
 };
@@ -211,8 +201,7 @@  discard block
 block discarded – undo
211 201
 $f=fopen($file,"r");
212 202
 $Header=fread($f,2);
213 203
 
214
-if($Header=="BM")
215
-{
204
+if($Header=="BM") {
216 205
  $Size=freaddword($f);
217 206
  $Reserved1=freadword($f);
218 207
  $Reserved2=freadword($f);
@@ -230,12 +219,10 @@  discard block
 block discarded – undo
230 219
  $NumberOfPalettesUsed=freaddword($f);
231 220
  $NumberOfImportantColors=freaddword($f);
232 221
 
233
-if($biBitCount<24)
234
- {
222
+if($biBitCount<24) {
235 223
   $img=imagecreate($Width,$Height);
236 224
   $Colors=pow(2,$biBitCount);
237
-  for($p=0;$p<$Colors;$p++)
238
-   {
225
+  for($p=0;$p<$Colors;$p++) {
239 226
     $B=freadbyte($f);
240 227
     $G=freadbyte($f);
241 228
     $R=freadbyte($f);
@@ -246,35 +233,34 @@  discard block
 block discarded – undo
246 233
 
247 234
 
248 235
 
249
-if($RLECompression==0)
250
-{
236
+if($RLECompression==0) {
251 237
    $Zbytek=(4-ceil(($Width/(8/$biBitCount)))%4)%4;
252 238
 
253
-for($y=$Height-1;$y>=0;$y--)
254
-    {
239
+for($y=$Height-1;$y>=0;$y--) {
255 240
      $CurrentBit=0;
256
-     for($x=0;$x<$Width;$x++)
257
-      {
241
+     for($x=0;$x<$Width;$x++) {
258 242
          $C=freadbits($f,$biBitCount);
259 243
        imagesetpixel($img,$x,$y,$Palette[$C]);
260 244
       };
261 245
     if($CurrentBit!=0) {freadbyte($f);};
262
-    for($g=0;$g<$Zbytek;$g++)
263
-     freadbyte($f);
246
+    for($g=0;$g<$Zbytek;$g++) {
247
+         freadbyte($f);
248
+    }
264 249
      };
265 250
 
266 251
  };
267 252
 };
268 253
 
269 254
 
270
-if($RLECompression==1) //$BI_RLE8
255
+if($RLECompression==1) {
256
+    //$BI_RLE8
271 257
 {
272 258
 $y=$Height;
259
+}
273 260
 
274 261
 $pocetb=0;
275 262
 
276
-while(true)
277
-{
263
+while(true) {
278 264
 $y--;
279 265
 $prefix=freadbyte($f);
280 266
 $suffix=freadbyte($f);
@@ -282,33 +268,38 @@  discard block
 block discarded – undo
282 268
 
283 269
 $echoit=false;
284 270
 
285
-if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
286
-if(($prefix==0)and($suffix==1)) break;
287
-if(feof($f)) break;
271
+if($echoit) {
272
+    echo "Prefix: $prefix Suffix: $suffix<BR>";
273
+}
274
+if(($prefix==0)and($suffix==1)) {
275
+    break;
276
+}
277
+if(feof($f)) {
278
+    break;
279
+}
288 280
 
289
-while(!(($prefix==0)and($suffix==0)))
290
-{
291
- if($prefix==0)
292
-  {
281
+while(!(($prefix==0)and($suffix==0))) {
282
+ if($prefix==0) {
293 283
    $pocet=$suffix;
294 284
    $Data.=fread($f,$pocet);
295 285
    $pocetb+=$pocet;
296 286
    if($pocetb%2==1) {freadbyte($f); $pocetb++;};
297 287
   };
298
- if($prefix>0)
299
-  {
288
+ if($prefix>0) {
300 289
    $pocet=$prefix;
301
-   for($r=0;$r<$pocet;$r++)
302
-    $Data.=chr($suffix);
290
+   for($r=0;$r<$pocet;$r++) {
291
+       $Data.=chr($suffix);
292
+   }
303 293
   };
304 294
  $prefix=freadbyte($f);
305 295
  $suffix=freadbyte($f);
306 296
  $pocetb+=2;
307
- if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
308
-};
297
+ if($echoit) {
298
+     echo "Prefix: $prefix Suffix: $suffix<BR>";
299
+ }
300
+ };
309 301
 
310
-for($x=0;$x<strlen($Data);$x++)
311
- {
302
+for($x=0;$x<strlen($Data);$x++) {
312 303
   imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
313 304
  };
314 305
 $Data="";
@@ -318,15 +309,16 @@  discard block
 block discarded – undo
318 309
 };
319 310
 
320 311
 
321
-if($RLECompression==2) //$BI_RLE4
312
+if($RLECompression==2) {
313
+    //$BI_RLE4
322 314
 {
323 315
 $y=$Height;
316
+}
324 317
 $pocetb=0;
325 318
 
326 319
 /*while(!feof($f))
327 320
  echo freadbyte($f)."_".freadbyte($f)."<BR>";*/
328
-while(true)
329
-{
321
+while(true) {
330 322
 //break;
331 323
 $y--;
332 324
 $prefix=freadbyte($f);
@@ -335,35 +327,37 @@  discard block
 block discarded – undo
335 327
 
336 328
 $echoit=false;
337 329
 
338
-if($echoit)echo "Prefix: $prefix Suffix: $suffix<BR>";
339
-if(($prefix==0)and($suffix==1)) break;
340
-if(feof($f)) break;
330
+if($echoit) {
331
+    echo "Prefix: $prefix Suffix: $suffix<BR>";
332
+}
333
+if(($prefix==0)and($suffix==1)) {
334
+    break;
335
+}
336
+if(feof($f)) {
337
+    break;
338
+}
341 339
 
342
-while(!(($prefix==0)and($suffix==0)))
343
-{
344
- if($prefix==0)
345
-  {
340
+while(!(($prefix==0)and($suffix==0))) {
341
+ if($prefix==0) {
346 342
    $pocet=$suffix;
347 343
 
348 344
    $CurrentBit=0;
349
-   for($h=0;$h<$pocet;$h++)
350
-    $Data.=chr(freadbits($f,4));
351
-   if($CurrentBit!=0) freadbits($f,4);
345
+   for($h=0;$h<$pocet;$h++) {
346
+       $Data.=chr(freadbits($f,4));
347
+   }
348
+   if($CurrentBit!=0) {
349
+       freadbits($f,4);
350
+   }
352 351
    $pocetb+=ceil(($pocet/2));
353 352
    if($pocetb%2==1) {freadbyte($f); $pocetb++;};
354 353
   };
355
- if($prefix>0)
356
-  {
354
+ if($prefix>0) {
357 355
    $pocet=$prefix;
358 356
    $i=0;
359
-   for($r=0;$r<$pocet;$r++)
360
-    {
361
-    if($i%2==0)
362
-     {
357
+   for($r=0;$r<$pocet;$r++) {
358
+    if($i%2==0) {
363 359
       $Data.=chr($suffix%16);
364
-     }
365
-     else
366
-     {
360
+     } else {
367 361
       $Data.=chr(floor($suffix/16));
368 362
      };
369 363
     $i++;
@@ -372,11 +366,12 @@  discard block
 block discarded – undo
372 366
  $prefix=freadbyte($f);
373 367
  $suffix=freadbyte($f);
374 368
  $pocetb+=2;
375
- if($echoit) echo "Prefix: $prefix Suffix: $suffix<BR>";
376
-};
369
+ if($echoit) {
370
+     echo "Prefix: $prefix Suffix: $suffix<BR>";
371
+ }
372
+ };
377 373
 
378
-for($x=0;$x<strlen($Data);$x++)
379
- {
374
+for($x=0;$x<strlen($Data);$x++) {
380 375
   imagesetpixel($img,$x,$y,$Palette[ord($Data[$x])]);
381 376
  };
382 377
 $Data="";
@@ -386,24 +381,24 @@  discard block
 block discarded – undo
386 381
 };
387 382
 
388 383
 
389
- if($biBitCount==24)
390
-{
384
+ if($biBitCount==24) {
391 385
  $img=imagecreatetruecolor($Width,$Height);
392 386
  $Zbytek=$Width%4;
393 387
 
394
-   for($y=$Height-1;$y>=0;$y--)
395
-    {
396
-     for($x=0;$x<$Width;$x++)
397
-      {
388
+   for($y=$Height-1;$y>=0;$y--) {
389
+     for($x=0;$x<$Width;$x++) {
398 390
        $B=freadbyte($f);
399 391
        $G=freadbyte($f);
400 392
        $R=freadbyte($f);
401 393
        $color=imagecolorexact($img,$R,$G,$B);
402
-       if($color==-1) $color=imagecolorallocate($img,$R,$G,$B);
394
+       if($color==-1) {
395
+           $color=imagecolorallocate($img,$R,$G,$B);
396
+       }
403 397
        imagesetpixel($img,$x,$y,$color);
404 398
       }
405
-    for($z=0;$z<$Zbytek;$z++)
406
-     freadbyte($f);
399
+    for($z=0;$z<$Zbytek;$z++) {
400
+         freadbyte($f);
401
+    }
407 402
    };
408 403
 };
409 404
 return $img;
@@ -480,12 +475,9 @@  discard block
 block discarded – undo
480 475
  $Byte=freadbyte($f);
481 476
  $LastCBit=$CurrentBit;
482 477
  $CurrentBit+=$count;
483
- if($CurrentBit==8)
484
-  {
478
+ if($CurrentBit==8) {
485 479
    $CurrentBit=0;
486
-  }
487
- else
488
-  {
480
+  } else {
489 481
    fseek($f,ftell($f)-1);
490 482
   };
491 483
  return RetBits($Byte,$LastCBit,$count);
@@ -494,10 +486,16 @@  discard block
 block discarded – undo
494 486
 
495 487
 
496 488
 function RGBToHex($Red,$Green,$Blue)
497
-  {
498
-   $hRed=dechex($Red);if(strlen($hRed)==1) $hRed="0$hRed";
499
-   $hGreen=dechex($Green);if(strlen($hGreen)==1) $hGreen="0$hGreen";
500
-   $hBlue=dechex($Blue);if(strlen($hBlue)==1) $hBlue="0$hBlue";
489
+{
490
+   $hRed=dechex($Red);if(strlen($hRed)==1) {
491
+       $hRed="0$hRed";
492
+   }
493
+   $hGreen=dechex($Green);if(strlen($hGreen)==1) {
494
+       $hGreen="0$hGreen";
495
+   }
496
+   $hBlue=dechex($Blue);if(strlen($hBlue)==1) {
497
+       $hBlue="0$hBlue";
498
+   }
501 499
    return($hRed.$hGreen.$hBlue);
502 500
   };
503 501
 
@@ -520,8 +518,9 @@  discard block
 block discarded – undo
520 518
 {
521 519
 $bin=decbin($d);
522 520
 $sbin=strlen($bin);
523
-for($j=0;$j<$n-$sbin;$j++)
521
+for($j=0;$j<$n-$sbin;$j++) {
524 522
  $bin="0$bin";
523
+}
525 524
 return $bin;
526 525
 };
527 526
 
Please login to merge, or discard this patch.
htdocs/lib2/RSSParser.class.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
                                 // e.g. in SMF Forum Threads
72 72
                             } elseif (!in_array(htmlspecialchars_decode($item->title), $headlines) &&
73 73
                                 strpos($item->title, 'VERSCHOBEN') === false
74
-                            ) { // hack to exclude forum thread-move messages
74
+                            ) {
75
+// hack to exclude forum thread-move messages
75 76
                                 // fill array
76 77
                                 $rss[] = array(
77 78
                                     'pubDate' => date('Y-m-d', strtotime($item->pubDate)),
Please login to merge, or discard this patch.
htdocs/lib2/search/search.map2.inc.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@
 block discarded – undo
67 67
     if (($rBounds = sql_fetch_assoc($rs)) && $rBounds['lat_min'] !== null /* >0 caches */) {
68 68
         if ($rBounds['lat_min'] == $rBounds['lat_max'] &&
69 69
             $rBounds['lon_min'] == $rBounds['lon_max']
70
-        ) { // 1 Cache
70
+        ) {
71
+// 1 Cache
71 72
             $halfwin = 0.02;
72 73
             $rBounds['lat_min'] -= $halfwin;
73 74
             $rBounds['lat_max'] += $halfwin;
Please login to merge, or discard this patch.
htdocs/lib2/logic/cachelist.class.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,8 @@
 block discarded – undo
109 109
                 $this->getUserId(),
110 110
                 $this->getId(),
111 111
                 $name
112
-            )) {// $this->getId() is 0 when creating a new list -> condition has no effect
112
+            )) {
113
+// $this->getId() is 0 when creating a new list -> condition has no effect
113 114
                 return ERROR_DUPLICATE_LISTNAME;
114 115
             } elseif ($visibility >= 2 && strlen($name) < 10) {
115 116
                 return ERROR_BAD_LISTNAME;
Please login to merge, or discard this patch.
htdocs/lib2/logic/data-license.inc.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@
 block discarded – undo
27 27
     $for_cachedesc,
28 28
     $html,
29 29
     $twolines = false
30
-) {
30
+)
31
+{
31 32
     global $opt, $translate;
32 33
 
33 34
     $ltext = "";
Please login to merge, or discard this patch.
htdocs/lib2/logic/user.class.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -509,10 +509,11 @@  discard block
 block discarded – undo
509 509
 
510 510
     public function getStatNotFound()
511 511
     {
512
-        if ($this->reUserStat->exist())
513
-            return $this->reUserStat->getValue('notfound');
514
-        else
515
-            return 0;
512
+        if ($this->reUserStat->exist()) {
513
+                    return $this->reUserStat->getValue('notfound');
514
+        } else {
515
+                    return 0;
516
+        }
516 517
     }
517 518
 
518 519
     public function getStatNote()
@@ -1219,7 +1220,8 @@  discard block
 block discarded – undo
1219 1220
         /*
1220 1221
          * check log or cache
1221 1222
          */
1222
-        if ($object_type == OBJECT_CACHE) {// get filenames of the pictures of $this' caches
1223
+        if ($object_type == OBJECT_CACHE) {
1224
+// get filenames of the pictures of $this' caches
1223 1225
             $rs = sql(
1224 1226
                 "SELECT `pictures`.`url` " .
1225 1227
                 "FROM `pictures`,`caches` " .
@@ -1228,7 +1230,8 @@  discard block
 block discarded – undo
1228 1230
                 OBJECT_CACHE,
1229 1231
                 $this->getUserId()
1230 1232
             );
1231
-        } elseif ($object_type == OBJECT_CACHELOG) {// get filenames of the pictures of $this' logs
1233
+        } elseif ($object_type == OBJECT_CACHELOG) {
1234
+// get filenames of the pictures of $this' logs
1232 1235
             $rs = sql(
1233 1236
                 "SELECT `pictures`.`url` " .
1234 1237
                 "FROM `pictures`,`cache_logs` " .
Please login to merge, or discard this patch.
htdocs/lib2/logic/cracklib.inc.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@
 block discarded – undo
75 75
 
76 76
     // $pw may not contain one of $addwords[]
77 77
     foreach ($wordlist as $v) {
78
-        if (mb_stripos($pw_lc, $v) !== false) {// mb_stripos needs PHP 5.2
78
+        if (mb_stripos($pw_lc, $v) !== false) {
79
+// mb_stripos needs PHP 5.2
79 80
             return false;
80 81
         }
81 82
     }
Please login to merge, or discard this patch.
htdocs/lib2/logic/logtypes.inc.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,8 @@
 block discarded – undo
104 104
             $allowed_logtypes[] = 14;
105 105
         }  // locked, invisible
106 106
     }
107
-    if ($cache_type == 6) { // event
107
+    if ($cache_type == 6) {
108
+// event
108 109
         $allowed_logtypes[] = 8;   // will attend
109 110
         $allowed_logtypes[] = 7;   // attended
110 111
     } else {
Please login to merge, or discard this patch.
htdocs/lib2/Net/IDNA2.php 1 patch
Braces   +36 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2340,7 +2340,9 @@  discard block
 block discarded – undo
2340 2340
         }
2341 2341
 
2342 2342
         // No input, no output, what else did you expect?
2343
-        if (empty($decoded)) return '';
2343
+        if (empty($decoded)) {
2344
+            return '';
2345
+        }
2344 2346
 
2345 2347
         // Anchors for iteration
2346 2348
         $last_begin = 0;
@@ -2429,7 +2431,8 @@  discard block
 block discarded – undo
2429 2431
 
2430 2432
         // Negotiate input and try to determine, wether it is a plain string,
2431 2433
         // an email address or something like a complete URL
2432
-        if (strpos($input, '@')) { // Maybe it is an email address
2434
+        if (strpos($input, '@')) {
2435
+// Maybe it is an email address
2433 2436
             // No no in strict mode
2434 2437
             if ($this->_strict_mode) {
2435 2438
                 throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode');
@@ -2438,10 +2441,13 @@  discard block
 block discarded – undo
2438 2441
             $arr = explode('.', $input);
2439 2442
             foreach ($arr as $k => $v) {
2440 2443
                 $conv = $this->_decode($v);
2441
-                if ($conv) $arr[$k] = $conv;
2444
+                if ($conv) {
2445
+                    $arr[$k] = $conv;
2446
+                }
2442 2447
             }
2443 2448
             $return = $email_pref . '@' . join('.', $arr);
2444
-        } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters)
2449
+        } elseif (preg_match('![:\./]!', $input)) {
2450
+// Or a complete domain name (with or without paths / parameters)
2445 2451
             // No no in strict mode
2446 2452
             if ($this->_strict_mode) {
2447 2453
                 throw new InvalidArgumentException('Only simple domain name parts can be handled in strict mode');
@@ -2452,22 +2458,28 @@  discard block
 block discarded – undo
2452 2458
                 $arr = explode('.', $parsed['host']);
2453 2459
                 foreach ($arr as $k => $v) {
2454 2460
                     $conv = $this->_decode($v);
2455
-                    if ($conv) $arr[$k] = $conv;
2461
+                    if ($conv) {
2462
+                        $arr[$k] = $conv;
2463
+                    }
2456 2464
                 }
2457 2465
                 $parsed['host'] = join('.', $arr);
2458 2466
                 if (isset($parsed['scheme'])) {
2459 2467
                     $parsed['scheme'] .= (strtolower($parsed['scheme']) == 'mailto') ? ':' : '://';
2460 2468
                 }
2461 2469
                 $return = $this->_unparse_url($parsed);
2462
-            } else { // parse_url seems to have failed, try without it
2470
+            } else {
2471
+// parse_url seems to have failed, try without it
2463 2472
                 $arr = explode('.', $input);
2464 2473
                 foreach ($arr as $k => $v) {
2465 2474
                     $conv = $this->_decode($v);
2466
-                    if ($conv) $arr[$k] = $conv;
2475
+                    if ($conv) {
2476
+                        $arr[$k] = $conv;
2477
+                    }
2467 2478
                 }
2468 2479
                 $return = join('.', $arr);
2469 2480
             }
2470
-        } else { // Otherwise we consider it being a pure domain name string
2481
+        } else {
2482
+// Otherwise we consider it being a pure domain name string
2471 2483
             $return = $this->_decode($input);
2472 2484
         }
2473 2485
         // The output is UTF-8 by default, other output formats need conversion here
@@ -3115,7 +3127,8 @@  discard block
 block discarded – undo
3115 3127
         for ($k = 0; $k < $inp_len; ++$k) {
3116 3128
             $v = ord($input{$k}); // Extract byte from input string
3117 3129
 
3118
-            if ($v < 128) { // We found an ASCII char - put into stirng as is
3130
+            if ($v < 128) {
3131
+// We found an ASCII char - put into stirng as is
3119 3132
                 $output[$out_len] = $v;
3120 3133
                 ++$out_len;
3121 3134
                 if ('add' == $mode) {
@@ -3123,23 +3136,29 @@  discard block
 block discarded – undo
3123 3136
                 }
3124 3137
                 continue;
3125 3138
             }
3126
-            if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char
3139
+            if ('next' == $mode) {
3140
+// Try to find the next start byte; determine the width of the Unicode char
3127 3141
                 $start_byte = $v;
3128 3142
                 $mode = 'add';
3129 3143
                 $test = 'range';
3130
-                if ($v >> 5 == 6) { // &110xxxxx 10xxxxx
3144
+                if ($v >> 5 == 6) {
3145
+// &110xxxxx 10xxxxx
3131 3146
                     $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left
3132 3147
                     $v = ($v - 192) << 6;
3133
-                } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx
3148
+                } elseif ($v >> 4 == 14) {
3149
+// &1110xxxx 10xxxxxx 10xxxxxx
3134 3150
                     $next_byte = 1;
3135 3151
                     $v = ($v - 224) << 12;
3136
-                } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
3152
+                } elseif ($v >> 3 == 30) {
3153
+// &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
3137 3154
                     $next_byte = 2;
3138 3155
                     $v = ($v - 240) << 18;
3139
-                } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
3156
+                } elseif ($v >> 2 == 62) {
3157
+// &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
3140 3158
                     $next_byte = 3;
3141 3159
                     $v = ($v - 248) << 24;
3142
-                } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
3160
+                } elseif ($v >> 1 == 126) {
3161
+// &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
3143 3162
                     $next_byte = 4;
3144 3163
                     $v = ($v - 252) << 30;
3145 3164
                 } else {
@@ -3158,7 +3177,8 @@  discard block
 block discarded – undo
3158 3177
                         throw new OutOfRangeException('Bogus UTF-8 character detected (out of legal range) at byte '.$k);
3159 3178
                     }
3160 3179
                 }
3161
-                if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx
3180
+                if ($v >> 6 == 2) {
3181
+// Bit mask must be 10xxxxxx
3162 3182
                     $v = ($v - 128) << ($next_byte * 6);
3163 3183
                     $output[($out_len - 1)] += $v;
3164 3184
                     --$next_byte;
Please login to merge, or discard this patch.