GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#1976)
by
unknown
10:37
created
tools/minify/cssmin/CSSmin.php 3 patches
Doc Comments   +11 added lines, -2 removed lines patch added patch discarded remove patch
@@ -606,6 +606,11 @@  discard block
 block discarded – undo
606 606
  * ---------------------------------------------------------------------------------------------
607 607
  */
608 608
 
609
+/**
610
+ * @param double $v1
611
+ * @param double $v2
612
+ * @param integer $vh
613
+ */
609 614
 private function hue_to_rgb($v1, $v2, $vh)
610 615
 {
611 616
 	$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
@@ -620,6 +625,10 @@  discard block
 block discarded – undo
620 625
 	return intval(floor(floatval($n) + 0.5), 10);
621 626
 }
622 627
 
628
+/**
629
+ * @param integer $min
630
+ * @param integer $max
631
+ */
623 632
 private function clamp_number($n, $min, $max)
624 633
 {
625 634
 	return min(max($n, $min), $max);
@@ -648,7 +657,7 @@  discard block
 block discarded – undo
648 657
  *
649 658
  * @param string   $str
650 659
  * @param int      $from index
651
- * @param int|bool $to index (optional)
660
+ * @param integer $to index (optional)
652 661
  * @return string
653 662
  */
654 663
 private function substring($str, $from = 0, $to = FALSE)
@@ -680,7 +689,7 @@  discard block
 block discarded – undo
680 689
  *
681 690
  * @param string   $str
682 691
  * @param int      $start index
683
- * @param int|bool $end index (optional)
692
+ * @param integer $end index (optional)
684 693
  * @return string
685 694
  */
686 695
 private function str_slice($str, $start = 0, $end = FALSE)
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -609,9 +609,15 @@
 block discarded – undo
609 609
 private function hue_to_rgb($v1, $v2, $vh)
610 610
 {
611 611
 	$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
612
-	if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh;
613
-	if ($vh * 2 < 1) return $v2;
614
-	if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
612
+	if ($vh * 6 < 1) {
613
+		return $v1 + ($v2 - $v1) * 6 * $vh;
614
+	}
615
+	if ($vh * 2 < 1) {
616
+		return $v2;
617
+	}
618
+	if ($vh * 3 < 2) {
619
+		return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
620
+	}
615 621
 	return $v1;
616 622
 }
617 623
 
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$this->memory_limit = 128 * 1048576; // 128MB in bytes
48 48
 		$this->max_execution_time = 60; // 1 min
49 49
 		$this->pcre_backtrack_limit = 1000 * 1000;
50
-		$this->pcre_recursion_limit =  500 * 1000;
50
+		$this->pcre_recursion_limit = 500 * 1000;
51 51
 
52 52
 		$this->raise_php_limits = (bool) $raise_php_limits;
53 53
 	}
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 			}
85 85
 		$comment_found = $this->str_slice($css, $start_index + 2, $end_index);
86 86
 		$this->comments[] = $comment_found;
87
-		$comment_preserve_string = self::COMMENT . (count($this->comments) - 1) . '___';
88
-		$css = $this->str_slice($css, 0, $start_index + 2) . $comment_preserve_string . $this->str_slice($css, $end_index);
87
+		$comment_preserve_string = self::COMMENT.(count($this->comments) - 1).'___';
88
+		$css = $this->str_slice($css, 0, $start_index + 2).$comment_preserve_string.$this->str_slice($css, $end_index);
89 89
 		// Set correct start_index: Fixes issue #2528130
90 90
 		$start_index = $end_index + 2 + strlen($comment_preserve_string) - strlen($comment_found);
91 91
 	}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 }
146 146
 
147 147
 // Update the first chunk and push the charset to the top of the file.
148
-$css_chunks[0] = $charset . $css_chunks[0];
148
+$css_chunks[0] = $charset.$css_chunks[0];
149 149
 
150 150
 return implode('', $css_chunks);
151 151
 }
@@ -220,17 +220,17 @@  discard block
 block discarded – undo
220 220
 	for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
221 221
 
222 222
 		$token = $this->comments[$i];
223
-		$placeholder = '/' . self::COMMENT . $i . '___/';
223
+		$placeholder = '/'.self::COMMENT.$i.'___/';
224 224
 
225 225
 		// ! in the first position of the comment means preserve
226 226
 		// so push to the preserved tokens keeping the !
227 227
 		if (substr($token, 0, 1) === '!') {
228 228
 			$this->preserved_tokens[] = $token;
229
-			$token_tring = self::TOKEN . (count($this->preserved_tokens) - 1) . '___';
229
+			$token_tring = self::TOKEN.(count($this->preserved_tokens) - 1).'___';
230 230
 			$css = preg_replace($placeholder, $token_tring, $css, 1);
231 231
 			// Preserve new lines for /*! important comments
232
-			$css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'. $token_tring .')/S', self::NL.'$1', $css);
233
-			$css = preg_replace('/('. $token_tring .'\*\/)\s*[\n\r\f]+\s*/S', '$1'.self::NL, $css);
232
+			$css = preg_replace('/\s*[\n\r\f]+\s*(\/\*'.$token_tring.')/S', self::NL.'$1', $css);
233
+			$css = preg_replace('/('.$token_tring.'\*\/)\s*[\n\r\f]+\s*/S', '$1'.self::NL, $css);
234 234
 			continue;
235 235
 		}
236 236
 
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 		// shorten that to /*\*/ and the next one to /**/
239 239
 		if (substr($token, (strlen($token) - 1), 1) === '\\') {
240 240
 			$this->preserved_tokens[] = '\\';
241
-			$css = preg_replace($placeholder,  self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
241
+			$css = preg_replace($placeholder, self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1);
242 242
 			$i = $i + 1; // attn: advancing the loop
243 243
 			$this->preserved_tokens[] = '';
244
-			$css = preg_replace('/' . self::COMMENT . $i . '___/',  self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
244
+			$css = preg_replace('/'.self::COMMENT.$i.'___/', self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1);
245 245
 			continue;
246 246
 		}
247 247
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 			if ($start_index > 2) {
253 253
 				if (substr($css, $start_index - 3, 1) === '>') {
254 254
 					$this->preserved_tokens[] = '';
255
-					$css = preg_replace($placeholder,  self::TOKEN . (count($this->preserved_tokens) - 1) . '___', $css, 1);
255
+					$css = preg_replace($placeholder, self::TOKEN.(count($this->preserved_tokens) - 1).'___', $css, 1);
256 256
 				}
257 257
 			}
258 258
 		}
259 259
 
260 260
 		// in all other cases kill the comment
261
-		$css = preg_replace('/\/\*' . $this->str_slice($placeholder, 1, -1) . '\*\//', '', $css, 1);
261
+		$css = preg_replace('/\/\*'.$this->str_slice($placeholder, 1, -1).'\*\//', '', $css, 1);
262 262
 	}
263 263
 
264 264
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	// Swap out any pseudo-class colons with the token, and then swap back.
292 292
 	$css = preg_replace_callback('/(?:^|\})(?:(?:[^\{\:])+\:)+(?:[^\{]*\{)/', array($this, 'replace_colon'), $css);
293 293
 	$css = preg_replace('/\s+([\!\{\}\;\:\>\+\(\)\]\~\=,])/', '$1', $css);
294
-	$css = preg_replace('/' . self::CLASSCOLON . '/', ':', $css);
294
+	$css = preg_replace('/'.self::CLASSCOLON.'/', ':', $css);
295 295
 
296 296
 	// retain space for special IE6 cases
297 297
 	$css = preg_replace('/\:first\-(line|letter)(\{|,)/i', ':first-$1 $2', $css);
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 					while ($i < strlen($css)) {
356 356
 					$i++;
357 357
 					if ($css[$i - 1] === '}' && $i - $start_index > $linebreak_pos) {
358
-					$css = $this->str_slice($css, 0, $i) . "\n" . $this->str_slice($css, $i);
358
+					$css = $this->str_slice($css, 0, $i)."\n".$this->str_slice($css, $i);
359 359
 					$start_index = $i;
360 360
 					}
361 361
 					}
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 					$css = preg_replace('/;;+/', ';', $css);
367 367
 
368 368
 					// Restore new lines for /*! important comments
369
-					$css = preg_replace('/'. self::NL .'/', "\n", $css);
369
+					$css = preg_replace('/'.self::NL.'/', "\n", $css);
370 370
 
371 371
 					// restore preserved comments and strings
372 372
 					for ($i = 0, $max = count($this->preserved_tokens); $i < $max; $i++) {
373
-						$css = preg_replace('/' . self::TOKEN . $i . '___/', $this->preserved_tokens[$i], $css, 1);
373
+						$css = preg_replace('/'.self::TOKEN.$i.'___/', $this->preserved_tokens[$i], $css, 1);
374 374
 					}
375 375
 
376 376
 					// Trim the final string (for any leading or trailing white spaces)
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			$terminator = ')';
411 411
 		}
412 412
 
413
-		while ($found_terminator === FALSE && $end_index+1 <= $max_index) {
413
+		while ($found_terminator === FALSE && $end_index + 1 <= $max_index) {
414 414
 			$end_index = $this->index_of($css, $terminator, $end_index + 1);
415 415
 
416 416
 			// endIndex == 0 doesn't really apply here
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			$token = preg_replace('/\s+/', '', $token);
431 431
 			$this->preserved_tokens[] = $token;
432 432
 
433
-			$preserver = 'url(' . self::TOKEN . (count($this->preserved_tokens) - 1) . '___)';
433
+			$preserver = 'url('.self::TOKEN.(count($this->preserved_tokens) - 1).'___)';
434 434
 			$sb[] = $preserver;
435 435
 
436 436
 			$append_index = $end_index + 1;
@@ -491,16 +491,16 @@  discard block
 block discarded – undo
491 491
 
492 492
 		if ($is_filter) {
493 493
 			// Restore, maintain case, otherwise filter will break
494
-			$sb[] = $m[1] . '#' . $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7];
494
+			$sb[] = $m[1].'#'.$m[2].$m[3].$m[4].$m[5].$m[6].$m[7];
495 495
 		} else {
496 496
 			if (strtolower($m[2]) == strtolower($m[3]) &&
497 497
 					strtolower($m[4]) == strtolower($m[5]) &&
498 498
 					strtolower($m[6]) == strtolower($m[7])) {
499 499
 				// Compress.
500
-				$hex = '#' . strtolower($m[3] . $m[5] . $m[7]);
500
+				$hex = '#'.strtolower($m[3].$m[5].$m[7]);
501 501
 			} else {
502 502
 				// Non compressible color, restore but lower case.
503
-				$hex = '#' . strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]);
503
+				$hex = '#'.strtolower($m[2].$m[3].$m[4].$m[5].$m[6].$m[7]);
504 504
 			}
505 505
 			// replace Hex colors to short safe color names
506 506
 			$sb[] = array_key_exists($hex, $short_safe) ? $short_safe[$hex] : $hex;
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	// one, maybe more? put'em back then
530 530
 	if (($pos = $this->index_of($match, self::COMMENT)) >= 0) {
531 531
 		for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
532
-			$match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1);
532
+			$match = preg_replace('/'.self::COMMENT.$i.'___/', $this->comments[$i], $match, 1);
533 533
 		}
534 534
 	}
535 535
 
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 	$match = preg_replace('/progid\:DXImageTransform\.Microsoft\.Alpha\(Opacity\=/i', 'alpha(opacity=', $match);
538 538
 
539 539
 			$this->preserved_tokens[] = $match;
540
-			return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote;
540
+			return $quote.self::TOKEN.(count($this->preserved_tokens) - 1).'___'.$quote;
541 541
 			}
542 542
 
543 543
 			private function replace_colon($matches)
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
 			private function replace_calc($matches)
549 549
 			{
550 550
 			$this->preserved_tokens[] = preg_replace('/\s?([\*\/\(\),])\s?/', '$1', $matches[0]);
551
-			return self::TOKEN . (count($this->preserved_tokens) - 1) . '___';
551
+			return self::TOKEN.(count($this->preserved_tokens) - 1).'___';
552 552
 			}
553 553
 
554 554
 			private function rgb_to_hex($matches)
555 555
 			{
556 556
 			// Support for percentage values rgb(100%, 0%, 45%);
557
-			if ($this->index_of($matches[1], '%') >= 0){
557
+			if ($this->index_of($matches[1], '%') >= 0) {
558 558
 				$rgbcolors = explode(',', str_replace('%', '', $matches[1]));
559 559
 				for ($i = 0; $i < count($rgbcolors); $i++) {
560 560
 					$rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55);
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 			}
571 571
 
572 572
 			// Fix for issue #2528093
573
-			if (!preg_match('/[\s\,\);\}]/', $matches[2])){
574
-				$matches[2] = ' ' . $matches[2];
573
+			if (!preg_match('/[\s\,\);\}]/', $matches[2])) {
574
+				$matches[2] = ' '.$matches[2];
575 575
 			}
576 576
 
577
-			return '#' . implode('', $rgbcolors) . $matches[2];
577
+			return '#'.implode('', $rgbcolors).$matches[2];
578 578
 			}
579 579
 
580 580
 private function hsl_to_hex($matches)
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	} else {
595 595
 		$v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
596 596
 		$v1 = (2 * $l) - $v2;
597
-		$r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1/3)));
597
+		$r = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h + (1 / 3)));
598 598
 		$g = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h));
599
-		$b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1/3)));
599
+		$b = $this->round_number(255 * $this->hue_to_rgb($v1, $v2, $h - (1 / 3)));
600 600
 	}
601 601
 
602 602
 	return $this->rgb_to_hex(array('', $r.','.$g.','.$b, $matches[2]));
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
612 612
 	if ($vh * 6 < 1) return $v1 + ($v2 - $v1) * 6 * $vh;
613 613
 	if ($vh * 2 < 1) return $v2;
614
-	if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2/3) - $vh) * 6;
614
+	if ($vh * 3 < 2) return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
615 615
 	return $v1;
616 616
 }
617 617
 
Please login to merge, or discard this patch.
tools/minify/jsminplus/jsminplus.php 4 patches
Doc Comments   +35 added lines patch added patch discarded remove patch
@@ -114,6 +114,9 @@  discard block
 block discarded – undo
114 114
 		$this->parser = new JSParser();
115 115
 	}
116 116
 
117
+	/**
118
+	 * @return string
119
+	 */
117 120
 	public static function minify($js, $filename='')
118 121
 	{
119 122
 		static $instance;
@@ -125,6 +128,9 @@  discard block
 block discarded – undo
125 128
 		return $instance->min($js, $filename);
126 129
 	}
127 130
 
131
+	/**
132
+	 * @param string $filename
133
+	 */
128 134
 	private function min($js, $filename)
129 135
 	{
130 136
 		try
@@ -140,6 +146,9 @@  discard block
 block discarded – undo
140 146
 		return false;
141 147
 	}
142 148
 
149
+	/**
150
+	 * @param JSNode $n
151
+	 */
143 152
 	private function parseTree($n, $noBlockGrouping = false)
144 153
 	{
145 154
 		$s = '';
@@ -545,6 +554,9 @@  discard block
 block discarded – undo
545 554
 		return $s;
546 555
 	}
547 556
 
557
+	/**
558
+	 * @param string $string
559
+	 */
548 560
 	private function isValidIdentifier($string)
549 561
 	{
550 562
 		return preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $string) && !in_array($string, $this->reserved);
@@ -608,6 +620,9 @@  discard block
 block discarded – undo
608 620
 		$this->t = new JSTokenizer();
609 621
 	}
610 622
 
623
+	/**
624
+	 * @param integer $l
625
+	 */
611 626
 	public function parse($s, $f, $l)
612 627
 	{
613 628
 		// initialize tokenizer
@@ -621,6 +636,9 @@  discard block
 block discarded – undo
621 636
 		return $n;
622 637
 	}
623 638
 
639
+	/**
640
+	 * @param JSCompilerContext $x
641
+	 */
624 642
 	private function Script($x)
625 643
 	{
626 644
 		$n = $this->Statements($x);
@@ -971,6 +989,10 @@  discard block
 block discarded – undo
971 989
 		return $n;
972 990
 	}
973 991
 
992
+	/**
993
+	 * @param boolean $requireName
994
+	 * @param integer $functionForm
995
+	 */
974 996
 	private function FunctionDefinition($x, $requireName, $functionForm)
975 997
 	{
976 998
 		$f = new JSNode($this->t);
@@ -1437,6 +1459,10 @@  discard block
 block discarded – undo
1437 1459
 	}
1438 1460
 
1439 1461
 	// Statement stack and nested statement handler.
1462
+
1463
+	/**
1464
+	 * @param JSNode $node
1465
+	 */
1440 1466
 	private function nest($x, $node, $end = false)
1441 1467
 	{
1442 1468
 		array_push($x->stmtStack, $node);
@@ -1501,6 +1527,9 @@  discard block
 block discarded – undo
1501 1527
 	public $funDecls = array();
1502 1528
 	public $varDecls = array();
1503 1529
 
1530
+	/**
1531
+	 * @param boolean $inFunction
1532
+	 */
1504 1533
 	public function __construct($inFunction)
1505 1534
 	{
1506 1535
 		$this->inFunction = $inFunction;
@@ -1519,6 +1548,9 @@  discard block
 block discarded – undo
1519 1548
 	public $funDecls = array();
1520 1549
 	public $varDecls = array();
1521 1550
 
1551
+	/**
1552
+	 * @param JSTokenizer $t
1553
+	 */
1522 1554
 	public function __construct($t, $type=0)
1523 1555
 	{
1524 1556
 		if ($token = $t->currentToken())
@@ -1673,6 +1705,9 @@  discard block
 block discarded – undo
1673 1705
 		$this->scanOperand = true;
1674 1706
 	}
1675 1707
 
1708
+	/**
1709
+	 * @param integer|null $chunksize
1710
+	 */
1676 1711
 	public function getInput($chunksize)
1677 1712
 	{
1678 1713
 		if ($chunksize)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -786,10 +786,10 @@  discard block
 block discarded – undo
786 786
 			return $n;
787 787
 
788 788
 			case KEYWORD_WHILE:
789
-			        $n = new JSNode($this->t);
790
-			        $n->isLoop = true;
791
-			        $n->condition = $this->ParenExpression($x);
792
-			        $n->body = $this->nest($x, $n);
789
+					$n = new JSNode($this->t);
790
+					$n->isLoop = true;
791
+					$n->condition = $this->ParenExpression($x);
792
+					$n->body = $this->nest($x, $n);
793 793
 			return $n;
794 794
 
795 795
 			case KEYWORD_DO:
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 
910 910
 			case KEYWORD_VAR:
911 911
 			case KEYWORD_CONST:
912
-			        $n = $this->Variables($x);
912
+					$n = $this->Variables($x);
913 913
 			break;
914 914
 
915 915
 			case TOKEN_CONDCOMMENT_START:
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 	public function mustMatch($tt)
1695 1695
 	{
1696
-	        if (!$this->match($tt))
1696
+			if (!$this->match($tt))
1697 1697
 			throw $this->newSyntaxError('Unexpected token; token ' . $tt . ' expected');
1698 1698
 
1699 1699
 		return $this->currentToken();
Please login to merge, or discard this patch.
Braces   +350 added lines, -274 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@  discard block
 block discarded – undo
119 119
 		static $instance;
120 120
 
121 121
 		// this is a singleton
122
-		if(!$instance)
123
-			$instance = new JSMinPlus();
122
+		if(!$instance) {
123
+					$instance = new JSMinPlus();
124
+		}
124 125
 
125 126
 		return $instance->min($js, $filename);
126 127
 	}
@@ -131,8 +132,7 @@  discard block
 block discarded – undo
131 132
 		{
132 133
 			$n = $this->parser->parse($js, $filename, 1);
133 134
 			return $this->parseTree($n);
134
-		}
135
-		catch(Exception $e)
135
+		} catch(Exception $e)
136 136
 		{
137 137
 			echo $e->getMessage() . "\n";
138 138
 		}
@@ -149,8 +149,9 @@  discard block
 block discarded – undo
149 149
 			case KEYWORD_FUNCTION:
150 150
 				$s .= 'function' . ($n->name ? ' ' . $n->name : '') . '(';
151 151
 				$params = $n->params;
152
-				for ($i = 0, $j = count($params); $i < $j; $i++)
153
-					$s .= ($i ? ',' : '') . $params[$i];
152
+				for ($i = 0, $j = count($params); $i < $j; $i++) {
153
+									$s .= ($i ? ',' : '') . $params[$i];
154
+				}
154 155
 				$s .= '){' . $this->parseTree($n->body, true) . '}';
155 156
 			break;
156 157
 
@@ -176,13 +177,11 @@  discard block
 block discarded – undo
176 177
 							{
177 178
 								// put declared functions on a new line
178 179
 								$s .= "\n";
179
-							}
180
-							elseif ($type == KEYWORD_VAR && $type == $lastType)
180
+							} elseif ($type == KEYWORD_VAR && $type == $lastType)
181 181
 							{
182 182
 								// mutiple var-statements can go into one
183 183
 								$t = ',' . substr($t, 4);
184
-							}
185
-							else
184
+							} else
186 185
 							{
187 186
 								// add terminator
188 187
 								$s .= ';';
@@ -208,24 +207,26 @@  discard block
 block discarded – undo
208 207
 				$elsePart = $n->elsePart ? $this->parseTree($n->elsePart) : null;
209 208
 
210 209
 				// empty if-statement
211
-				if ($thenPart == '')
212
-					$thenPart = ';';
210
+				if ($thenPart == '') {
211
+									$thenPart = ';';
212
+				}
213 213
 
214 214
 				if ($elsePart)
215 215
 				{
216 216
 					// be carefull and always make a block out of the thenPart; could be more optimized but is a lot of trouble
217
-					if ($thenPart != ';' && $thenPart[0] != '{')
218
-						$thenPart = '{' . $thenPart . '}';
217
+					if ($thenPart != ';' && $thenPart[0] != '{') {
218
+											$thenPart = '{' . $thenPart . '}';
219
+					}
219 220
 
220 221
 					$s .= $thenPart . 'else';
221 222
 
222 223
 					// we could check for more, but that hardly ever applies so go for performance
223
-					if ($elsePart[0] != '{')
224
-						$s .= ' ';
224
+					if ($elsePart[0] != '{') {
225
+											$s .= ' ';
226
+					}
225 227
 
226 228
 					$s .= $elsePart;
227
-				}
228
-				else
229
+				} else
229 230
 				{
230 231
 					$s .= $thenPart;
231 232
 				}
@@ -237,18 +238,20 @@  discard block
 block discarded – undo
237 238
 				for ($i = 0, $j = count($cases); $i < $j; $i++)
238 239
 				{
239 240
 					$case = $cases[$i];
240
-					if ($case->type == KEYWORD_CASE)
241
-						$s .= 'case' . ($case->caseLabel->type != TOKEN_STRING ? ' ' : '') . $this->parseTree($case->caseLabel) . ':';
242
-					else
243
-						$s .= 'default:';
241
+					if ($case->type == KEYWORD_CASE) {
242
+											$s .= 'case' . ($case->caseLabel->type != TOKEN_STRING ? ' ' : '') . $this->parseTree($case->caseLabel) . ':';
243
+					} else {
244
+											$s .= 'default:';
245
+					}
244 246
 
245 247
 					$statement = $this->parseTree($case->statements, true);
246 248
 					if ($statement)
247 249
 					{
248 250
 						$s .= $statement;
249 251
 						// no terminator for last statement
250
-						if ($i + 1 < $j)
251
-							$s .= ';';
252
+						if ($i + 1 < $j) {
253
+													$s .= ';';
254
+						}
252 255
 					}
253 256
 				}
254 257
 				$s .= '}';
@@ -260,8 +263,9 @@  discard block
 block discarded – undo
260 263
 					. ';' . ($n->update ? $this->parseTree($n->update) : '') . ')';
261 264
 
262 265
 				$body  = $this->parseTree($n->body);
263
-				if ($body == '')
264
-					$body = ';';
266
+				if ($body == '') {
267
+									$body = ';';
268
+				}
265 269
 
266 270
 				$s .= $body;
267 271
 			break;
@@ -270,8 +274,9 @@  discard block
 block discarded – undo
270 274
 				$s = 'while(' . $this->parseTree($n->condition) . ')';
271 275
 
272 276
 				$body  = $this->parseTree($n->body);
273
-				if ($body == '')
274
-					$body = ';';
277
+				if ($body == '') {
278
+									$body = ';';
279
+				}
275 280
 
276 281
 				$s .= $body;
277 282
 			break;
@@ -280,8 +285,9 @@  discard block
 block discarded – undo
280 285
 				$s = 'for(' . ($n->varDecl ? $this->parseTree($n->varDecl) : $this->parseTree($n->iterator)) . ' in ' . $this->parseTree($n->object) . ')';
281 286
 
282 287
 				$body  = $this->parseTree($n->body);
283
-				if ($body == '')
284
-					$body = ';';
288
+				if ($body == '') {
289
+									$body = ';';
290
+				}
285 291
 
286 292
 				$s .= $body;
287 293
 			break;
@@ -303,8 +309,9 @@  discard block
 block discarded – undo
303 309
 					$t = $catchClauses[$i];
304 310
 					$s .= 'catch(' . $t->varName . ($t->guard ? ' if ' . $this->parseTree($t->guard) : '') . '){' . $this->parseTree($t->block, true) . '}';
305 311
 				}
306
-				if ($n->finallyBlock)
307
-					$s .= 'finally{' . $this->parseTree($n->finallyBlock, true) . '}';
312
+				if ($n->finallyBlock) {
313
+									$s .= 'finally{' . $this->parseTree($n->finallyBlock, true) . '}';
314
+				}
308 315
 			break;
309 316
 
310 317
 			case KEYWORD_THROW:
@@ -320,8 +327,9 @@  discard block
 block discarded – undo
320 327
 					{
321 328
 						if (	$t[0] != '(' && $t[0] != '[' && $t[0] != '{' &&
322 329
 							$t[0] != '"' && $t[0] != "'" && $t[0] != '/'
323
-						)
324
-							$s .= ' ';
330
+						) {
331
+													$s .= ' ';
332
+						}
325 333
 
326 334
 						$s .= $t;
327 335
 					}
@@ -341,8 +349,9 @@  discard block
 block discarded – undo
341 349
 					$t = $childs[$i];
342 350
 					$s .= ($i ? ',' : '') . $t->name;
343 351
 					$u = $t->initializer;
344
-					if ($u)
345
-						$s .= '=' . $this->parseTree($u);
352
+					if ($u) {
353
+											$s .= '=' . $this->parseTree($u);
354
+					}
346 355
 				}
347 356
 			break;
348 357
 
@@ -354,13 +363,15 @@  discard block
 block discarded – undo
354 363
 			case TOKEN_CONDCOMMENT_END:
355 364
 				$s = $n->value . ($n->type == TOKEN_CONDCOMMENT_START ? ' ' : '');
356 365
 				$childs = $n->treeNodes;
357
-				for ($i = 0, $j = count($childs); $i < $j; $i++)
358
-					$s .= $this->parseTree($childs[$i]);
366
+				for ($i = 0, $j = count($childs); $i < $j; $i++) {
367
+									$s .= $this->parseTree($childs[$i]);
368
+				}
359 369
 			break;
360 370
 
361 371
 			case OP_SEMICOLON:
362
-				if ($expression = $n->expression)
363
-					$s = $this->parseTree($expression);
372
+				if ($expression = $n->expression) {
373
+									$s = $this->parseTree($expression);
374
+				}
364 375
 			break;
365 376
 
366 377
 			case JS_LABEL:
@@ -369,8 +380,9 @@  discard block
 block discarded – undo
369 380
 
370 381
 			case OP_COMMA:
371 382
 				$childs = $n->treeNodes;
372
-				for ($i = 0, $j = count($childs); $i < $j; $i++)
373
-					$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
383
+				for ($i = 0, $j = count($childs); $i < $j; $i++) {
384
+									$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
385
+				}
374 386
 			break;
375 387
 
376 388
 			case OP_ASSIGN:
@@ -449,10 +461,11 @@  discard block
 block discarded – undo
449 461
 
450 462
 			case OP_INCREMENT:
451 463
 			case OP_DECREMENT:
452
-				if ($n->postfix)
453
-					$s = $this->parseTree($n->treeNodes[0]) . $n->value;
454
-				else
455
-					$s = $n->value . $this->parseTree($n->treeNodes[0]);
464
+				if ($n->postfix) {
465
+									$s = $this->parseTree($n->treeNodes[0]) . $n->value;
466
+				} else {
467
+									$s = $n->value . $this->parseTree($n->treeNodes[0]);
468
+				}
456 469
 			break;
457 470
 
458 471
 			case OP_DOT:
@@ -465,16 +478,18 @@  discard block
 block discarded – undo
465 478
 				if (	$n->treeNodes[0]->type == TOKEN_IDENTIFIER &&
466 479
 					$n->treeNodes[1]->type == TOKEN_STRING &&
467 480
 					$this->isValidIdentifier(substr($n->treeNodes[1]->value, 1, -1))
468
-				)
469
-					$s .= '.' . substr($n->treeNodes[1]->value, 1, -1);
470
-				else
471
-					$s .= '[' . $this->parseTree($n->treeNodes[1]) . ']';
481
+				) {
482
+									$s .= '.' . substr($n->treeNodes[1]->value, 1, -1);
483
+				} else {
484
+									$s .= '[' . $this->parseTree($n->treeNodes[1]) . ']';
485
+				}
472 486
 			break;
473 487
 
474 488
 			case JS_LIST:
475 489
 				$childs = $n->treeNodes;
476
-				for ($i = 0, $j = count($childs); $i < $j; $i++)
477
-					$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
490
+				for ($i = 0, $j = count($childs); $i < $j; $i++) {
491
+									$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
492
+				}
478 493
 			break;
479 494
 
480 495
 			case JS_CALL:
@@ -502,27 +517,29 @@  discard block
 block discarded – undo
502 517
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
503 518
 				{
504 519
 					$t = $childs[$i];
505
-					if ($i)
506
-						$s .= ',';
520
+					if ($i) {
521
+											$s .= ',';
522
+					}
507 523
 					if ($t->type == JS_PROPERTY_INIT)
508 524
 					{
509 525
 						// Ditch the quotes when the index is a valid identifier
510 526
 						if (	$t->treeNodes[0]->type == TOKEN_STRING &&
511 527
 							$this->isValidIdentifier(substr($t->treeNodes[0]->value, 1, -1))
512
-						)
513
-							$s .= substr($t->treeNodes[0]->value, 1, -1);
514
-						else
515
-							$s .= $t->treeNodes[0]->value;
528
+						) {
529
+													$s .= substr($t->treeNodes[0]->value, 1, -1);
530
+						} else {
531
+													$s .= $t->treeNodes[0]->value;
532
+						}
516 533
 
517 534
 						$s .= ':' . $this->parseTree($t->treeNodes[1]);
518
-					}
519
-					else
535
+					} else
520 536
 					{
521 537
 						$s .= $t->type == JS_GETTER ? 'get' : 'set';
522 538
 						$s .= ' ' . $t->name . '(';
523 539
 						$params = $t->params;
524
-						for ($i = 0, $j = count($params); $i < $j; $i++)
525
-							$s .= ($i ? ',' : '') . $params[$i];
540
+						for ($i = 0, $j = count($params); $i < $j; $i++) {
541
+													$s .= ($i ? ',' : '') . $params[$i];
542
+						}
526 543
 						$s .= '){' . $this->parseTree($t->body, true) . '}';
527 544
 					}
528 545
 				}
@@ -615,8 +632,9 @@  discard block
 block discarded – undo
615 632
 
616 633
 		$x = new JSCompilerContext(false);
617 634
 		$n = $this->Script($x);
618
-		if (!$this->t->isDone())
619
-			throw $this->t->newSyntaxError('Syntax error');
635
+		if (!$this->t->isDone()) {
636
+					throw $this->t->newSyntaxError('Syntax error');
637
+		}
620 638
 
621 639
 		return $n;
622 640
 	}
@@ -636,8 +654,9 @@  discard block
 block discarded – undo
636 654
 		$n = new JSNode($this->t, JS_BLOCK);
637 655
 		array_push($x->stmtStack, $n);
638 656
 
639
-		while (!$this->t->isDone() && $this->t->peek() != OP_RIGHT_CURLY)
640
-			$n->addNode($this->Statement($x));
657
+		while (!$this->t->isDone() && $this->t->peek() != OP_RIGHT_CURLY) {
658
+					$n->addNode($this->Statement($x));
659
+		}
641 660
 
642 661
 		array_pop($x->stmtStack);
643 662
 
@@ -701,15 +720,17 @@  discard block
 block discarded – undo
701 720
 					switch ($tt)
702 721
 					{
703 722
 						case KEYWORD_DEFAULT:
704
-							if ($n->defaultIndex >= 0)
705
-								throw $this->t->newSyntaxError('More than one switch default');
723
+							if ($n->defaultIndex >= 0) {
724
+															throw $this->t->newSyntaxError('More than one switch default');
725
+							}
706 726
 							// FALL THROUGH
707 727
 						case KEYWORD_CASE:
708 728
 							$n2 = new JSNode($this->t);
709
-							if ($tt == KEYWORD_DEFAULT)
710
-								$n->defaultIndex = count($n->cases);
711
-							else
712
-								$n2->caseLabel = $this->Expression($x, OP_COLON);
729
+							if ($tt == KEYWORD_DEFAULT) {
730
+															$n->defaultIndex = count($n->cases);
731
+							} else {
732
+															$n2->caseLabel = $this->Expression($x, OP_COLON);
733
+							}
713 734
 								break;
714 735
 						default:
715 736
 							throw $this->t->newSyntaxError('Invalid switch case');
@@ -717,8 +738,9 @@  discard block
 block discarded – undo
717 738
 
718 739
 					$this->t->mustMatch(OP_COLON);
719 740
 					$n2->statements = new JSNode($this->t, JS_BLOCK);
720
-					while (($tt = $this->t->peek()) != KEYWORD_CASE && $tt != KEYWORD_DEFAULT && $tt != OP_RIGHT_CURLY)
721
-						$n2->statements->addNode($this->Statement($x));
741
+					while (($tt = $this->t->peek()) != KEYWORD_CASE && $tt != KEYWORD_DEFAULT && $tt != OP_RIGHT_CURLY) {
742
+											$n2->statements->addNode($this->Statement($x));
743
+					}
722 744
 
723 745
 					array_push($n->cases, $n2);
724 746
 				}
@@ -738,8 +760,7 @@  discard block
 block discarded – undo
738 760
 					{
739 761
 						$this->t->get();
740 762
 						$n2 = $this->Variables($x);
741
-					}
742
-					else
763
+					} else
743 764
 					{
744 765
 						$n2 = $this->Expression($x);
745 766
 					}
@@ -763,16 +784,14 @@  discard block
 block discarded – undo
763 784
 						// NB: n2[0].type == IDENTIFIER and n2[0].value == n2[0].name.
764 785
 						$n->iterator = $n2->treeNodes[0];
765 786
 						$n->varDecl = $n2;
766
-					}
767
-					else
787
+					} else
768 788
 					{
769 789
 						$n->iterator = $n2;
770 790
 						$n->varDecl = null;
771 791
 					}
772 792
 
773 793
 					$n->object = $this->Expression($x);
774
-				}
775
-				else
794
+				} else
776 795
 				{
777 796
 					$n->setup = $n2 ? $n2 : null;
778 797
 					$this->t->mustMatch(OP_SEMICOLON);
@@ -824,17 +843,18 @@  discard block
 block discarded – undo
824 843
 				{
825 844
 					do
826 845
 					{
827
-						if (--$i < 0)
828
-							throw $this->t->newSyntaxError('Label not found');
846
+						if (--$i < 0) {
847
+													throw $this->t->newSyntaxError('Label not found');
848
+						}
829 849
 					}
830 850
 					while ($ss[$i]->label != $label);
831
-				}
832
-				else
851
+				} else
833 852
 				{
834 853
 					do
835 854
 					{
836
-						if (--$i < 0)
837
-							throw $this->t->newSyntaxError('Invalid ' . $tt);
855
+						if (--$i < 0) {
856
+													throw $this->t->newSyntaxError('Invalid ' . $tt);
857
+						}
838 858
 					}
839 859
 					while (!$ss[$i]->isLoop && ($tt != KEYWORD_BREAK || $ss[$i]->type != KEYWORD_SWITCH));
840 860
 				}
@@ -855,15 +875,16 @@  discard block
 block discarded – undo
855 875
 
856 876
 					if ($this->t->match(KEYWORD_IF))
857 877
 					{
858
-						if ($x->ecmaStrictMode)
859
-							throw $this->t->newSyntaxError('Illegal catch guard');
878
+						if ($x->ecmaStrictMode) {
879
+													throw $this->t->newSyntaxError('Illegal catch guard');
880
+						}
860 881
 
861
-						if (count($n->catchClauses) && !end($n->catchClauses)->guard)
862
-							throw $this->t->newSyntaxError('Guarded catch after unguarded');
882
+						if (count($n->catchClauses) && !end($n->catchClauses)->guard) {
883
+													throw $this->t->newSyntaxError('Guarded catch after unguarded');
884
+						}
863 885
 
864 886
 						$n2->guard = $this->Expression($x);
865
-					}
866
-					else
887
+					} else
867 888
 					{
868 889
 						$n2->guard = null;
869 890
 					}
@@ -873,11 +894,13 @@  discard block
 block discarded – undo
873 894
 					array_push($n->catchClauses, $n2);
874 895
 				}
875 896
 
876
-				if ($this->t->match(KEYWORD_FINALLY))
877
-					$n->finallyBlock = $this->Block($x);
897
+				if ($this->t->match(KEYWORD_FINALLY)) {
898
+									$n->finallyBlock = $this->Block($x);
899
+				}
878 900
 
879
-				if (!count($n->catchClauses) && !$n->finallyBlock)
880
-					throw $this->t->newSyntaxError('Invalid try statement');
901
+				if (!count($n->catchClauses) && !$n->finallyBlock) {
902
+									throw $this->t->newSyntaxError('Invalid try statement');
903
+				}
881 904
 			return $n;
882 905
 
883 906
 			case KEYWORD_CATCH:
@@ -890,15 +913,17 @@  discard block
 block discarded – undo
890 913
 			break;
891 914
 
892 915
 			case KEYWORD_RETURN:
893
-				if (!$x->inFunction)
894
-					throw $this->t->newSyntaxError('Invalid return');
916
+				if (!$x->inFunction) {
917
+									throw $this->t->newSyntaxError('Invalid return');
918
+				}
895 919
 
896 920
 				$n = new JSNode($this->t);
897 921
 				$tt = $this->t->peekOnSameLine();
898
-				if ($tt != TOKEN_END && $tt != TOKEN_NEWLINE && $tt != OP_SEMICOLON && $tt != OP_RIGHT_CURLY)
899
-					$n->value = $this->Expression($x);
900
-				else
901
-					$n->value = null;
922
+				if ($tt != TOKEN_END && $tt != TOKEN_NEWLINE && $tt != OP_SEMICOLON && $tt != OP_RIGHT_CURLY) {
923
+									$n->value = $this->Expression($x);
924
+				} else {
925
+									$n->value = null;
926
+				}
902 927
 			break;
903 928
 
904 929
 			case KEYWORD_WITH:
@@ -939,8 +964,9 @@  discard block
 block discarded – undo
939 964
 						$ss = $x->stmtStack;
940 965
 						for ($i = count($ss) - 1; $i >= 0; --$i)
941 966
 						{
942
-							if ($ss[$i]->label == $label)
943
-								throw $this->t->newSyntaxError('Duplicate label');
967
+							if ($ss[$i]->label == $label) {
968
+															throw $this->t->newSyntaxError('Duplicate label');
969
+							}
944 970
 						}
945 971
 
946 972
 						$this->t->get();
@@ -962,8 +988,9 @@  discard block
 block discarded – undo
962 988
 		if ($this->t->lineno == $this->t->currentToken()->lineno)
963 989
 		{
964 990
 			$tt = $this->t->peekOnSameLine();
965
-			if ($tt != TOKEN_END && $tt != TOKEN_NEWLINE && $tt != OP_SEMICOLON && $tt != OP_RIGHT_CURLY)
966
-				throw $this->t->newSyntaxError('Missing ; before statement');
991
+			if ($tt != TOKEN_END && $tt != TOKEN_NEWLINE && $tt != OP_SEMICOLON && $tt != OP_RIGHT_CURLY) {
992
+							throw $this->t->newSyntaxError('Missing ; before statement');
993
+			}
967 994
 		}
968 995
 
969 996
 		$this->t->match(OP_SEMICOLON);
@@ -975,26 +1002,30 @@  discard block
 block discarded – undo
975 1002
 	{
976 1003
 		$f = new JSNode($this->t);
977 1004
 
978
-		if ($f->type != KEYWORD_FUNCTION)
979
-			$f->type = ($f->value == 'get') ? JS_GETTER : JS_SETTER;
1005
+		if ($f->type != KEYWORD_FUNCTION) {
1006
+					$f->type = ($f->value == 'get') ? JS_GETTER : JS_SETTER;
1007
+		}
980 1008
 
981
-		if ($this->t->match(TOKEN_IDENTIFIER))
982
-			$f->name = $this->t->currentToken()->value;
983
-		elseif ($requireName)
984
-			throw $this->t->newSyntaxError('Missing function identifier');
1009
+		if ($this->t->match(TOKEN_IDENTIFIER)) {
1010
+					$f->name = $this->t->currentToken()->value;
1011
+		} elseif ($requireName) {
1012
+					throw $this->t->newSyntaxError('Missing function identifier');
1013
+		}
985 1014
 
986 1015
 		$this->t->mustMatch(OP_LEFT_PAREN);
987 1016
 			$f->params = array();
988 1017
 
989 1018
 		while (($tt = $this->t->get()) != OP_RIGHT_PAREN)
990 1019
 		{
991
-			if ($tt != TOKEN_IDENTIFIER)
992
-				throw $this->t->newSyntaxError('Missing formal parameter');
1020
+			if ($tt != TOKEN_IDENTIFIER) {
1021
+							throw $this->t->newSyntaxError('Missing formal parameter');
1022
+			}
993 1023
 
994 1024
 			array_push($f->params, $this->t->currentToken()->value);
995 1025
 
996
-			if ($this->t->peek() != OP_RIGHT_PAREN)
997
-				$this->t->mustMatch(OP_COMMA);
1026
+			if ($this->t->peek() != OP_RIGHT_PAREN) {
1027
+							$this->t->mustMatch(OP_COMMA);
1028
+			}
998 1029
 		}
999 1030
 
1000 1031
 		$this->t->mustMatch(OP_LEFT_CURLY);
@@ -1006,8 +1037,9 @@  discard block
 block discarded – undo
1006 1037
 		$f->end = $this->t->currentToken()->end;
1007 1038
 
1008 1039
 		$f->functionForm = $functionForm;
1009
-		if ($functionForm == DECLARED_FORM)
1010
-			array_push($x->funDecls, $f);
1040
+		if ($functionForm == DECLARED_FORM) {
1041
+					array_push($x->funDecls, $f);
1042
+		}
1011 1043
 
1012 1044
 		return $f;
1013 1045
 	}
@@ -1025,8 +1057,9 @@  discard block
 block discarded – undo
1025 1057
 
1026 1058
 			if ($this->t->match(OP_ASSIGN))
1027 1059
 			{
1028
-				if ($this->t->currentToken()->assignOp)
1029
-					throw $this->t->newSyntaxError('Invalid variable initialization');
1060
+				if ($this->t->currentToken()->assignOp) {
1061
+									throw $this->t->newSyntaxError('Invalid variable initialization');
1062
+				}
1030 1063
 
1031 1064
 				$n2->initializer = $this->Expression($x, OP_COMMA);
1032 1065
 			}
@@ -1073,13 +1106,15 @@  discard block
 block discarded – undo
1073 1106
 					break 2;
1074 1107
 
1075 1108
 				case OP_HOOK:
1076
-					if ($this->t->scanOperand)
1077
-						break 2;
1109
+					if ($this->t->scanOperand) {
1110
+											break 2;
1111
+					}
1078 1112
 
1079 1113
 					while (	!empty($operators) &&
1080 1114
 						$this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt]
1081
-					)
1082
-						$this->reduce($operators, $operands);
1115
+					) {
1116
+											$this->reduce($operators, $operands);
1117
+					}
1083 1118
 
1084 1119
 					array_push($operators, new JSNode($this->t));
1085 1120
 
@@ -1087,29 +1122,33 @@  discard block
 block discarded – undo
1087 1122
 					$this->t->scanOperand = true;
1088 1123
 					$n = $this->Expression($x);
1089 1124
 
1090
-					if (!$this->t->match(OP_COLON))
1091
-						break 2;
1125
+					if (!$this->t->match(OP_COLON)) {
1126
+											break 2;
1127
+					}
1092 1128
 
1093 1129
 					--$x->hookLevel;
1094 1130
 					array_push($operands, $n);
1095 1131
 				break;
1096 1132
 
1097 1133
 				case OP_COLON:
1098
-					if ($x->hookLevel)
1099
-						break 2;
1134
+					if ($x->hookLevel) {
1135
+											break 2;
1136
+					}
1100 1137
 
1101 1138
 					throw $this->t->newSyntaxError('Invalid label');
1102 1139
 				break;
1103 1140
 
1104 1141
 				case OP_ASSIGN:
1105
-					if ($this->t->scanOperand)
1106
-						break 2;
1142
+					if ($this->t->scanOperand) {
1143
+											break 2;
1144
+					}
1107 1145
 
1108 1146
 					// Use >, not >=, for right-associative ASSIGN
1109 1147
 					while (	!empty($operators) &&
1110 1148
 						$this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt]
1111
-					)
1112
-						$this->reduce($operators, $operands);
1149
+					) {
1150
+											$this->reduce($operators, $operands);
1151
+					}
1113 1152
 
1114 1153
 					array_push($operators, new JSNode($this->t));
1115 1154
 					end($operands)->assignOp = $this->t->currentToken()->assignOp;
@@ -1123,8 +1162,9 @@  discard block
 block discarded – undo
1123 1162
 					if ($x->inForLoopInit && !$x->hookLevel &&
1124 1163
 						!$x->bracketLevel && !$x->curlyLevel &&
1125 1164
 						!$x->parenLevel
1126
-					)
1127
-						break 2;
1165
+					) {
1166
+											break 2;
1167
+					}
1128 1168
 				// FALL THROUGH
1129 1169
 				case OP_COMMA:
1130 1170
 					// A comma operator should not be parsed if we're parsing the then part
@@ -1132,8 +1172,9 @@  discard block
 block discarded – undo
1132 1172
 					if ($tt == OP_COMMA && $x->hookLevel &&
1133 1173
 						!$x->bracketLevel && !$x->curlyLevel &&
1134 1174
 						!$x->parenLevel
1135
-					)
1136
-						break 2;
1175
+					) {
1176
+											break 2;
1177
+					}
1137 1178
 				// Treat comma as left-associative so reduce can fold left-heavy
1138 1179
 				// COMMA trees into a single array.
1139 1180
 				// FALL THROUGH
@@ -1149,20 +1190,21 @@  discard block
 block discarded – undo
1149 1190
 				case OP_PLUS: case OP_MINUS:
1150 1191
 				case OP_MUL: case OP_DIV: case OP_MOD:
1151 1192
 				case OP_DOT:
1152
-					if ($this->t->scanOperand)
1153
-						break 2;
1193
+					if ($this->t->scanOperand) {
1194
+											break 2;
1195
+					}
1154 1196
 
1155 1197
 					while (	!empty($operators) &&
1156 1198
 						$this->opPrecedence[end($operators)->type] >= $this->opPrecedence[$tt]
1157
-					)
1158
-						$this->reduce($operators, $operands);
1199
+					) {
1200
+											$this->reduce($operators, $operands);
1201
+					}
1159 1202
 
1160 1203
 					if ($tt == OP_DOT)
1161 1204
 					{
1162 1205
 						$this->t->mustMatch(TOKEN_IDENTIFIER);
1163 1206
 						array_push($operands, new JSNode($this->t, OP_DOT, array_pop($operands), new JSNode($this->t)));
1164
-					}
1165
-					else
1207
+					} else
1166 1208
 					{
1167 1209
 						array_push($operators, new JSNode($this->t));
1168 1210
 						$this->t->scanOperand = true;
@@ -1172,8 +1214,9 @@  discard block
 block discarded – undo
1172 1214
 				case KEYWORD_DELETE: case KEYWORD_VOID: case KEYWORD_TYPEOF:
1173 1215
 				case OP_NOT: case OP_BITWISE_NOT: case OP_UNARY_PLUS: case OP_UNARY_MINUS:
1174 1216
 				case KEYWORD_NEW:
1175
-					if (!$this->t->scanOperand)
1176
-						break 2;
1217
+					if (!$this->t->scanOperand) {
1218
+											break 2;
1219
+					}
1177 1220
 
1178 1221
 					array_push($operators, new JSNode($this->t));
1179 1222
 				break;
@@ -1182,19 +1225,20 @@  discard block
 block discarded – undo
1182 1225
 					if ($this->t->scanOperand)
1183 1226
 					{
1184 1227
 						array_push($operators, new JSNode($this->t));  // prefix increment or decrement
1185
-					}
1186
-					else
1228
+					} else
1187 1229
 					{
1188 1230
 						// Don't cross a line boundary for postfix {in,de}crement.
1189 1231
 						$t = $this->t->tokens[($this->t->tokenIndex + $this->t->lookahead - 1) & 3];
1190
-						if ($t && $t->lineno != $this->t->lineno)
1191
-							break 2;
1232
+						if ($t && $t->lineno != $this->t->lineno) {
1233
+													break 2;
1234
+						}
1192 1235
 
1193 1236
 						if (!empty($operators))
1194 1237
 						{
1195 1238
 							// Use >, not >=, so postfix has higher precedence than prefix.
1196
-							while ($this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt])
1197
-								$this->reduce($operators, $operands);
1239
+							while ($this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt]) {
1240
+															$this->reduce($operators, $operands);
1241
+							}
1198 1242
 						}
1199 1243
 
1200 1244
 						$n = new JSNode($this->t, $tt, array_pop($operands));
@@ -1204,8 +1248,9 @@  discard block
 block discarded – undo
1204 1248
 				break;
1205 1249
 
1206 1250
 				case KEYWORD_FUNCTION:
1207
-					if (!$this->t->scanOperand)
1208
-						break 2;
1251
+					if (!$this->t->scanOperand) {
1252
+											break 2;
1253
+					}
1209 1254
 
1210 1255
 					array_push($operands, $this->FunctionDefinition($x, false, EXPRESSED_FORM));
1211 1256
 					$this->t->scanOperand = false;
@@ -1213,8 +1258,9 @@  discard block
 block discarded – undo
1213 1258
 
1214 1259
 				case KEYWORD_NULL: case KEYWORD_THIS: case KEYWORD_TRUE: case KEYWORD_FALSE:
1215 1260
 				case TOKEN_IDENTIFIER: case TOKEN_NUMBER: case TOKEN_STRING: case TOKEN_REGEXP:
1216
-					if (!$this->t->scanOperand)
1217
-						break 2;
1261
+					if (!$this->t->scanOperand) {
1262
+											break 2;
1263
+					}
1218 1264
 
1219 1265
 					array_push($operands, new JSNode($this->t));
1220 1266
 					$this->t->scanOperand = false;
@@ -1222,10 +1268,11 @@  discard block
 block discarded – undo
1222 1268
 
1223 1269
 				case TOKEN_CONDCOMMENT_START:
1224 1270
 				case TOKEN_CONDCOMMENT_END:
1225
-					if ($this->t->scanOperand)
1226
-						array_push($operators, new JSNode($this->t));
1227
-					else
1228
-						array_push($operands, new JSNode($this->t));
1271
+					if ($this->t->scanOperand) {
1272
+											array_push($operators, new JSNode($this->t));
1273
+					} else {
1274
+											array_push($operands, new JSNode($this->t));
1275
+					}
1229 1276
 				break;
1230 1277
 
1231 1278
 				case OP_LEFT_BRACKET:
@@ -1244,15 +1291,15 @@  discard block
 block discarded – undo
1244 1291
 							}
1245 1292
 
1246 1293
 							$n->addNode($this->Expression($x, OP_COMMA));
1247
-							if (!$this->t->match(OP_COMMA))
1248
-								break;
1294
+							if (!$this->t->match(OP_COMMA)) {
1295
+															break;
1296
+							}
1249 1297
 						}
1250 1298
 
1251 1299
 						$this->t->mustMatch(OP_RIGHT_BRACKET);
1252 1300
 						array_push($operands, $n);
1253 1301
 						$this->t->scanOperand = false;
1254
-					}
1255
-					else
1302
+					} else
1256 1303
 					{
1257 1304
 						// Property indexing operator.
1258 1305
 						array_push($operators, new JSNode($this->t, JS_INDEX));
@@ -1262,18 +1309,21 @@  discard block
 block discarded – undo
1262 1309
 				break;
1263 1310
 
1264 1311
 				case OP_RIGHT_BRACKET:
1265
-					if ($this->t->scanOperand || $x->bracketLevel == $bl)
1266
-						break 2;
1312
+					if ($this->t->scanOperand || $x->bracketLevel == $bl) {
1313
+											break 2;
1314
+					}
1267 1315
 
1268
-					while ($this->reduce($operators, $operands)->type != JS_INDEX)
1269
-						continue;
1316
+					while ($this->reduce($operators, $operands)->type != JS_INDEX) {
1317
+											continue;
1318
+					}
1270 1319
 
1271 1320
 					--$x->bracketLevel;
1272 1321
 				break;
1273 1322
 
1274 1323
 				case OP_LEFT_CURLY:
1275
-					if (!$this->t->scanOperand)
1276
-						break 2;
1324
+					if (!$this->t->scanOperand) {
1325
+											break 2;
1326
+					}
1277 1327
 
1278 1328
 					// Object initialiser.  As for array initialisers (see above),
1279 1329
 					// parse using recursive descent.
@@ -1287,12 +1337,12 @@  discard block
 block discarded – undo
1287 1337
 							$tv = $this->t->currentToken()->value;
1288 1338
 							if (($tv == 'get' || $tv == 'set') && $this->t->peek() == TOKEN_IDENTIFIER)
1289 1339
 							{
1290
-								if ($x->ecmaStrictMode)
1291
-									throw $this->t->newSyntaxError('Illegal property accessor');
1340
+								if ($x->ecmaStrictMode) {
1341
+																	throw $this->t->newSyntaxError('Illegal property accessor');
1342
+								}
1292 1343
 
1293 1344
 								$n->addNode($this->FunctionDefinition($x, true, EXPRESSED_FORM));
1294
-							}
1295
-							else
1345
+							} else
1296 1346
 							{
1297 1347
 								switch ($tt)
1298 1348
 								{
@@ -1303,8 +1353,9 @@  discard block
 block discarded – undo
1303 1353
 									break;
1304 1354
 
1305 1355
 									case OP_RIGHT_CURLY:
1306
-										if ($x->ecmaStrictMode)
1307
-											throw $this->t->newSyntaxError('Illegal trailing ,');
1356
+										if ($x->ecmaStrictMode) {
1357
+																					throw $this->t->newSyntaxError('Illegal trailing ,');
1358
+										}
1308 1359
 									break 3;
1309 1360
 
1310 1361
 									default:
@@ -1327,21 +1378,22 @@  discard block
 block discarded – undo
1327 1378
 				break;
1328 1379
 
1329 1380
 				case OP_RIGHT_CURLY:
1330
-					if (!$this->t->scanOperand && $x->curlyLevel != $cl)
1331
-						throw new Exception('PANIC: right curly botch');
1381
+					if (!$this->t->scanOperand && $x->curlyLevel != $cl) {
1382
+											throw new Exception('PANIC: right curly botch');
1383
+					}
1332 1384
 				break 2;
1333 1385
 
1334 1386
 				case OP_LEFT_PAREN:
1335 1387
 					if ($this->t->scanOperand)
1336 1388
 					{
1337 1389
 						array_push($operators, new JSNode($this->t, JS_GROUP));
1338
-					}
1339
-					else
1390
+					} else
1340 1391
 					{
1341 1392
 						while (	!empty($operators) &&
1342 1393
 							$this->opPrecedence[end($operators)->type] > $this->opPrecedence[KEYWORD_NEW]
1343
-						)
1344
-							$this->reduce($operators, $operands);
1394
+						) {
1395
+													$this->reduce($operators, $operands);
1396
+						}
1345 1397
 
1346 1398
 						// Handle () now, to regularize the n-ary case for n > 0.
1347 1399
 						// We must set scanOperand in case there are arguments and
@@ -1354,8 +1406,7 @@  discard block
 block discarded – undo
1354 1406
 							{
1355 1407
 								array_pop($operators);
1356 1408
 								$n->addNode(array_pop($operands));
1357
-							}
1358
-							else
1409
+							} else
1359 1410
 							{
1360 1411
 								$n = new JSNode($this->t, JS_CALL, array_pop($operands), new JSNode($this->t, JS_LIST));
1361 1412
 							}
@@ -1365,18 +1416,20 @@  discard block
 block discarded – undo
1365 1416
 							break;
1366 1417
 						}
1367 1418
 
1368
-						if ($n && $n->type == KEYWORD_NEW)
1369
-							$n->type = JS_NEW_WITH_ARGS;
1370
-						else
1371
-							array_push($operators, new JSNode($this->t, JS_CALL));
1419
+						if ($n && $n->type == KEYWORD_NEW) {
1420
+													$n->type = JS_NEW_WITH_ARGS;
1421
+						} else {
1422
+													array_push($operators, new JSNode($this->t, JS_CALL));
1423
+						}
1372 1424
 					}
1373 1425
 
1374 1426
 					++$x->parenLevel;
1375 1427
 				break;
1376 1428
 
1377 1429
 				case OP_RIGHT_PAREN:
1378
-					if ($this->t->scanOperand || $x->parenLevel == $pl)
1379
-						break 2;
1430
+					if ($this->t->scanOperand || $x->parenLevel == $pl) {
1431
+											break 2;
1432
+					}
1380 1433
 
1381 1434
 					while (($tt = $this->reduce($operators, $operands)->type) != JS_GROUP &&
1382 1435
 						$tt != JS_CALL && $tt != JS_NEW_WITH_ARGS
@@ -1388,10 +1441,11 @@  discard block
 block discarded – undo
1388 1441
 					if ($tt != JS_GROUP)
1389 1442
 					{
1390 1443
 						$n = end($operands);
1391
-						if ($n->treeNodes[1]->type != OP_COMMA)
1392
-							$n->treeNodes[1] = new JSNode($this->t, JS_LIST, $n->treeNodes[1]);
1393
-						else
1394
-							$n->treeNodes[1]->type = JS_LIST;
1444
+						if ($n->treeNodes[1]->type != OP_COMMA) {
1445
+													$n->treeNodes[1] = new JSNode($this->t, JS_LIST, $n->treeNodes[1]);
1446
+						} else {
1447
+													$n->treeNodes[1]->type = JS_LIST;
1448
+						}
1395 1449
 					}
1396 1450
 
1397 1451
 					--$x->parenLevel;
@@ -1405,24 +1459,29 @@  discard block
 block discarded – undo
1405 1459
 			}
1406 1460
 		}
1407 1461
 
1408
-		if ($x->hookLevel != $hl)
1409
-			throw $this->t->newSyntaxError('Missing : in conditional expression');
1462
+		if ($x->hookLevel != $hl) {
1463
+					throw $this->t->newSyntaxError('Missing : in conditional expression');
1464
+		}
1410 1465
 
1411
-		if ($x->parenLevel != $pl)
1412
-			throw $this->t->newSyntaxError('Missing ) in parenthetical');
1466
+		if ($x->parenLevel != $pl) {
1467
+					throw $this->t->newSyntaxError('Missing ) in parenthetical');
1468
+		}
1413 1469
 
1414
-		if ($x->bracketLevel != $bl)
1415
-			throw $this->t->newSyntaxError('Missing ] in index expression');
1470
+		if ($x->bracketLevel != $bl) {
1471
+					throw $this->t->newSyntaxError('Missing ] in index expression');
1472
+		}
1416 1473
 
1417
-		if ($this->t->scanOperand)
1418
-			throw $this->t->newSyntaxError('Missing operand');
1474
+		if ($this->t->scanOperand) {
1475
+					throw $this->t->newSyntaxError('Missing operand');
1476
+		}
1419 1477
 
1420 1478
 		// Resume default mode, scanning for operands, not operators.
1421 1479
 		$this->t->scanOperand = true;
1422 1480
 		$this->t->unget();
1423 1481
 
1424
-		while (count($operators))
1425
-			$this->reduce($operators, $operands);
1482
+		while (count($operators)) {
1483
+					$this->reduce($operators, $operands);
1484
+		}
1426 1485
 
1427 1486
 		return array_pop($operands);
1428 1487
 	}
@@ -1443,8 +1502,9 @@  discard block
 block discarded – undo
1443 1502
 		$n = $this->statement($x);
1444 1503
 		array_pop($x->stmtStack);
1445 1504
 
1446
-		if ($end)
1447
-			$this->t->mustMatch($end);
1505
+		if ($end) {
1506
+					$this->t->mustMatch($end);
1507
+		}
1448 1508
 
1449 1509
 		return $n;
1450 1510
 	}
@@ -1473,13 +1533,15 @@  discard block
 block discarded – undo
1473 1533
 
1474 1534
 		// Always use push to add operands to n, to update start and end
1475 1535
 		$a = array_splice($operands, $c - $arity);
1476
-		for ($i = 0; $i < $arity; $i++)
1477
-			$n->addNode($a[$i]);
1536
+		for ($i = 0; $i < $arity; $i++) {
1537
+					$n->addNode($a[$i]);
1538
+		}
1478 1539
 
1479 1540
 		// Include closing bracket or postfix operator in [start,end]
1480 1541
 		$te = $this->t->currentToken()->end;
1481
-		if ($n->end < $te)
1482
-			$n->end = $te;
1542
+		if ($n->end < $te) {
1543
+					$n->end = $te;
1544
+		}
1483 1545
 
1484 1546
 		array_push($operands, $n);
1485 1547
 
@@ -1528,8 +1590,7 @@  discard block
 block discarded – undo
1528 1590
 			$this->lineno = $token->lineno;
1529 1591
 			$this->start = $token->start;
1530 1592
 			$this->end = $token->end;
1531
-		}
1532
-		else
1593
+		} else
1533 1594
 		{
1534 1595
 			$this->type = $type;
1535 1596
 			$this->lineno = $t->lineno;
@@ -1538,8 +1599,9 @@  discard block
 block discarded – undo
1538 1599
 		if (($numargs = func_num_args()) > 2)
1539 1600
 		{
1540 1601
 			$args = func_get_args();;
1541
-			for ($i = 2; $i < $numargs; $i++)
1542
-				$this->addNode($args[$i]);
1602
+			for ($i = 2; $i < $numargs; $i++) {
1603
+							$this->addNode($args[$i]);
1604
+			}
1543 1605
 		}
1544 1606
 	}
1545 1607
 
@@ -1551,8 +1613,9 @@  discard block
 block discarded – undo
1551 1613
 
1552 1614
 	public function __get($name)
1553 1615
 	{
1554
-		if (isset($this->$name))
1555
-			return $this->$name;
1616
+		if (isset($this->$name)) {
1617
+					return $this->$name;
1618
+		}
1556 1619
 
1557 1620
 		return null;
1558 1621
 	}
@@ -1561,10 +1624,12 @@  discard block
 block discarded – undo
1561 1624
 	{
1562 1625
 		if ($node !== null)
1563 1626
 		{
1564
-			if ($node->start < $this->start)
1565
-				$this->start = $node->start;
1566
-			if ($this->end < $node->end)
1567
-				$this->end = $node->end;
1627
+			if ($node->start < $this->start) {
1628
+							$this->start = $node->start;
1629
+			}
1630
+			if ($this->end < $node->end) {
1631
+							$this->end = $node->end;
1632
+			}
1568 1633
 		}
1569 1634
 
1570 1635
 		$this->treeNodes[] = $node;
@@ -1649,14 +1714,16 @@  discard block
 block discarded – undo
1649 1714
 		$this->opRegExp = '#^(' . implode('|', array_map('preg_quote', array_keys($this->opTypeNames))) . ')#';
1650 1715
 
1651 1716
 		// this is quite a hidden yet convenient place to create the defines for operators and keywords
1652
-		foreach ($this->opTypeNames as $operand => $name)
1653
-			define('OP_' . $name, $operand);
1717
+		foreach ($this->opTypeNames as $operand => $name) {
1718
+					define('OP_' . $name, $operand);
1719
+		}
1654 1720
 
1655 1721
 		define('OP_UNARY_PLUS', 'U+');
1656 1722
 		define('OP_UNARY_MINUS', 'U-');
1657 1723
 
1658
-		foreach ($this->keywords as $keyword)
1659
-			define('KEYWORD_' . strtoupper($keyword), $keyword);
1724
+		foreach ($this->keywords as $keyword) {
1725
+					define('KEYWORD_' . strtoupper($keyword), $keyword);
1726
+		}
1660 1727
 	}
1661 1728
 
1662 1729
 	public function init($source, $filename = '', $lineno = 1)
@@ -1675,8 +1742,9 @@  discard block
 block discarded – undo
1675 1742
 
1676 1743
 	public function getInput($chunksize)
1677 1744
 	{
1678
-		if ($chunksize)
1679
-			return substr($this->source, $this->cursor, $chunksize);
1745
+		if ($chunksize) {
1746
+					return substr($this->source, $this->cursor, $chunksize);
1747
+		}
1680 1748
 
1681 1749
 		return substr($this->source, $this->cursor);
1682 1750
 	}
@@ -1693,8 +1761,9 @@  discard block
 block discarded – undo
1693 1761
 
1694 1762
 	public function mustMatch($tt)
1695 1763
 	{
1696
-	        if (!$this->match($tt))
1697
-			throw $this->newSyntaxError('Unexpected token; token ' . $tt . ' expected');
1764
+	        if (!$this->match($tt)) {
1765
+	        			throw $this->newSyntaxError('Unexpected token; token ' . $tt . ' expected');
1766
+	        }
1698 1767
 
1699 1768
 		return $this->currentToken();
1700 1769
 	}
@@ -1704,12 +1773,12 @@  discard block
 block discarded – undo
1704 1773
 		if ($this->lookahead)
1705 1774
 		{
1706 1775
 			$next = $this->tokens[($this->tokenIndex + $this->lookahead) & 3];
1707
-			if ($this->scanNewlines && $next->lineno != $this->lineno)
1708
-				$tt = TOKEN_NEWLINE;
1709
-			else
1710
-				$tt = $next->type;
1711
-		}
1712
-		else
1776
+			if ($this->scanNewlines && $next->lineno != $this->lineno) {
1777
+							$tt = TOKEN_NEWLINE;
1778
+			} else {
1779
+							$tt = $next->type;
1780
+			}
1781
+		} else
1713 1782
 		{
1714 1783
 			$tt = $this->get();
1715 1784
 			$this->unget();
@@ -1729,8 +1798,9 @@  discard block
 block discarded – undo
1729 1798
 
1730 1799
 	public function currentToken()
1731 1800
 	{
1732
-		if (!empty($this->tokens))
1733
-			return $this->tokens[$this->tokenIndex];
1801
+		if (!empty($this->tokens)) {
1802
+					return $this->tokens[$this->tokenIndex];
1803
+		}
1734 1804
 	}
1735 1805
 
1736 1806
 	public function get($chunksize = 1000)
@@ -1740,8 +1810,9 @@  discard block
 block discarded – undo
1740 1810
 			$this->lookahead--;
1741 1811
 			$this->tokenIndex = ($this->tokenIndex + 1) & 3;
1742 1812
 			$token = $this->tokens[$this->tokenIndex];
1743
-			if ($token->type != TOKEN_NEWLINE || $this->scanNewlines)
1744
-				return $token->type;
1813
+			if ($token->type != TOKEN_NEWLINE || $this->scanNewlines) {
1814
+							return $token->type;
1815
+			}
1745 1816
 		}
1746 1817
 
1747 1818
 		$conditional_comment = false;
@@ -1758,22 +1829,27 @@  discard block
 block discarded – undo
1758 1829
 				$spaces = $match[0];
1759 1830
 				$spacelen = strlen($spaces);
1760 1831
 				$this->cursor += $spacelen;
1761
-				if (!$this->scanNewlines)
1762
-					$this->lineno += substr_count($spaces, "\n");
1832
+				if (!$this->scanNewlines) {
1833
+									$this->lineno += substr_count($spaces, "\n");
1834
+				}
1763 1835
 
1764
-				if ($spacelen == $chunksize)
1765
-					continue; // complete chunk contained whitespace
1836
+				if ($spacelen == $chunksize) {
1837
+									continue;
1838
+				}
1839
+				// complete chunk contained whitespace
1766 1840
 
1767 1841
 				$input = $this->getInput($chunksize);
1768
-				if ($input == '' || $input[0] != '/')
1769
-					break;
1842
+				if ($input == '' || $input[0] != '/') {
1843
+									break;
1844
+				}
1770 1845
 			}
1771 1846
 
1772 1847
 			// Comments
1773 1848
 			if (!preg_match('/^\/(?:\*(@(?:cc_on|if|elif|else|end))?.*?\*\/|\/[^\n]*)/s', $input, $match))
1774 1849
 			{
1775
-				if (!$chunksize)
1776
-					break;
1850
+				if (!$chunksize) {
1851
+									break;
1852
+				}
1777 1853
 
1778 1854
 				// retry with a full chunk fetch; this also prevents breakage of long regular expressions (which will never match a comment)
1779 1855
 				$chunksize = null;
@@ -1786,8 +1862,7 @@  discard block
 block discarded – undo
1786 1862
 				$match[0] = '/*' . $match[1];
1787 1863
 				$conditional_comment = true;
1788 1864
 				break;
1789
-			}
1790
-			else
1865
+			} else
1791 1866
 			{
1792 1867
 				$this->cursor += strlen($match[0]);
1793 1868
 				$this->lineno += substr_count($match[0], "\n");
@@ -1798,12 +1873,10 @@  discard block
 block discarded – undo
1798 1873
 		{
1799 1874
 			$tt = TOKEN_END;
1800 1875
 			$match = array('');
1801
-		}
1802
-		elseif ($conditional_comment)
1876
+		} elseif ($conditional_comment)
1803 1877
 		{
1804 1878
 			$tt = TOKEN_CONDCOMMENT_START;
1805
-		}
1806
-		else
1879
+		} else
1807 1880
 		{
1808 1881
 			switch ($input[0])
1809 1882
 			{
@@ -1812,8 +1885,7 @@  discard block
 block discarded – undo
1812 1885
 					if (preg_match('/^\d+\.\d*(?:[eE][-+]?\d+)?|^\d+(?:\.\d*)?[eE][-+]?\d+/', $input, $match))
1813 1886
 					{
1814 1887
 						$tt = TOKEN_NUMBER;
1815
-					}
1816
-					else if (preg_match('/^0[xX][\da-fA-F]+|^0[0-7]*|^\d+/', $input, $match))
1888
+					} else if (preg_match('/^0[xX][\da-fA-F]+|^0[0-7]*|^\d+/', $input, $match))
1817 1889
 					{
1818 1890
 						// this should always match because of \d+
1819 1891
 						$tt = TOKEN_NUMBER;
@@ -1825,11 +1897,12 @@  discard block
 block discarded – undo
1825 1897
 					if (preg_match('/^"(?:\\\\(?:.|\r?\n)|[^\\\\"\r\n]+)*"|^\'(?:\\\\(?:.|\r?\n)|[^\\\\\'\r\n]+)*\'/', $input, $match))
1826 1898
 					{
1827 1899
 						$tt = TOKEN_STRING;
1828
-					}
1829
-					else
1900
+					} else
1830 1901
 					{
1831
-						if ($chunksize)
1832
-							return $this->get(null); // retry with a full chunk fetch
1902
+						if ($chunksize) {
1903
+													return $this->get(null);
1904
+						}
1905
+						// retry with a full chunk fetch
1833 1906
 
1834 1907
 						throw $this->newSyntaxError('Unterminated string literal');
1835 1908
 					}
@@ -1861,16 +1934,16 @@  discard block
 block discarded – undo
1861 1934
 					{
1862 1935
 						$tt = OP_ASSIGN;
1863 1936
 						$match[0] .= '=';
1864
-					}
1865
-					else
1937
+					} else
1866 1938
 					{
1867 1939
 						$tt = $op;
1868 1940
 						if ($this->scanOperand)
1869 1941
 						{
1870
-							if ($op == OP_PLUS)
1871
-								$tt = OP_UNARY_PLUS;
1872
-							elseif ($op == OP_MINUS)
1873
-								$tt = OP_UNARY_MINUS;
1942
+							if ($op == OP_PLUS) {
1943
+															$tt = OP_UNARY_PLUS;
1944
+							} elseif ($op == OP_MINUS) {
1945
+															$tt = OP_UNARY_MINUS;
1946
+							}
1874 1947
 						}
1875 1948
 						$op = null;
1876 1949
 					}
@@ -1906,9 +1979,9 @@  discard block
 block discarded – undo
1906 1979
 					{
1907 1980
 						$match = array('@*/');
1908 1981
 						$tt = TOKEN_CONDCOMMENT_END;
1982
+					} else {
1983
+											throw $this->newSyntaxError('Illegal token');
1909 1984
 					}
1910
-					else
1911
-						throw $this->newSyntaxError('Illegal token');
1912 1985
 				break;
1913 1986
 
1914 1987
 				case "\n":
@@ -1916,9 +1989,9 @@  discard block
 block discarded – undo
1916 1989
 					{
1917 1990
 						$match = array("\n");
1918 1991
 						$tt = TOKEN_NEWLINE;
1992
+					} else {
1993
+											throw $this->newSyntaxError('Illegal token');
1919 1994
 					}
1920
-					else
1921
-						throw $this->newSyntaxError('Illegal token');
1922 1995
 				break;
1923 1996
 
1924 1997
 				default:
@@ -1926,22 +1999,24 @@  discard block
 block discarded – undo
1926 1999
 					if (preg_match('/^[$\w]+/', $input, $match))
1927 2000
 					{
1928 2001
 						$tt = in_array($match[0], $this->keywords) ? $match[0] : TOKEN_IDENTIFIER;
2002
+					} else {
2003
+											throw $this->newSyntaxError('Illegal token');
1929 2004
 					}
1930
-					else
1931
-						throw $this->newSyntaxError('Illegal token');
1932 2005
 			}
1933 2006
 		}
1934 2007
 
1935 2008
 		$this->tokenIndex = ($this->tokenIndex + 1) & 3;
1936 2009
 
1937
-		if (!isset($this->tokens[$this->tokenIndex]))
1938
-			$this->tokens[$this->tokenIndex] = new JSToken();
2010
+		if (!isset($this->tokens[$this->tokenIndex])) {
2011
+					$this->tokens[$this->tokenIndex] = new JSToken();
2012
+		}
1939 2013
 
1940 2014
 		$token = $this->tokens[$this->tokenIndex];
1941 2015
 		$token->type = $tt;
1942 2016
 
1943
-		if ($tt == OP_ASSIGN)
1944
-			$token->assignOp = $op;
2017
+		if ($tt == OP_ASSIGN) {
2018
+					$token->assignOp = $op;
2019
+		}
1945 2020
 
1946 2021
 		$token->start = $this->cursor;
1947 2022
 
@@ -1956,8 +2031,9 @@  discard block
 block discarded – undo
1956 2031
 
1957 2032
 	public function unget()
1958 2033
 	{
1959
-		if (++$this->lookahead == 4)
1960
-			throw $this->newSyntaxError('PANIC: too much lookahead!');
2034
+		if (++$this->lookahead == 4) {
2035
+					throw $this->newSyntaxError('PANIC: too much lookahead!');
2036
+		}
1961 2037
 
1962 2038
 		$this->tokenIndex = ($this->tokenIndex - 1) & 3;
1963 2039
 	}
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 		$this->parser = new JSParser();
115 115
 	}
116 116
 
117
-	public static function minify($js, $filename='')
117
+	public static function minify($js, $filename = '')
118 118
 	{
119 119
 		static $instance;
120 120
 
121 121
 		// this is a singleton
122
-		if(!$instance)
122
+		if (!$instance)
123 123
 			$instance = new JSMinPlus();
124 124
 
125 125
 		return $instance->min($js, $filename);
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			$n = $this->parser->parse($js, $filename, 1);
133 133
 			return $this->parseTree($n);
134 134
 		}
135
-		catch(Exception $e)
135
+		catch (Exception $e)
136 136
 		{
137
-			echo $e->getMessage() . "\n";
137
+			echo $e->getMessage()."\n";
138 138
 		}
139 139
 
140 140
 		return false;
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 		switch ($n->type)
148 148
 		{
149 149
 			case KEYWORD_FUNCTION:
150
-				$s .= 'function' . ($n->name ? ' ' . $n->name : '') . '(';
150
+				$s .= 'function'.($n->name ? ' '.$n->name : '').'(';
151 151
 				$params = $n->params;
152 152
 				for ($i = 0, $j = count($params); $i < $j; $i++)
153
-					$s .= ($i ? ',' : '') . $params[$i];
154
-				$s .= '){' . $this->parseTree($n->body, true) . '}';
153
+					$s .= ($i ? ',' : '').$params[$i];
154
+				$s .= '){'.$this->parseTree($n->body, true).'}';
155 155
 			break;
156 156
 
157 157
 			case JS_SCRIPT:
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 							elseif ($type == KEYWORD_VAR && $type == $lastType)
181 181
 							{
182 182
 								// mutiple var-statements can go into one
183
-								$t = ',' . substr($t, 4);
183
+								$t = ','.substr($t, 4);
184 184
 							}
185 185
 							else
186 186
 							{
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 
199 199
 				if ($c > 1 && !$noBlockGrouping)
200 200
 				{
201
-					$s = '{' . $s . '}';
201
+					$s = '{'.$s.'}';
202 202
 				}
203 203
 			break;
204 204
 
205 205
 			case KEYWORD_IF:
206
-				$s = 'if(' . $this->parseTree($n->condition) . ')';
206
+				$s = 'if('.$this->parseTree($n->condition).')';
207 207
 				$thenPart = $this->parseTree($n->thenPart);
208 208
 				$elsePart = $n->elsePart ? $this->parseTree($n->elsePart) : null;
209 209
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 				{
216 216
 					// be carefull and always make a block out of the thenPart; could be more optimized but is a lot of trouble
217 217
 					if ($thenPart != ';' && $thenPart[0] != '{')
218
-						$thenPart = '{' . $thenPart . '}';
218
+						$thenPart = '{'.$thenPart.'}';
219 219
 
220
-					$s .= $thenPart . 'else';
220
+					$s .= $thenPart.'else';
221 221
 
222 222
 					// we could check for more, but that hardly ever applies so go for performance
223 223
 					if ($elsePart[0] != '{')
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 			break;
233 233
 
234 234
 			case KEYWORD_SWITCH:
235
-				$s = 'switch(' . $this->parseTree($n->discriminant) . '){';
235
+				$s = 'switch('.$this->parseTree($n->discriminant).'){';
236 236
 				$cases = $n->cases;
237 237
 				for ($i = 0, $j = count($cases); $i < $j; $i++)
238 238
 				{
239 239
 					$case = $cases[$i];
240 240
 					if ($case->type == KEYWORD_CASE)
241
-						$s .= 'case' . ($case->caseLabel->type != TOKEN_STRING ? ' ' : '') . $this->parseTree($case->caseLabel) . ':';
241
+						$s .= 'case'.($case->caseLabel->type != TOKEN_STRING ? ' ' : '').$this->parseTree($case->caseLabel).':';
242 242
 					else
243 243
 						$s .= 'default:';
244 244
 
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 			break;
256 256
 
257 257
 			case KEYWORD_FOR:
258
-				$s = 'for(' . ($n->setup ? $this->parseTree($n->setup) : '')
259
-					. ';' . ($n->condition ? $this->parseTree($n->condition) : '')
260
-					. ';' . ($n->update ? $this->parseTree($n->update) : '') . ')';
258
+				$s = 'for('.($n->setup ? $this->parseTree($n->setup) : '')
259
+					. ';'.($n->condition ? $this->parseTree($n->condition) : '')
260
+					. ';'.($n->update ? $this->parseTree($n->update) : '').')';
261 261
 
262 262
 				$body  = $this->parseTree($n->body);
263 263
 				if ($body == '')
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			break;
268 268
 
269 269
 			case KEYWORD_WHILE:
270
-				$s = 'while(' . $this->parseTree($n->condition) . ')';
270
+				$s = 'while('.$this->parseTree($n->condition).')';
271 271
 
272 272
 				$body  = $this->parseTree($n->body);
273 273
 				if ($body == '')
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			break;
278 278
 
279 279
 			case JS_FOR_IN:
280
-				$s = 'for(' . ($n->varDecl ? $this->parseTree($n->varDecl) : $this->parseTree($n->iterator)) . ' in ' . $this->parseTree($n->object) . ')';
280
+				$s = 'for('.($n->varDecl ? $this->parseTree($n->varDecl) : $this->parseTree($n->iterator)).' in '.$this->parseTree($n->object).')';
281 281
 
282 282
 				$body  = $this->parseTree($n->body);
283 283
 				if ($body == '')
@@ -287,28 +287,28 @@  discard block
 block discarded – undo
287 287
 			break;
288 288
 
289 289
 			case KEYWORD_DO:
290
-				$s = 'do{' . $this->parseTree($n->body, true) . '}while(' . $this->parseTree($n->condition) . ')';
290
+				$s = 'do{'.$this->parseTree($n->body, true).'}while('.$this->parseTree($n->condition).')';
291 291
 			break;
292 292
 
293 293
 			case KEYWORD_BREAK:
294 294
 			case KEYWORD_CONTINUE:
295
-				$s = $n->value . ($n->label ? ' ' . $n->label : '');
295
+				$s = $n->value.($n->label ? ' '.$n->label : '');
296 296
 			break;
297 297
 
298 298
 			case KEYWORD_TRY:
299
-				$s = 'try{' . $this->parseTree($n->tryBlock, true) . '}';
299
+				$s = 'try{'.$this->parseTree($n->tryBlock, true).'}';
300 300
 				$catchClauses = $n->catchClauses;
301 301
 				for ($i = 0, $j = count($catchClauses); $i < $j; $i++)
302 302
 				{
303 303
 					$t = $catchClauses[$i];
304
-					$s .= 'catch(' . $t->varName . ($t->guard ? ' if ' . $this->parseTree($t->guard) : '') . '){' . $this->parseTree($t->block, true) . '}';
304
+					$s .= 'catch('.$t->varName.($t->guard ? ' if '.$this->parseTree($t->guard) : '').'){'.$this->parseTree($t->block, true).'}';
305 305
 				}
306 306
 				if ($n->finallyBlock)
307
-					$s .= 'finally{' . $this->parseTree($n->finallyBlock, true) . '}';
307
+					$s .= 'finally{'.$this->parseTree($n->finallyBlock, true).'}';
308 308
 			break;
309 309
 
310 310
 			case KEYWORD_THROW:
311
-				$s = 'throw ' . $this->parseTree($n->exception);
311
+				$s = 'throw '.$this->parseTree($n->exception);
312 312
 			break;
313 313
 
314 314
 			case KEYWORD_RETURN:
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 					$t = $this->parseTree($n->value);
319 319
 					if (strlen($t))
320 320
 					{
321
-						if (	$t[0] != '(' && $t[0] != '[' && $t[0] != '{' &&
321
+						if ($t[0] != '(' && $t[0] != '[' && $t[0] != '{' &&
322 322
 							$t[0] != '"' && $t[0] != "'" && $t[0] != '/'
323 323
 						)
324 324
 							$s .= ' ';
@@ -329,20 +329,20 @@  discard block
 block discarded – undo
329 329
 			break;
330 330
 
331 331
 			case KEYWORD_WITH:
332
-				$s = 'with(' . $this->parseTree($n->object) . ')' . $this->parseTree($n->body);
332
+				$s = 'with('.$this->parseTree($n->object).')'.$this->parseTree($n->body);
333 333
 			break;
334 334
 
335 335
 			case KEYWORD_VAR:
336 336
 			case KEYWORD_CONST:
337
-				$s = $n->value . ' ';
337
+				$s = $n->value.' ';
338 338
 				$childs = $n->treeNodes;
339 339
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
340 340
 				{
341 341
 					$t = $childs[$i];
342
-					$s .= ($i ? ',' : '') . $t->name;
342
+					$s .= ($i ? ',' : '').$t->name;
343 343
 					$u = $t->initializer;
344 344
 					if ($u)
345
-						$s .= '=' . $this->parseTree($u);
345
+						$s .= '='.$this->parseTree($u);
346 346
 				}
347 347
 			break;
348 348
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 			case TOKEN_CONDCOMMENT_START:
354 354
 			case TOKEN_CONDCOMMENT_END:
355
-				$s = $n->value . ($n->type == TOKEN_CONDCOMMENT_START ? ' ' : '');
355
+				$s = $n->value.($n->type == TOKEN_CONDCOMMENT_START ? ' ' : '');
356 356
 				$childs = $n->treeNodes;
357 357
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
358 358
 					$s .= $this->parseTree($childs[$i]);
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
 			break;
365 365
 
366 366
 			case JS_LABEL:
367
-				$s = $n->label . ':' . $this->parseTree($n->statement);
367
+				$s = $n->label.':'.$this->parseTree($n->statement);
368 368
 			break;
369 369
 
370 370
 			case OP_COMMA:
371 371
 				$childs = $n->treeNodes;
372 372
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
373
-					$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
373
+					$s .= ($i ? ',' : '').$this->parseTree($childs[$i]);
374 374
 			break;
375 375
 
376 376
 			case OP_ASSIGN:
377
-				$s = $this->parseTree($n->treeNodes[0]) . $n->value . $this->parseTree($n->treeNodes[1]);
377
+				$s = $this->parseTree($n->treeNodes[0]).$n->value.$this->parseTree($n->treeNodes[1]);
378 378
 			break;
379 379
 
380 380
 			case OP_HOOK:
381
-				$s = $this->parseTree($n->treeNodes[0]) . '?' . $this->parseTree($n->treeNodes[1]) . ':' . $this->parseTree($n->treeNodes[2]);
381
+				$s = $this->parseTree($n->treeNodes[0]).'?'.$this->parseTree($n->treeNodes[1]).':'.$this->parseTree($n->treeNodes[2]);
382 382
 			break;
383 383
 
384 384
 			case OP_OR: case OP_AND:
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 			case OP_LT: case OP_LE: case OP_GE: case OP_GT:
388 388
 			case OP_LSH: case OP_RSH: case OP_URSH:
389 389
 			case OP_MUL: case OP_DIV: case OP_MOD:
390
-				$s = $this->parseTree($n->treeNodes[0]) . $n->type . $this->parseTree($n->treeNodes[1]);
390
+				$s = $this->parseTree($n->treeNodes[0]).$n->type.$this->parseTree($n->treeNodes[1]);
391 391
 			break;
392 392
 
393 393
 			case OP_PLUS:
@@ -403,87 +403,87 @@  discard block
 block discarded – undo
403 403
 					case OP_DECREMENT:
404 404
 					case OP_UNARY_PLUS:
405 405
 					case OP_UNARY_MINUS:
406
-						$s = $left . $n->type . ' ' . $right;
406
+						$s = $left.$n->type.' '.$right;
407 407
 					break;
408 408
 
409 409
 					case TOKEN_STRING:
410 410
 						//combine concatted strings with same quotestyle
411 411
 						if ($n->type == OP_PLUS && substr($left, -1) == $right[0])
412 412
 						{
413
-							$s = substr($left, 0, -1) . substr($right, 1);
413
+							$s = substr($left, 0, -1).substr($right, 1);
414 414
 							break;
415 415
 						}
416 416
 					// FALL THROUGH
417 417
 
418 418
 					default:
419
-						$s = $left . $n->type . $right;
419
+						$s = $left.$n->type.$right;
420 420
 				}
421 421
 			break;
422 422
 
423 423
 			case KEYWORD_IN:
424
-				$s = $this->parseTree($n->treeNodes[0]) . ' in ' . $this->parseTree($n->treeNodes[1]);
424
+				$s = $this->parseTree($n->treeNodes[0]).' in '.$this->parseTree($n->treeNodes[1]);
425 425
 			break;
426 426
 
427 427
 			case KEYWORD_INSTANCEOF:
428
-				$s = $this->parseTree($n->treeNodes[0]) . ' instanceof ' . $this->parseTree($n->treeNodes[1]);
428
+				$s = $this->parseTree($n->treeNodes[0]).' instanceof '.$this->parseTree($n->treeNodes[1]);
429 429
 			break;
430 430
 
431 431
 			case KEYWORD_DELETE:
432
-				$s = 'delete ' . $this->parseTree($n->treeNodes[0]);
432
+				$s = 'delete '.$this->parseTree($n->treeNodes[0]);
433 433
 			break;
434 434
 
435 435
 			case KEYWORD_VOID:
436
-				$s = 'void(' . $this->parseTree($n->treeNodes[0]) . ')';
436
+				$s = 'void('.$this->parseTree($n->treeNodes[0]).')';
437 437
 			break;
438 438
 
439 439
 			case KEYWORD_TYPEOF:
440
-				$s = 'typeof ' . $this->parseTree($n->treeNodes[0]);
440
+				$s = 'typeof '.$this->parseTree($n->treeNodes[0]);
441 441
 			break;
442 442
 
443 443
 			case OP_NOT:
444 444
 			case OP_BITWISE_NOT:
445 445
 			case OP_UNARY_PLUS:
446 446
 			case OP_UNARY_MINUS:
447
-				$s = $n->value . $this->parseTree($n->treeNodes[0]);
447
+				$s = $n->value.$this->parseTree($n->treeNodes[0]);
448 448
 			break;
449 449
 
450 450
 			case OP_INCREMENT:
451 451
 			case OP_DECREMENT:
452 452
 				if ($n->postfix)
453
-					$s = $this->parseTree($n->treeNodes[0]) . $n->value;
453
+					$s = $this->parseTree($n->treeNodes[0]).$n->value;
454 454
 				else
455
-					$s = $n->value . $this->parseTree($n->treeNodes[0]);
455
+					$s = $n->value.$this->parseTree($n->treeNodes[0]);
456 456
 			break;
457 457
 
458 458
 			case OP_DOT:
459
-				$s = $this->parseTree($n->treeNodes[0]) . '.' . $this->parseTree($n->treeNodes[1]);
459
+				$s = $this->parseTree($n->treeNodes[0]).'.'.$this->parseTree($n->treeNodes[1]);
460 460
 			break;
461 461
 
462 462
 			case JS_INDEX:
463 463
 				$s = $this->parseTree($n->treeNodes[0]);
464 464
 				// See if we can replace named index with a dot saving 3 bytes
465
-				if (	$n->treeNodes[0]->type == TOKEN_IDENTIFIER &&
465
+				if ($n->treeNodes[0]->type == TOKEN_IDENTIFIER &&
466 466
 					$n->treeNodes[1]->type == TOKEN_STRING &&
467 467
 					$this->isValidIdentifier(substr($n->treeNodes[1]->value, 1, -1))
468 468
 				)
469
-					$s .= '.' . substr($n->treeNodes[1]->value, 1, -1);
469
+					$s .= '.'.substr($n->treeNodes[1]->value, 1, -1);
470 470
 				else
471
-					$s .= '[' . $this->parseTree($n->treeNodes[1]) . ']';
471
+					$s .= '['.$this->parseTree($n->treeNodes[1]).']';
472 472
 			break;
473 473
 
474 474
 			case JS_LIST:
475 475
 				$childs = $n->treeNodes;
476 476
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
477
-					$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
477
+					$s .= ($i ? ',' : '').$this->parseTree($childs[$i]);
478 478
 			break;
479 479
 
480 480
 			case JS_CALL:
481
-				$s = $this->parseTree($n->treeNodes[0]) . '(' . $this->parseTree($n->treeNodes[1]) . ')';
481
+				$s = $this->parseTree($n->treeNodes[0]).'('.$this->parseTree($n->treeNodes[1]).')';
482 482
 			break;
483 483
 
484 484
 			case KEYWORD_NEW:
485 485
 			case JS_NEW_WITH_ARGS:
486
-				$s = 'new ' . $this->parseTree($n->treeNodes[0]) . '(' . ($n->type == JS_NEW_WITH_ARGS ? $this->parseTree($n->treeNodes[1]) : '') . ')';
486
+				$s = 'new '.$this->parseTree($n->treeNodes[0]).'('.($n->type == JS_NEW_WITH_ARGS ? $this->parseTree($n->treeNodes[1]) : '').')';
487 487
 			break;
488 488
 
489 489
 			case JS_ARRAY_INIT:
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 				$childs = $n->treeNodes;
492 492
 				for ($i = 0, $j = count($childs); $i < $j; $i++)
493 493
 				{
494
-					$s .= ($i ? ',' : '') . $this->parseTree($childs[$i]);
494
+					$s .= ($i ? ',' : '').$this->parseTree($childs[$i]);
495 495
 				}
496 496
 				$s .= ']';
497 497
 			break;
@@ -507,23 +507,23 @@  discard block
 block discarded – undo
507 507
 					if ($t->type == JS_PROPERTY_INIT)
508 508
 					{
509 509
 						// Ditch the quotes when the index is a valid identifier
510
-						if (	$t->treeNodes[0]->type == TOKEN_STRING &&
510
+						if ($t->treeNodes[0]->type == TOKEN_STRING &&
511 511
 							$this->isValidIdentifier(substr($t->treeNodes[0]->value, 1, -1))
512 512
 						)
513 513
 							$s .= substr($t->treeNodes[0]->value, 1, -1);
514 514
 						else
515 515
 							$s .= $t->treeNodes[0]->value;
516 516
 
517
-						$s .= ':' . $this->parseTree($t->treeNodes[1]);
517
+						$s .= ':'.$this->parseTree($t->treeNodes[1]);
518 518
 					}
519 519
 					else
520 520
 					{
521 521
 						$s .= $t->type == JS_GETTER ? 'get' : 'set';
522
-						$s .= ' ' . $t->name . '(';
522
+						$s .= ' '.$t->name.'(';
523 523
 						$params = $t->params;
524 524
 						for ($i = 0, $j = count($params); $i < $j; $i++)
525
-							$s .= ($i ? ',' : '') . $params[$i];
526
-						$s .= '){' . $this->parseTree($t->body, true) . '}';
525
+							$s .= ($i ? ',' : '').$params[$i];
526
+						$s .= '){'.$this->parseTree($t->body, true).'}';
527 527
 					}
528 528
 				}
529 529
 				$s .= '}';
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 			break;
536 536
 
537 537
 			case JS_GROUP:
538
-				$s = '(' . $this->parseTree($n->treeNodes[0]) . ')';
538
+				$s = '('.$this->parseTree($n->treeNodes[0]).')';
539 539
 			break;
540 540
 
541 541
 			default:
542
-				throw new Exception('UNKNOWN TOKEN TYPE: ' . $n->type);
542
+				throw new Exception('UNKNOWN TOKEN TYPE: '.$n->type);
543 543
 		}
544 544
 
545 545
 		return $s;
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 					do
835 835
 					{
836 836
 						if (--$i < 0)
837
-							throw $this->t->newSyntaxError('Invalid ' . $tt);
837
+							throw $this->t->newSyntaxError('Invalid '.$tt);
838 838
 					}
839 839
 					while (!$ss[$i]->isLoop && ($tt != KEYWORD_BREAK || $ss[$i]->type != KEYWORD_SWITCH));
840 840
 				}
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		return $n;
1042 1042
 	}
1043 1043
 
1044
-	private function Expression($x, $stop=false)
1044
+	private function Expression($x, $stop = false)
1045 1045
 	{
1046 1046
 		$operators = array();
1047 1047
 		$operands = array();
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 					if ($this->t->scanOperand)
1077 1077
 						break 2;
1078 1078
 
1079
-					while (	!empty($operators) &&
1079
+					while (!empty($operators) &&
1080 1080
 						$this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt]
1081 1081
 					)
1082 1082
 						$this->reduce($operators, $operands);
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 						break 2;
1107 1107
 
1108 1108
 					// Use >, not >=, for right-associative ASSIGN
1109
-					while (	!empty($operators) &&
1109
+					while (!empty($operators) &&
1110 1110
 						$this->opPrecedence[end($operators)->type] > $this->opPrecedence[$tt]
1111 1111
 					)
1112 1112
 						$this->reduce($operators, $operands);
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 					if ($this->t->scanOperand)
1153 1153
 						break 2;
1154 1154
 
1155
-					while (	!empty($operators) &&
1155
+					while (!empty($operators) &&
1156 1156
 						$this->opPrecedence[end($operators)->type] >= $this->opPrecedence[$tt]
1157 1157
 					)
1158 1158
 						$this->reduce($operators, $operands);
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 				case OP_INCREMENT: case OP_DECREMENT:
1182 1182
 					if ($this->t->scanOperand)
1183 1183
 					{
1184
-						array_push($operators, new JSNode($this->t));  // prefix increment or decrement
1184
+						array_push($operators, new JSNode($this->t)); // prefix increment or decrement
1185 1185
 					}
1186 1186
 					else
1187 1187
 					{
@@ -1338,7 +1338,7 @@  discard block
 block discarded – undo
1338 1338
 					}
1339 1339
 					else
1340 1340
 					{
1341
-						while (	!empty($operators) &&
1341
+						while (!empty($operators) &&
1342 1342
 							$this->opPrecedence[end($operators)->type] > $this->opPrecedence[KEYWORD_NEW]
1343 1343
 						)
1344 1344
 							$this->reduce($operators, $operands);
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 	public $funDecls = array();
1520 1520
 	public $varDecls = array();
1521 1521
 
1522
-	public function __construct($t, $type=0)
1522
+	public function __construct($t, $type = 0)
1523 1523
 	{
1524 1524
 		if ($token = $t->currentToken())
1525 1525
 		{
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 
1538 1538
 		if (($numargs = func_num_args()) > 2)
1539 1539
 		{
1540
-			$args = func_get_args();;
1540
+			$args = func_get_args(); ;
1541 1541
 			for ($i = 2; $i < $numargs; $i++)
1542 1542
 				$this->addNode($args[$i]);
1543 1543
 		}
@@ -1646,17 +1646,17 @@  discard block
 block discarded – undo
1646 1646
 
1647 1647
 	public function __construct()
1648 1648
 	{
1649
-		$this->opRegExp = '#^(' . implode('|', array_map('preg_quote', array_keys($this->opTypeNames))) . ')#';
1649
+		$this->opRegExp = '#^('.implode('|', array_map('preg_quote', array_keys($this->opTypeNames))).')#';
1650 1650
 
1651 1651
 		// this is quite a hidden yet convenient place to create the defines for operators and keywords
1652 1652
 		foreach ($this->opTypeNames as $operand => $name)
1653
-			define('OP_' . $name, $operand);
1653
+			define('OP_'.$name, $operand);
1654 1654
 
1655 1655
 		define('OP_UNARY_PLUS', 'U+');
1656 1656
 		define('OP_UNARY_MINUS', 'U-');
1657 1657
 
1658 1658
 		foreach ($this->keywords as $keyword)
1659
-			define('KEYWORD_' . strtoupper($keyword), $keyword);
1659
+			define('KEYWORD_'.strtoupper($keyword), $keyword);
1660 1660
 	}
1661 1661
 
1662 1662
 	public function init($source, $filename = '', $lineno = 1)
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 	public function mustMatch($tt)
1695 1695
 	{
1696 1696
 	        if (!$this->match($tt))
1697
-			throw $this->newSyntaxError('Unexpected token; token ' . $tt . ' expected');
1697
+			throw $this->newSyntaxError('Unexpected token; token '.$tt.' expected');
1698 1698
 
1699 1699
 		return $this->currentToken();
1700 1700
 	}
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 
1736 1736
 	public function get($chunksize = 1000)
1737 1737
 	{
1738
-		while($this->lookahead)
1738
+		while ($this->lookahead)
1739 1739
 		{
1740 1740
 			$this->lookahead--;
1741 1741
 			$this->tokenIndex = ($this->tokenIndex + 1) & 3;
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 		$conditional_comment = false;
1748 1748
 
1749 1749
 		// strip whitespace and comments
1750
-		while(true)
1750
+		while (true)
1751 1751
 		{
1752 1752
 			$input = $this->getInput($chunksize);
1753 1753
 
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 			// check if this is a conditional (JScript) comment
1784 1784
 			if (!empty($match[1]))
1785 1785
 			{
1786
-				$match[0] = '/*' . $match[1];
1786
+				$match[0] = '/*'.$match[1];
1787 1787
 				$conditional_comment = true;
1788 1788
 				break;
1789 1789
 			}
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 
1965 1965
 	public function newSyntaxError($m)
1966 1966
 	{
1967
-		return new Exception('Parse error: ' . $m . ' in file \'' . $this->filename . '\' on line ' . $this->lineno);
1967
+		return new Exception('Parse error: '.$m.' in file \''.$this->filename.'\' on line '.$this->lineno);
1968 1968
 	}
1969 1969
 }
1970 1970
 
Please login to merge, or discard this patch.
tools/minify/minify.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -172,6 +172,9 @@  discard block
 block discarded – undo
172 172
 	}
173 173
 }
174 174
 
175
+/**
176
+ * @param string $ext
177
+ */
175 178
 function get_target_files($ext, $dir, $files_to_skip) {
176 179
 	$files = glob("{$dir}*.{$ext}");
177 180
 	$skips = glob("{$dir}*.min.{$ext}");
@@ -181,6 +184,9 @@  discard block
 block discarded – undo
181 184
 	return $files;
182 185
 }
183 186
 
187
+/**
188
+ * @param string $content
189
+ */
184 190
 function closure_compile($content) {
185 191
 	require_once dirname(__FILE__).'/../../classes/httprequest/XEHttpRequest.class.php';
186 192
 
Please login to merge, or discard this patch.
Braces   +49 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,9 +21,13 @@  discard block
 block discarded – undo
21 21
 	$argc = $_SERVER['argc'];
22 22
 
23 23
 	// get target directories
24
-	if($argc < 1) exit;
25
-	elseif($argc < 2) $dirs = array($_SERVER['PWD']);
26
-	else $dirs = array_slice($argv, 1);
24
+	if($argc < 1) {
25
+		exit;
26
+	} elseif($argc < 2) {
27
+		$dirs = array($_SERVER['PWD']);
28
+	} else {
29
+		$dirs = array_slice($argv, 1);
30
+	}
27 31
 
28 32
 	$dirs = array_map('realpath', $dirs);
29 33
 	$dirs = array_map('add_dirsep', $dirs);
@@ -33,7 +37,9 @@  discard block
 block discarded – undo
33 37
 
34 38
 // add directory separator
35 39
 function add_dirsep($path) {
36
-	if(substr($path,-1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR;
40
+	if(substr($path,-1) != DIRECTORY_SEPARATOR) {
41
+		$path .= DIRECTORY_SEPARATOR;
42
+	}
37 43
 	return $path;
38 44
 }
39 45
 
@@ -53,7 +59,9 @@  discard block
 block discarded – undo
53 59
 	// files to skip
54 60
 	$files_to_skip = $config['skip'];
55 61
 	foreach($files_to_skip as $idx=>$file) {
56
-		if($file) $files_to_skip[$idx] = realpath($dir.trim($file));
62
+		if($file) {
63
+			$files_to_skip[$idx] = realpath($dir.trim($file));
64
+		}
57 65
 	}
58 66
 
59 67
 	echo "  Minifying JavaScript files...";
@@ -63,7 +71,9 @@  discard block
 block discarded – undo
63 71
 		require dirname(__FILE__).'/jsminplus/jsminplus.php';
64 72
 	}
65 73
 	foreach($js_files as $file) {
66
-		if(!is_readable($file)) continue;
74
+		if(!is_readable($file)) {
75
+			continue;
76
+		}
67 77
 
68 78
 		$target  = preg_replace('@\.js$@', '.min.js', $file);
69 79
 		$content = file_get_contents($file);
@@ -102,7 +112,9 @@  discard block
 block discarded – undo
102 112
 	$oCSSmin = new CSSmin();
103 113
 
104 114
 	foreach($css_files as $file) {
105
-		if(!is_readable($file)) continue;
115
+		if(!is_readable($file)) {
116
+			continue;
117
+		}
106 118
 
107 119
 		$target  = preg_replace('@\.css$@', '.min.css', $file);
108 120
 		$content = file_get_contents($file);
@@ -117,51 +129,71 @@  discard block
 block discarded – undo
117 129
 	$default = array('option'=>array(), 'skip'=>array(), 'merge'=>array());
118 130
 	$file    = $dir.'minify.ini';
119 131
 
120
-	if(!is_readable($file)) return $default;
132
+	if(!is_readable($file)) {
133
+		return $default;
134
+	}
121 135
 
122 136
 	$config_str = file_get_contents($file);
123 137
 	$config_str = preg_replace_callback('/(\[(?:skip|merge *>> *.+?)\])([\s\S]+?)(?=\[|$)/', 'transform_config_str', $config_str);
124 138
 
125 139
 	$config = parse_ini_string($config_str, 1);
126
-	if($config === false) return $default;
140
+	if($config === false) {
141
+		return $default;
142
+	}
127 143
 
128
-	if(is_array($config['skip'])) $config['skip'] = array_keys($config['skip']);
144
+	if(is_array($config['skip'])) {
145
+		$config['skip'] = array_keys($config['skip']);
146
+	}
129 147
 
130 148
 	foreach($config as $section=>$value) {
131 149
 		if(preg_match('/merge *>> *(.+)/', $section, $match)) {
132
-			if(!is_array($config['merge'])) $config['merge'] = array();
150
+			if(!is_array($config['merge'])) {
151
+				$config['merge'] = array();
152
+			}
133 153
 			$config['merge'][trim($match[1])] = array_keys($value);
134 154
 
135 155
 			unset($config[$section]);
136 156
 		}
137 157
 	}
138 158
 
139
-	if(is_array($config['option'])) $config = array_merge($config['option'], $config);
159
+	if(is_array($config['option'])) {
160
+		$config = array_merge($config['option'], $config);
161
+	}
140 162
 	$config = array_merge($default, $config);
141 163
 
142 164
 	return $config;
143 165
 }
144 166
 
145 167
 function transform_config_str($matches) {
146
-	if(!$matches[2]) return $matches[0];
168
+	if(!$matches[2]) {
169
+		return $matches[0];
170
+	}
147 171
 	$values = preg_replace('/$/m', '=', trim($matches[2]));
148 172
 
149 173
 	return "{$matches[1]}\n{$values}\n\n";
150 174
 }
151 175
 
152 176
 function merge($files, $target, $base_dir) {
153
-	if(!is_array($files)) return false;
177
+	if(!is_array($files)) {
178
+		return false;
179
+	}
154 180
 
155 181
 	$body   = '';
156 182
 	$is_css = !!preg_match('/\.css$/', $target);
157 183
 
158 184
 	foreach($files as $file) {
159 185
 		$file = $base_dir.trim($file);
160
-		if(!is_readable($file)) continue;
186
+		if(!is_readable($file)) {
187
+			continue;
188
+		}
161 189
 
162 190
 		$content = trim(file_get_contents($file));
163
-		if($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content);
164
-		if($content) $body .= $content."\n";
191
+		if($is_css && $body) {
192
+			$content = preg_replace('/^@.+?;/m', '', $content);
193
+		}
194
+		if($content) {
195
+			$body .= $content."\n";
196
+		}
165 197
 	}
166 198
 
167 199
 	if ($body) {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author NAVER([email protected])
12 12
  */
13 13
 
14
-if(version_compare(PHP_VERSION, '5.3.0', '<')) {
14
+if (version_compare(PHP_VERSION, '5.3.0', '<')) {
15 15
 	echo "PHP 5.3.0 or above version is required.";
16 16
 	exit(1);
17 17
 }
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 	$argc = $_SERVER['argc'];
22 22
 
23 23
 	// get target directories
24
-	if($argc < 1) exit;
25
-	elseif($argc < 2) $dirs = array($_SERVER['PWD']);
24
+	if ($argc < 1) exit;
25
+	elseif ($argc < 2) $dirs = array($_SERVER['PWD']);
26 26
 	else $dirs = array_slice($argv, 1);
27 27
 
28 28
 	$dirs = array_map('realpath', $dirs);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 // add directory separator
35 35
 function add_dirsep($path) {
36
-	if(substr($path,-1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR;
36
+	if (substr($path, -1) != DIRECTORY_SEPARATOR) $path .= DIRECTORY_SEPARATOR;
37 37
 	return $path;
38 38
 }
39 39
 
@@ -46,38 +46,38 @@  discard block
 block discarded – undo
46 46
 	echo " Done\n";
47 47
 
48 48
 	// merge
49
-	foreach($config['merge'] as $target=>$files) {
49
+	foreach ($config['merge'] as $target=>$files) {
50 50
 		merge($files, $target, $dir);
51 51
 	}
52 52
 
53 53
 	// files to skip
54 54
 	$files_to_skip = $config['skip'];
55
-	foreach($files_to_skip as $idx=>$file) {
56
-		if($file) $files_to_skip[$idx] = realpath($dir.trim($file));
55
+	foreach ($files_to_skip as $idx=>$file) {
56
+		if ($file) $files_to_skip[$idx] = realpath($dir.trim($file));
57 57
 	}
58 58
 
59 59
 	echo "  Minifying JavaScript files...";
60 60
 	$js_files = get_target_files('js', $dir, $files_to_skip);
61 61
 
62
-	if(count($js_files) && !class_exists('JSMinPlus')) {
62
+	if (count($js_files) && !class_exists('JSMinPlus')) {
63 63
 		require dirname(__FILE__).'/jsminplus/jsminplus.php';
64 64
 	}
65
-	foreach($js_files as $file) {
66
-		if(!is_readable($file)) continue;
65
+	foreach ($js_files as $file) {
66
+		if (!is_readable($file)) continue;
67 67
 
68 68
 		$target  = preg_replace('@\.js$@', '.min.js', $file);
69 69
 		$content = file_get_contents($file);
70 70
 
71 71
 		// save copyright to preserve it
72
-		if(preg_match('@^[ \t]*(/\*\*.+?\*/)@s', $content, $matches)) {
72
+		if (preg_match('@^[ \t]*(/\*\*.+?\*/)@s', $content, $matches)) {
73 73
 			$copyright = $matches[1]."\n";
74 74
 		} else {
75 75
 			$copyright = '';
76 76
 		}
77 77
 
78
-		if($config['use_closure_compiler']) {
78
+		if ($config['use_closure_compiler']) {
79 79
 			$content = closure_compile($content);
80
-			if(!$content) {
80
+			if (!$content) {
81 81
 				echo "   CANNOT compile the js file with closure compiler.\n";
82 82
 				echo "   Trying again with JSMinPlus.\n";
83 83
 				$content = JSMinPlus::minify($content);
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 	echo "  Minifying CSS files...";
96 96
 	$css_files = get_target_files('css', $dir, $files_to_skip);
97 97
 
98
-	if(count($css_files) && !class_exists('CSSmin')) {
98
+	if (count($css_files) && !class_exists('CSSmin')) {
99 99
 		require dirname(__FILE__).'/cssmin/CSSmin.php';
100 100
 	}
101 101
 
102 102
 	$oCSSmin = new CSSmin();
103 103
 
104
-	foreach($css_files as $file) {
105
-		if(!is_readable($file)) continue;
104
+	foreach ($css_files as $file) {
105
+		if (!is_readable($file)) continue;
106 106
 
107 107
 		$target  = preg_replace('@\.css$@', '.min.css', $file);
108 108
 		$content = file_get_contents($file);
@@ -117,51 +117,51 @@  discard block
 block discarded – undo
117 117
 	$default = array('option'=>array(), 'skip'=>array(), 'merge'=>array());
118 118
 	$file    = $dir.'minify.ini';
119 119
 
120
-	if(!is_readable($file)) return $default;
120
+	if (!is_readable($file)) return $default;
121 121
 
122 122
 	$config_str = file_get_contents($file);
123 123
 	$config_str = preg_replace_callback('/(\[(?:skip|merge *>> *.+?)\])([\s\S]+?)(?=\[|$)/', 'transform_config_str', $config_str);
124 124
 
125 125
 	$config = parse_ini_string($config_str, 1);
126
-	if($config === false) return $default;
126
+	if ($config === false) return $default;
127 127
 
128
-	if(is_array($config['skip'])) $config['skip'] = array_keys($config['skip']);
128
+	if (is_array($config['skip'])) $config['skip'] = array_keys($config['skip']);
129 129
 
130
-	foreach($config as $section=>$value) {
131
-		if(preg_match('/merge *>> *(.+)/', $section, $match)) {
132
-			if(!is_array($config['merge'])) $config['merge'] = array();
130
+	foreach ($config as $section=>$value) {
131
+		if (preg_match('/merge *>> *(.+)/', $section, $match)) {
132
+			if (!is_array($config['merge'])) $config['merge'] = array();
133 133
 			$config['merge'][trim($match[1])] = array_keys($value);
134 134
 
135 135
 			unset($config[$section]);
136 136
 		}
137 137
 	}
138 138
 
139
-	if(is_array($config['option'])) $config = array_merge($config['option'], $config);
139
+	if (is_array($config['option'])) $config = array_merge($config['option'], $config);
140 140
 	$config = array_merge($default, $config);
141 141
 
142 142
 	return $config;
143 143
 }
144 144
 
145 145
 function transform_config_str($matches) {
146
-	if(!$matches[2]) return $matches[0];
146
+	if (!$matches[2]) return $matches[0];
147 147
 	$values = preg_replace('/$/m', '=', trim($matches[2]));
148 148
 
149 149
 	return "{$matches[1]}\n{$values}\n\n";
150 150
 }
151 151
 
152 152
 function merge($files, $target, $base_dir) {
153
-	if(!is_array($files)) return false;
153
+	if (!is_array($files)) return false;
154 154
 
155 155
 	$body   = '';
156 156
 	$is_css = !!preg_match('/\.css$/', $target);
157 157
 
158
-	foreach($files as $file) {
158
+	foreach ($files as $file) {
159 159
 		$file = $base_dir.trim($file);
160
-		if(!is_readable($file)) continue;
160
+		if (!is_readable($file)) continue;
161 161
 
162 162
 		$content = trim(file_get_contents($file));
163
-		if($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content);
164
-		if($content) $body .= $content."\n";
163
+		if ($is_css && $body) $content = preg_replace('/^@.+?;/m', '', $content);
164
+		if ($content) $body .= $content."\n";
165 165
 	}
166 166
 
167 167
 	if ($body) {
Please login to merge, or discard this patch.
addons/adminlogging/adminlogging.addon.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @brief admin log
11 11
  */
12 12
 $logged_info = Context::get('logged_info');
13
-if($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc')
13
+if ($logged_info && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc')
14 14
 {
15 15
 	$oAdminloggingController = getController('adminlogging');
16 16
 	$oAdminloggingController->insertLog($this->module, $this->act);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file point.addon.php
Please login to merge, or discard this patch.
addons/autolink/autolink.addon.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * @author NAVER ([email protected])
10 10
  * @brief Automatic link add-on
11 11
  */
12
-if($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML")
12
+if ($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML")
13 13
 {
14
-	if(Mobile::isFromMobilePhone())
14
+	if (Mobile::isFromMobilePhone())
15 15
 	{
16 16
 		Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000);
17 17
 		Context::addJsFile('./common/js/xe.min.js', false, '', -1000000);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file point.addon.php
Please login to merge, or discard this patch.
addons/blogapi/blogapi.addon.php 2 patches
Braces   +41 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file blogapicounter.addon.php
@@ -47,7 +48,9 @@  discard block
 block discarded – undo
47 48
 	exit;
48 49
 }
49 50
 
50
-if(version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true);
51
+if(version_compare(PHP_VERSION, '5.2.11', '<=')) {
52
+	libxml_disable_entity_loader(true);
53
+}
51 54
 $xml = new SimpleXMLElement($xml, LIBXML_NONET | LIBXML_NOENT);
52 55
 
53 56
 $method_name = (string)$xml->methodName;
@@ -77,8 +80,7 @@  discard block
 block discarded – undo
77 80
 			$content = getXmlRpcFailure(1, $output->getMessage());
78 81
 			printContent($content);
79 82
 		}
80
-	}
81
-	else
83
+	} else
82 84
 	{
83 85
 		$content = getXmlRpcFailure(1, 'not logged');
84 86
 		printContent($content);
@@ -167,10 +169,11 @@  discard block
 block discarded – undo
167 169
 			foreach($fileinfo as $key => $val)
168 170
 			{
169 171
 				$nodename = (string)$val->name;
170
-				if($nodename == 'bits')
171
-					$filedata = base64_decode((string)$val->value->base64);
172
-				elseif($nodename == 'name')
173
-					$filename = (string)$val->value->string;
172
+				if($nodename == 'bits') {
173
+									$filedata = base64_decode((string)$val->value->base64);
174
+				} elseif($nodename == 'name') {
175
+									$filename = (string)$val->value->string;
176
+				}
174 177
 			}
175 178
 
176 179
 			$tmp_arr = explode('/', $filename);
@@ -192,16 +195,14 @@  discard block
 block discarded – undo
192 195
 			if(!$document_srl)
193 196
 			{
194 197
 				printContent(getXmlRpcFailure(1, 'no permission'));
195
-			}
196
-			else
198
+			} else
197 199
 			{
198 200
 				$oDocumentModel = getModel('document');
199 201
 				$oDocument = $oDocumentModel->getDocument($document_srl);
200 202
 				if(!$oDocument->isExists() || !$oDocument->isGranted())
201 203
 				{
202 204
 					printContent(getXmlRpcFailure(1, 'no permission'));
203
-				}
204
-				else
205
+				} else
205 206
 				{
206 207
 					// Get a list of categories and set Context
207 208
 					$category = "";
@@ -268,8 +269,9 @@  discard block
 block discarded – undo
268 269
 						{
269 270
 							foreach($category_list as $category_srl => $category_info)
270 271
 							{
271
-								if($category_info->title == $category)
272
-									$obj->category_srl = $category_srl;
272
+								if($category_info->title == $category) {
273
+																	$obj->category_srl = $category_srl;
274
+								}
273 275
 							}
274 276
 						}
275 277
 						break;
@@ -279,8 +281,9 @@  discard block
 block discarded – undo
279 281
 						{
280 282
 							$tag_list[] = (string)$tag->string;
281 283
 						}
282
-						if(count($tag_list))
283
-							$obj->tags = implode(',', $tag_list);
284
+						if(count($tag_list)) {
285
+													$obj->tags = implode(',', $tag_list);
286
+						}
284 287
 						break;
285 288
 				}
286 289
 			}
@@ -327,8 +330,7 @@  discard block
 block discarded – undo
327 330
 			if(!$output->toBool())
328 331
 			{
329 332
 				$content = getXmlRpcFailure(1, $output->getMessage());
330
-			}
331
-			else
333
+			} else
332 334
 			{
333 335
 				$content = getXmlRpcResponse(strval($document_srl));
334 336
 			}
@@ -340,8 +342,9 @@  discard block
 block discarded – undo
340 342
 		// Edit post
341 343
 		case 'metaWeblog.editPost' :
342 344
 			$tmp_val = (string)$params[0]->value->string;
343
-			if(!$tmp_val)
344
-				$tmp_val = (string)$params[0]->value->i4;
345
+			if(!$tmp_val) {
346
+							$tmp_val = (string)$params[0]->value->i4;
347
+			}
345 348
 			if(!$tmp_val)
346 349
 			{
347 350
 				$content = getXmlRpcFailure(1, 'no permission');
@@ -385,8 +388,9 @@  discard block
 block discarded – undo
385 388
 						{
386 389
 							foreach($category_list as $category_srl => $category_info)
387 390
 							{
388
-								if($category_info->title == $category)
389
-									$obj->category_srl = $category_srl;
391
+								if($category_info->title == $category) {
392
+																	$obj->category_srl = $category_srl;
393
+								}
390 394
 							}
391 395
 						}
392 396
 						break;
@@ -396,8 +400,9 @@  discard block
 block discarded – undo
396 400
 						{
397 401
 							$tag_list[] = (string)$tag->string;
398 402
 						}
399
-						if(count($tag_list))
400
-							$obj->tags = implode(',', $tag_list);
403
+						if(count($tag_list)) {
404
+													$obj->tags = implode(',', $tag_list);
405
+						}
401 406
 						break;
402 407
 				}
403 408
 			}
@@ -418,8 +423,9 @@  discard block
 block discarded – undo
418 423
 						$file_info['name'] = $file_list[$i];
419 424
 
420 425
 						$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
421
-						if(file_exists($moved_filename))
422
-							continue;
426
+						if(file_exists($moved_filename)) {
427
+													continue;
428
+						}
423 429
 
424 430
 						$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
425 431
 						$uploaded_filename = $fileOutput->get('uploaded_filename');
@@ -436,8 +442,7 @@  discard block
 block discarded – undo
436 442
 			if(!$output->toBool())
437 443
 			{
438 444
 				$content = getXmlRpcFailure(1, $output->getMessage());
439
-			}
440
-			else
445
+			} else
441 446
 			{
442 447
 				$content = getXmlRpcResponse(true);
443 448
 				FileHandler::removeDir($tmp_uploaded_path);
@@ -458,21 +463,20 @@  discard block
 block discarded – undo
458 463
 			{
459 464
 				$content = getXmlRpcFailure(1, 'not exists');
460 465
 				// Check if a permission to delete a document is granted
461
-			}
462
-			elseif(!$oDocument->isGranted())
466
+			} elseif(!$oDocument->isGranted())
463 467
 			{
464 468
 				$content = getXmlRpcFailure(1, 'no permission');
465 469
 				break;
466 470
 				// Delete
467
-			}
468
-			else
471
+			} else
469 472
 			{
470 473
 				$oDocumentController = getController('document');
471 474
 				$output = $oDocumentController->deleteDocument($document_srl);
472
-				if(!$output->toBool())
473
-					$content = getXmlRpcFailure(1, $output->getMessage());
474
-				else
475
-					$content = getXmlRpcResponse(true);
475
+				if(!$output->toBool()) {
476
+									$content = getXmlRpcFailure(1, $output->getMessage());
477
+				} else {
478
+									$content = getXmlRpcResponse(true);
479
+				}
476 480
 			}
477 481
 
478 482
 			printContent($content);
@@ -492,8 +496,7 @@  discard block
 block discarded – undo
492 496
 			if(!$output->toBool() || !$output->data)
493 497
 			{
494 498
 				$content = getXmlRpcFailure(1, 'post not founded');
495
-			}
496
-			else
499
+			} else
497 500
 			{
498 501
 				$oEditorController = getController('editor');
499 502
 
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -13,27 +13,27 @@  discard block
 block discarded – undo
13 13
  * It should be called before executing the module(before_module_proc). If not, it is forced to shut down.
14 14
  * */
15 15
 // Insert a rsd tag when called_position is after_module_proc
16
-if($called_position == 'after_module_proc')
16
+if ($called_position == 'after_module_proc')
17 17
 {
18 18
 	// Create rsd address of the current module
19 19
 	$site_module_info = Context::get('site_module_info');
20 20
 	$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid', $this->module_info->mid, 'act', 'api');
21 21
 	// Insert rsd tag into the header
22
-	Context::addHtmlHeader("    " . '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . $rsd_url . '" />');
22
+	Context::addHtmlHeader("    ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
23 23
 }
24 24
 // If act isnot api, just return
25
-if($_REQUEST['act'] != 'api')
25
+if ($_REQUEST['act'] != 'api')
26 26
 {
27 27
 	return;
28 28
 }
29 29
 
30 30
 // Read func file
31
-require_once(_XE_PATH_ . 'addons/blogapi/blogapi.func.php');
31
+require_once(_XE_PATH_.'addons/blogapi/blogapi.func.php');
32 32
 
33 33
 $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
34 34
 
35 35
 // If HTTP_RAW_POST_DATA is NULL, Print error message
36
-if(!$xml)
36
+if (!$xml)
37 37
 {
38 38
 	$content = getXmlRpcFailure(1, 'Invalid Method Call');
39 39
 	printContent($content);
@@ -41,38 +41,38 @@  discard block
 block discarded – undo
41 41
 
42 42
 // xmlprc parsing
43 43
 // Parse the requested xmlrpc
44
-if(Security::detectingXEE($xml))
44
+if (Security::detectingXEE($xml))
45 45
 {
46 46
 	header("HTTP/1.0 400 Bad Request");
47 47
 	exit;
48 48
 }
49 49
 
50
-if(version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true);
50
+if (version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true);
51 51
 $xml = new SimpleXMLElement($xml, LIBXML_NONET | LIBXML_NOENT);
52 52
 
53
-$method_name = (string)$xml->methodName;
53
+$method_name = (string) $xml->methodName;
54 54
 $params = $xml->params->param;
55 55
 
56 56
 // Compatible with some of methodname
57
-if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo')))
57
+if (in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo')))
58 58
 {
59 59
 	$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
60 60
 }
61 61
 
62 62
 // Get user_id, password and attempt log-in
63
-$user_id = trim((string)$params[1]->value->string);
64
-$password = trim((string)$params[2]->value->string);
63
+$user_id = trim((string) $params[1]->value->string);
64
+$password = trim((string) $params[2]->value->string);
65 65
 
66 66
 // Before executing the module, authentication is processed.
67
-if($called_position == 'before_module_init')
67
+if ($called_position == 'before_module_init')
68 68
 {
69 69
 	// Attempt log-in by using member controller
70
-	if($user_id && $password)
70
+	if ($user_id && $password)
71 71
 	{
72 72
 		$oMemberController = getController('member');
73 73
 		$output = $oMemberController->doLogin($user_id, $password);
74 74
 		// If login fails, an error message appears
75
-		if(!$output->toBool())
75
+		if (!$output->toBool())
76 76
 		{
77 77
 			$content = getXmlRpcFailure(1, $output->getMessage());
78 78
 			printContent($content);
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 // Before module processing, handle requests from blogapi tool and then terminate.
89
-if($called_position == 'before_module_proc')
89
+if ($called_position == 'before_module_proc')
90 90
 {
91 91
 	// Check writing permission 
92
-	if(!$this->grant->write_document)
92
+	if (!$this->grant->write_document)
93 93
 	{
94 94
 		printContent(getXmlRpcFailure(1, 'no permission'));
95 95
 	}
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	$category_list = $oDocumentModel->getCategoryList($this->module_srl);
100 100
 
101 101
 	// Specifies a temporary file storage
102
-	$tmp_uploaded_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id);
103
-	$uploaded_target_path = sprintf(_XE_PATH_ . 'files/cache/blogapi/%s/%s/', $this->mid, $user_id);
102
+	$tmp_uploaded_path = sprintf(_XE_PATH_.'files/cache/blogapi/%s/%s/', $this->mid, $user_id);
103
+	$uploaded_target_path = sprintf(_XE_PATH_.'files/cache/blogapi/%s/%s/', $this->mid, $user_id);
104 104
 
105
-	switch($method_name)
105
+	switch ($method_name)
106 106
 	{
107 107
 		// Blog information
108 108
 		case 'blogger.getUsersBlogs' :
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 		// Return a list of categories
120 120
 		case 'metaWeblog.getCategories' :
121 121
 			$category_obj_list = array();
122
-			if($category_list)
122
+			if ($category_list)
123 123
 			{
124
-				foreach($category_list as $category_srl => $category_info)
124
+				foreach ($category_list as $category_srl => $category_info)
125 125
 				{
126 126
 					$obj = new stdClass();
127 127
 					$obj->description = $category_info->title;
@@ -142,35 +142,35 @@  discard block
 block discarded – undo
142 142
 			// Check a file upload permission
143 143
 			$oFileModel = getModel('file');
144 144
 			$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
145
-			if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant) > 0)
145
+			if (is_array($file_module_config->download_grant) && count($file_module_config->download_grant) > 0)
146 146
 			{
147 147
 				$logged_info = Context::get('logged_info');
148
-				if($logged_info->is_admin != 'Y')
148
+				if ($logged_info->is_admin != 'Y')
149 149
 				{
150 150
 					$is_permitted = false;
151
-					for($i = 0; $i < count($file_module_config->download_grant); $i++)
151
+					for ($i = 0; $i < count($file_module_config->download_grant); $i++)
152 152
 					{
153 153
 						$group_srl = $file_module_config->download_grant[$i];
154
-						if($logged_info->group_list[$group_srl])
154
+						if ($logged_info->group_list[$group_srl])
155 155
 						{
156 156
 							$is_permitted = true;
157 157
 							break;
158 158
 						}
159 159
 					}
160
-					if(!$is_permitted){
160
+					if (!$is_permitted) {
161 161
 						printContent(getXmlRpcFailure(1, 'no permission'));
162 162
 					}
163 163
 				}
164 164
 			}
165 165
 
166 166
 			$fileinfo = $params[3]->value->struct->member;
167
-			foreach($fileinfo as $key => $val)
167
+			foreach ($fileinfo as $key => $val)
168 168
 			{
169
-				$nodename = (string)$val->name;
170
-				if($nodename == 'bits')
171
-					$filedata = base64_decode((string)$val->value->base64);
172
-				elseif($nodename == 'name')
173
-					$filename = (string)$val->value->string;
169
+				$nodename = (string) $val->name;
170
+				if ($nodename == 'bits')
171
+					$filedata = base64_decode((string) $val->value->base64);
172
+				elseif ($nodename == 'name')
173
+					$filename = (string) $val->value->string;
174 174
 			}
175 175
 
176 176
 			$tmp_arr = explode('/', $filename);
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 			$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
182 182
 			FileHandler::writeFile($target_filename, $filedata);
183 183
 			$obj = new stdClass();
184
-			$obj->url = Context::getRequestUri() . $target_filename;
184
+			$obj->url = Context::getRequestUri().$target_filename;
185 185
 
186 186
 			$content = getXmlRpcResponse($obj);
187 187
 			printContent($content);
188 188
 			break;
189 189
 		// Get posts
190 190
 		case 'metaWeblog.getPost' :
191
-			$document_srl = (string)$params[0]->value->string;
192
-			if(!$document_srl)
191
+			$document_srl = (string) $params[0]->value->string;
192
+			if (!$document_srl)
193 193
 			{
194 194
 				printContent(getXmlRpcFailure(1, 'no permission'));
195 195
 			}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			{
198 198
 				$oDocumentModel = getModel('document');
199 199
 				$oDocument = $oDocumentModel->getDocument($document_srl);
200
-				if(!$oDocument->isExists() || !$oDocument->isGranted())
200
+				if (!$oDocument->isExists() || !$oDocument->isGranted())
201 201
 				{
202 202
 					printContent(getXmlRpcFailure(1, 'no permission'));
203 203
 				}
@@ -205,37 +205,37 @@  discard block
 block discarded – undo
205 205
 				{
206 206
 					// Get a list of categories and set Context
207 207
 					$category = "";
208
-					if($oDocument->get('category_srl'))
208
+					if ($oDocument->get('category_srl'))
209 209
 					{
210 210
 						$oDocumentModel = getModel('document');
211 211
 						$category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl'));
212
-						if($category_list[$oDocument->get('category_srl')])
212
+						if ($category_list[$oDocument->get('category_srl')])
213 213
 						{
214 214
 							$category = $category_list[$oDocument->get('category_srl')]->title;
215 215
 						}
216 216
 					}
217 217
 
218 218
 					$content = sprintf(
219
-							'<?xml version="1.0" encoding="utf-8"?>' .
220
-							'<methodResponse>' .
221
-							'<params>' .
222
-								'<param>' .
223
-									'<value>' .
224
-										'<struct>' .
225
-											'<member><name>categories</name><value><array><data><value><![CDATA[%s]]></value></data></array></value></member>' .
226
-											'<member><name>dateCreated</name><value><dateTime.iso8601>%s</dateTime.iso8601></value></member>' .
227
-											'<member><name>description</name><value><![CDATA[%s]]></value></member>' .
228
-											'<member><name>link</name><value>%s</value></member>' .
229
-											'<member><name>postid</name><value><string>%s</string></value></member>' .
230
-											'<member><name>title</name><value><![CDATA[%s]]></value></member>' .
231
-											'<member><name>publish</name><value><boolean>1</boolean></value></member>' .
232
-										'</struct>' .
233
-									'</value>' .
234
-								'</param>' .
235
-							'</params>' .
219
+							'<?xml version="1.0" encoding="utf-8"?>'.
220
+							'<methodResponse>'.
221
+							'<params>'.
222
+								'<param>'.
223
+									'<value>'.
224
+										'<struct>'.
225
+											'<member><name>categories</name><value><array><data><value><![CDATA[%s]]></value></data></array></value></member>'.
226
+											'<member><name>dateCreated</name><value><dateTime.iso8601>%s</dateTime.iso8601></value></member>'.
227
+											'<member><name>description</name><value><![CDATA[%s]]></value></member>'.
228
+											'<member><name>link</name><value>%s</value></member>'.
229
+											'<member><name>postid</name><value><string>%s</string></value></member>'.
230
+											'<member><name>title</name><value><![CDATA[%s]]></value></member>'.
231
+											'<member><name>publish</name><value><boolean>1</boolean></value></member>'.
232
+										'</struct>'.
233
+									'</value>'.
234
+								'</param>'.
235
+							'</params>'.
236 236
 							'</methodResponse>', 
237 237
 							$category,
238
-							date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime()),
238
+							date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime()),
239 239
 							$oDocument->getContent(false, false, true, false),
240 240
 							getFullUrl('', 'document_srl', $oDocument->document_srl),
241 241
 							$oDocument->document_srl,
@@ -251,35 +251,35 @@  discard block
 block discarded – undo
251 251
 			$obj = new stdClass();
252 252
 			$info = $params[3];
253 253
 			// Get information of post, title, and category
254
-			foreach($info->value->struct->member as $val)
254
+			foreach ($info->value->struct->member as $val)
255 255
 			{
256
-				switch((string)$val->name)
256
+				switch ((string) $val->name)
257 257
 				{
258 258
 					case 'title' :
259
-						$obj->title = (string)$val->value->string;
259
+						$obj->title = (string) $val->value->string;
260 260
 						break;
261 261
 					case 'description' :
262
-						$obj->content = (string)$val->value->string;
262
+						$obj->content = (string) $val->value->string;
263 263
 						break;
264 264
 					case 'categories' :
265 265
 						$categories = $val->value->array->data->value;
266
-						$category = (string)$categories[0]->string;
267
-						if($category && $category_list)
266
+						$category = (string) $categories[0]->string;
267
+						if ($category && $category_list)
268 268
 						{
269
-							foreach($category_list as $category_srl => $category_info)
269
+							foreach ($category_list as $category_srl => $category_info)
270 270
 							{
271
-								if($category_info->title == $category)
271
+								if ($category_info->title == $category)
272 272
 									$obj->category_srl = $category_srl;
273 273
 							}
274 274
 						}
275 275
 						break;
276 276
 					case 'tagwords' :
277 277
 						$tags = $val->value->array->data->value;
278
-						foreach($tags as $tag)
278
+						foreach ($tags as $tag)
279 279
 						{
280
-							$tag_list[] = (string)$tag->string;
280
+							$tag_list[] = (string) $tag->string;
281 281
 						}
282
-						if(count($tag_list))
282
+						if (count($tag_list))
283 283
 							$obj->tags = implode(',', $tag_list);
284 284
 						break;
285 285
 				}
@@ -291,21 +291,21 @@  discard block
 block discarded – undo
291 291
 			$obj->module_srl = $this->module_srl;
292 292
 
293 293
 			// Attachment
294
-			if(is_dir($tmp_uploaded_path))
294
+			if (is_dir($tmp_uploaded_path))
295 295
 			{
296 296
 				$file_list = FileHandler::readDir($tmp_uploaded_path);
297 297
 				$file_count = count($file_list);
298
-				if($file_count)
298
+				if ($file_count)
299 299
 				{
300 300
 					$oFileController = getController('file');
301
-					for($i = 0; $i < $file_count; $i++)
301
+					for ($i = 0; $i < $file_count; $i++)
302 302
 					{
303 303
 						$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
304 304
 						$file_info['name'] = $file_list[$i];
305 305
 						$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
306 306
 						$uploaded_filename = $fileOutput->get('uploaded_filename');
307 307
 						$source_filename = $fileOutput->get('source_filename');
308
-						$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
308
+						$obj->content = str_replace($uploaded_target_path.$source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
309 309
 					}
310 310
 					$obj->uploaded_count = $file_count;
311 311
 				}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			$obj->homepage = $logged_info->homepage;
325 325
 			$output = $oDocumentController->insertDocument($obj, TRUE);
326 326
 
327
-			if(!$output->toBool())
327
+			if (!$output->toBool())
328 328
 			{
329 329
 				$content = getXmlRpcFailure(1, $output->getMessage());
330 330
 			}
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
 
340 340
 		// Edit post
341 341
 		case 'metaWeblog.editPost' :
342
-			$tmp_val = (string)$params[0]->value->string;
343
-			if(!$tmp_val)
344
-				$tmp_val = (string)$params[0]->value->i4;
345
-			if(!$tmp_val)
342
+			$tmp_val = (string) $params[0]->value->string;
343
+			if (!$tmp_val)
344
+				$tmp_val = (string) $params[0]->value->i4;
345
+			if (!$tmp_val)
346 346
 			{
347 347
 				$content = getXmlRpcFailure(1, 'no permission');
348 348
 				break;
349 349
 			}
350 350
 			$tmp_arr = explode('/', $tmp_val);
351 351
 			$document_srl = array_pop($tmp_arr);
352
-			if(!$document_srl)
352
+			if (!$document_srl)
353 353
 			{
354 354
 				$content = getXmlRpcFailure(1, 'no permission');
355 355
 				break;
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 			$oDocumentModel = getModel('document');
359 359
 			$oDocument = $oDocumentModel->getDocument($document_srl);
360 360
 			// Check if a permission to modify a document is granted
361
-			if(!$oDocument->isGranted())
361
+			if (!$oDocument->isGranted())
362 362
 			{
363 363
 				$content = getXmlRpcFailure(1, 'no permission');
364 364
 				break;
@@ -368,35 +368,35 @@  discard block
 block discarded – undo
368 368
 
369 369
 			$info = $params[3];
370 370
 			// Get information of post, title, and category
371
-			foreach($info->value->struct->member as $val)
371
+			foreach ($info->value->struct->member as $val)
372 372
 			{
373
-				switch((string)$val->name)
373
+				switch ((string) $val->name)
374 374
 				{
375 375
 					case 'title' :
376
-						$obj->title = (string)$val->value->string;
376
+						$obj->title = (string) $val->value->string;
377 377
 						break;
378 378
 					case 'description' :
379
-						$obj->content = (string)$val->value->string;
379
+						$obj->content = (string) $val->value->string;
380 380
 						break;
381 381
 					case 'categories' :
382 382
 						$categories = $val->value->array->data->value;
383
-						$category = (string)$categories[0]->string;
384
-						if($category && $category_list)
383
+						$category = (string) $categories[0]->string;
384
+						if ($category && $category_list)
385 385
 						{
386
-							foreach($category_list as $category_srl => $category_info)
386
+							foreach ($category_list as $category_srl => $category_info)
387 387
 							{
388
-								if($category_info->title == $category)
388
+								if ($category_info->title == $category)
389 389
 									$obj->category_srl = $category_srl;
390 390
 							}
391 391
 						}
392 392
 						break;
393 393
 					case 'tagwords' :
394 394
 						$tags = $val->value->array->data->value;
395
-						foreach($tags as $tag)
395
+						foreach ($tags as $tag)
396 396
 						{
397
-							$tag_list[] = (string)$tag->string;
397
+							$tag_list[] = (string) $tag->string;
398 398
 						}
399
-						if(count($tag_list))
399
+						if (count($tag_list))
400 400
 							$obj->tags = implode(',', $tag_list);
401 401
 						break;
402 402
 				}
@@ -405,26 +405,26 @@  discard block
 block discarded – undo
405 405
 			$obj->document_srl = $document_srl;
406 406
 			$obj->module_srl = $this->module_srl;
407 407
 			// Attachment
408
-			if(is_dir($tmp_uploaded_path))
408
+			if (is_dir($tmp_uploaded_path))
409 409
 			{
410 410
 				$file_list = FileHandler::readDir($tmp_uploaded_path);
411 411
 				$file_count = count($file_list);
412
-				if($file_count)
412
+				if ($file_count)
413 413
 				{
414 414
 					$oFileController = getController('file');
415
-					for($i = 0; $i < $file_count; $i++)
415
+					for ($i = 0; $i < $file_count; $i++)
416 416
 					{
417 417
 						$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
418 418
 						$file_info['name'] = $file_list[$i];
419 419
 
420 420
 						$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
421
-						if(file_exists($moved_filename))
421
+						if (file_exists($moved_filename))
422 422
 							continue;
423 423
 
424 424
 						$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
425 425
 						$uploaded_filename = $fileOutput->get('uploaded_filename');
426 426
 						$source_filename = $fileOutput->get('source_filename');
427
-						$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
427
+						$obj->content = str_replace($uploaded_target_path.$source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
428 428
 					}
429 429
 					$obj->uploaded_count += $file_count;
430 430
 				}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			$oDocumentController = getController('document');
434 434
 			$output = $oDocumentController->updateDocument($oDocument, $obj, TRUE);
435 435
 
436
-			if(!$output->toBool())
436
+			if (!$output->toBool())
437 437
 			{
438 438
 				$content = getXmlRpcFailure(1, $output->getMessage());
439 439
 			}
@@ -447,19 +447,19 @@  discard block
 block discarded – undo
447 447
 			break;
448 448
 		// Delete the post
449 449
 		case 'blogger.deletePost' :
450
-			$tmp_val = (string)$params[1]->value->string;
450
+			$tmp_val = (string) $params[1]->value->string;
451 451
 			$tmp_arr = explode('/', $tmp_val);
452 452
 			$document_srl = array_pop($tmp_arr);
453 453
 			// Get a document
454 454
 			$oDocumentModel = getModel('document');
455 455
 			$oDocument = $oDocumentModel->getDocument($document_srl);
456 456
 			// If the document exists
457
-			if(!$oDocument->isExists())
457
+			if (!$oDocument->isExists())
458 458
 			{
459 459
 				$content = getXmlRpcFailure(1, 'not exists');
460 460
 				// Check if a permission to delete a document is granted
461 461
 			}
462
-			elseif(!$oDocument->isGranted())
462
+			elseif (!$oDocument->isGranted())
463 463
 			{
464 464
 				$content = getXmlRpcFailure(1, 'no permission');
465 465
 				break;
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 			{
470 470
 				$oDocumentController = getController('document');
471 471
 				$output = $oDocumentController->deleteDocument($document_srl);
472
-				if(!$output->toBool())
472
+				if (!$output->toBool())
473 473
 					$content = getXmlRpcFailure(1, $output->getMessage());
474 474
 				else
475 475
 					$content = getXmlRpcResponse(true);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			$args->search_target = 'member_srl';
490 490
 			$args->search_keyword = $logged_info->member_srl;
491 491
 			$output = $oDocumentModel->getDocumentList($args);
492
-			if(!$output->toBool() || !$output->data)
492
+			if (!$output->toBool() || !$output->data)
493 493
 			{
494 494
 				$content = getXmlRpcFailure(1, 'post not founded');
495 495
 			}
@@ -498,12 +498,12 @@  discard block
 block discarded – undo
498 498
 				$oEditorController = getController('editor');
499 499
 
500 500
 				$posts = array();
501
-				foreach($output->data as $key => $oDocument)
501
+				foreach ($output->data as $key => $oDocument)
502 502
 				{
503 503
 					$post = new stdClass();
504 504
 					$post->categories = array();
505
-					$post->dateCreated = date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime());
506
-					$post->description = sprintf('<![CDATA[%s]]>',$oEditorController->transComponent($oDocument->getContent(false, false, true, false)));
505
+					$post->dateCreated = date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime());
506
+					$post->description = sprintf('<![CDATA[%s]]>', $oEditorController->transComponent($oDocument->getContent(false, false, true, false)));
507 507
 					$post->link = $post->permaLink = getFullUrl('', 'document_srl', $oDocument->document_srl);
508 508
 					$post->postid = $oDocument->document_srl;
509 509
 					$post->title = htmlspecialchars($oDocument->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
Please login to merge, or discard this patch.
addons/blogapi/blogapi.func.php 2 patches
Braces   +9 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file ./addons/blogapi/blogapi.func.php
@@ -34,24 +35,19 @@  discard block
 block discarded – undo
34 35
 	if(preg_match('/^\<\!\[CDATA\[/',$val))
35 36
 	{
36 37
 		$buff = sprintf("<value>%s</value>", $val);
37
-	}
38
-	elseif(is_int($val))
38
+	} elseif(is_int($val))
39 39
 	{
40 40
 		$buff = sprintf("<value><i4>%d</i4></value>", $val);
41
-	}
42
-	elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
41
+	} elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
43 42
 	{
44 43
 		$buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val);
45
-	}
46
-	elseif(is_double($val))
44
+	} elseif(is_double($val))
47 45
 	{
48 46
 		$buff = sprintf("<value><double>%f</double></value>", $val);
49
-	}
50
-	elseif(is_bool($val))
47
+	} elseif(is_bool($val))
51 48
 	{
52 49
 		$buff = sprintf("<value><boolean>%d</boolean></value>", $val ? 1 : 0);
53
-	}
54
-	elseif(is_object($val))
50
+	} elseif(is_object($val))
55 51
 	{
56 52
 		$values = get_object_vars($val);
57 53
 		$val_count = count($values);
@@ -61,8 +57,7 @@  discard block
 block discarded – undo
61 57
 			$buff .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), _getEncodedVal($v, true));
62 58
 		}
63 59
 		$buff .= "</struct></value>\n";
64
-	}
65
-	elseif(is_array($val))
60
+	} elseif(is_array($val))
66 61
 	{
67 62
 		$val_count = count($val);
68 63
 		$buff = "<value><array>\n<data>";
@@ -71,8 +66,7 @@  discard block
 block discarded – undo
71 66
 			$buff .= _getEncodedVal($val[$i], true);
72 67
 		}
73 68
 		$buff .= "</data>\n</array></value>";
74
-	}
75
-	else
69
+	} else
76 70
 	{
77 71
 		$buff = sprintf("<value><string>%s</string></value>\n", $val);
78 72
 	}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 // Display results
22 22
 function getXmlRpcResponse($params)
23 23
 {
24
-	$buff = '<?xml version="1.0" encoding="utf-8"?>' . "\n<methodResponse><params>";
24
+	$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
25 25
 	$buff .= _getEncodedVal($params);
26 26
 	$buff .= "</params>\n</methodResponse>\n";
27 27
 
@@ -31,42 +31,42 @@  discard block
 block discarded – undo
31 31
 // Encoding
32 32
 function _getEncodedVal($val, $is_sub_set = false)
33 33
 {
34
-	if(preg_match('/^\<\!\[CDATA\[/',$val))
34
+	if (preg_match('/^\<\!\[CDATA\[/', $val))
35 35
 	{
36 36
 		$buff = sprintf("<value>%s</value>", $val);
37 37
 	}
38
-	elseif(is_int($val))
38
+	elseif (is_int($val))
39 39
 	{
40 40
 		$buff = sprintf("<value><i4>%d</i4></value>", $val);
41 41
 	}
42
-	elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
42
+	elseif (is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
43 43
 	{
44 44
 		$buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val);
45 45
 	}
46
-	elseif(is_double($val))
46
+	elseif (is_double($val))
47 47
 	{
48 48
 		$buff = sprintf("<value><double>%f</double></value>", $val);
49 49
 	}
50
-	elseif(is_bool($val))
50
+	elseif (is_bool($val))
51 51
 	{
52 52
 		$buff = sprintf("<value><boolean>%d</boolean></value>", $val ? 1 : 0);
53 53
 	}
54
-	elseif(is_object($val))
54
+	elseif (is_object($val))
55 55
 	{
56 56
 		$values = get_object_vars($val);
57 57
 		$val_count = count($values);
58 58
 		$buff = "<value><struct>";
59
-		foreach($values as $k => $v)
59
+		foreach ($values as $k => $v)
60 60
 		{
61 61
 			$buff .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), _getEncodedVal($v, true));
62 62
 		}
63 63
 		$buff .= "</struct></value>\n";
64 64
 	}
65
-	elseif(is_array($val))
65
+	elseif (is_array($val))
66 66
 	{
67 67
 		$val_count = count($val);
68 68
 		$buff = "<value><array>\n<data>";
69
-		for($i = 0; $i < $val_count; $i++)
69
+		for ($i = 0; $i < $val_count; $i++)
70 70
 		{
71 71
 			$buff .= _getEncodedVal($val[$i], true);
72 72
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$buff = sprintf("<value><string>%s</string></value>\n", $val);
78 78
 	}
79
-	if(!$is_sub_set)
79
+	if (!$is_sub_set)
80 80
 	{
81 81
 		return sprintf("<param>\n%s</param>", $buff);
82 82
 	}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 {
89 89
 	header("Content-Type: text/xml; charset=UTF-8");
90 90
 	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
91
-	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
91
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
92 92
 	header("Cache-Control: no-store, no-cache, must-revalidate");
93 93
 	header("Cache-Control: post-check=0, pre-check=0", false);
94 94
 	header("Pragma: no-cache");
Please login to merge, or discard this patch.
addons/counter/counter.addon.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @brief Counter add-on
11 11
  */
12 12
 // Execute if called_position is before_display_content
13
-if($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler())
13
+if ($called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML' && Context::isInstalled() && !isCrawler())
14 14
 {
15 15
 	$oCounterController = getController('counter');
16 16
 	$oCounterController->counterExecute();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file point.addon.php
Please login to merge, or discard this patch.
addons/member_communication/member_communication.addon.php 2 patches
Braces   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if(!defined('__XE__')) {
5 5
 	exit();
6
+}
6 7
 
7 8
 /**
8 9
  * @file member_communication.addon.php
@@ -44,8 +45,7 @@  discard block
 block discarded – undo
44 45
 		$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
45 46
 		Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
46 47
 	}
47
-}
48
-elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
48
+} elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
49 49
 {
50 50
 	$member_srl = Context::get('target_srl');
51 51
 	$oCommunicationModel = getModel('communication');
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
 		// Display a list of friends
61 61
 		$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
62 62
 		// If not, Add menus to send message and to add friends
63
-	}
64
-	else
63
+	} else
65 64
 	{
66 65
 		// Get member information
67 66
 		$oMemberModel = getModel('member');
@@ -73,11 +72,13 @@  discard block
 block discarded – undo
73 72
 
74 73
 		$oMemberController = getController('member');
75 74
 		// Add a menu for sending message
76
-		if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
77
-			$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
75
+		if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) {
76
+					$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
77
+		}
78 78
 		// Add a menu for listing friends (if a friend is new)
79
-		if(!$oCommunicationModel->isAddedFriend($member_srl))
80
-			$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
79
+		if(!$oCommunicationModel->isAddedFriend($member_srl)) {
80
+					$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
81
+		}
81 82
 	}
82 83
 }
83 84
 /* End of file member_communication.addon.php */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-if(!defined('__XE__'))
4
+if (!defined('__XE__'))
5 5
 	exit();
6 6
 
7 7
 /**
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 // Stop if non-logged-in user is
17 17
 $logged_info = Context::get('logged_info');
18
-if(!$logged_info|| isCrawler())
18
+if (!$logged_info || isCrawler())
19 19
 {
20 20
 	return;
21 21
 }
@@ -23,35 +23,35 @@  discard block
 block discarded – undo
23 23
 /**
24 24
  * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
25 25
  * */
26
-if($this->module != 'member' && $called_position == 'before_module_init')
26
+if ($this->module != 'member' && $called_position == 'before_module_init')
27 27
 {
28 28
 	// Load a language file from the communication module
29
-	Context::loadLang(_XE_PATH_ . 'modules/communication/lang');
29
+	Context::loadLang(_XE_PATH_.'modules/communication/lang');
30 30
 	// Add menus on the member login information
31 31
 	$oMemberController = getController('member');
32 32
 	$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
33 33
 	$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
34 34
 
35
-	$flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl;
36
-	if($addon_info->use_alarm != 'N' && file_exists($flag_file))
35
+	$flag_file = _XE_PATH_.'files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl).$logged_info->member_srl;
36
+	if ($addon_info->use_alarm != 'N' && file_exists($flag_file))
37 37
 	{
38 38
 		// Pop-up to display messages if a flag on new message is set
39 39
 		$new_message_count = (int) trim(FileHandler::readFile($flag_file));
40 40
 		FileHandler::removeFile($flag_file);
41
-		Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang');
41
+		Context::loadLang(_XE_PATH_.'addons/member_communication/lang');
42 42
 		Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true);
43 43
 
44 44
 		$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
45 45
 		Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
46 46
 	}
47 47
 }
48
-elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
48
+elseif ($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
49 49
 {
50 50
 	$member_srl = Context::get('target_srl');
51 51
 	$oCommunicationModel = getModel('communication');
52 52
 
53 53
 	// Add a feature to display own message box.
54
-	if($logged_info->member_srl == $member_srl)
54
+	if ($logged_info->member_srl == $member_srl)
55 55
 	{
56 56
 		$mid = Context::get('cur_mid');
57 57
 		$oMemberController = getController('member');
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 		// Get member information
67 67
 		$oMemberModel = getModel('member');
68 68
 		$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
69
-		if(!$target_member_info->member_srl)
69
+		if (!$target_member_info->member_srl)
70 70
 		{
71 71
 			return;
72 72
 		}
73 73
 
74 74
 		$oMemberController = getController('member');
75 75
 		// Add a menu for sending message
76
-		if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
76
+		if ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
77 77
 			$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
78 78
 		// Add a menu for listing friends (if a friend is new)
79
-		if(!$oCommunicationModel->isAddedFriend($member_srl))
79
+		if (!$oCommunicationModel->isAddedFriend($member_srl))
80 80
 			$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.