Passed
Push — patch_1-1-9 ( 70f5ab...f2626d )
by Spuds
21:21 queued 15:06
created
sources/ext/cssmin/tubalmartin/Utils.php 3 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -4,146 +4,146 @@
 block discarded – undo
4 4
 
5 5
 class Utils
6 6
 {
7
-    /**
8
-     * Clamps a number between a minimum and a maximum value.
9
-     * @param int|float $n the number to clamp
10
-     * @param int|float $min the lower end number allowed
11
-     * @param int|float $max the higher end number allowed
12
-     * @return int|float
13
-     */
14
-    public static function clampNumber($n, $min, $max)
15
-    {
16
-        return min(max($n, $min), $max);
17
-    }
18
-
19
-    /**
20
-     * Clamps a RGB color number outside the sRGB color space
21
-     * @param int|float $n the number to clamp
22
-     * @return int|float
23
-     */
24
-    public static function clampNumberSrgb($n)
25
-    {
26
-        return self::clampNumber($n, 0, 255);
27
-    }
28
-
29
-    /**
30
-     * Converts a HSL color into a RGB color
31
-     * @param array $hslValues
32
-     * @return array
33
-     */
34
-    public static function hslToRgb($hslValues)
35
-    {
36
-        $h = floatval($hslValues[0]);
37
-        $s = floatval(str_replace('%', '', $hslValues[1]));
38
-        $l = floatval(str_replace('%', '', $hslValues[2]));
39
-
40
-        // Wrap and clamp, then fraction!
41
-        $h = ((($h % 360) + 360) % 360) / 360;
42
-        $s = self::clampNumber($s, 0, 100) / 100;
43
-        $l = self::clampNumber($l, 0, 100) / 100;
44
-
45
-        if ($s == 0) {
46
-            $r = $g = $b = self::roundNumber(255 * $l);
47
-        } else {
48
-            $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49
-            $v1 = (2 * $l) - $v2;
50
-            $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
51
-            $g = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h));
52
-            $b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1/3)));
53
-        }
54
-
55
-        return array($r, $g, $b);
56
-    }
57
-
58
-    /**
59
-     * Tests and selects the correct formula for each RGB color channel
60
-     * @param $v1
61
-     * @param $v2
62
-     * @param $vh
63
-     * @return mixed
64
-     */
65
-    public static function hueToRgb($v1, $v2, $vh)
66
-    {
67
-        $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
68
-
69
-        if ($vh * 6 < 1) {
70
-            return $v1 + ($v2 - $v1) * 6 * $vh;
71
-        }
72
-
73
-        if ($vh * 2 < 1) {
74
-            return $v2;
75
-        }
76
-
77
-        if ($vh * 3 < 2) {
78
-            return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
79
-        }
80
-
81
-        return $v1;
82
-    }
83
-
84
-    /**
85
-     * Convert strings like "64M" or "30" to int values
86
-     * @param mixed $size
87
-     * @return int
88
-     */
89
-    public static function normalizeInt($size)
90
-    {
91
-        if (is_string($size)) {
92
-            $letter = substr($size, -1);
93
-            $size = intval($size);
94
-            switch ($letter) {
95
-                case 'M':
96
-                case 'm':
97
-                    return (int) $size * 1048576;
98
-                case 'K':
99
-                case 'k':
100
-                    return (int) $size * 1024;
101
-                case 'G':
102
-                case 'g':
103
-                    return (int) $size * 1073741824;
104
-            }
105
-        }
106
-        return (int) $size;
107
-    }
108
-
109
-    /**
110
-     * Converts a string containing and RGB percentage value into a RGB integer value i.e. '90%' -> 229.5
111
-     * @param $rgbPercentage
112
-     * @return int
113
-     */
114
-    public static function rgbPercentageToRgbInteger($rgbPercentage)
115
-    {
116
-        if (strpos($rgbPercentage, '%') !== false) {
117
-            $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55);
118
-        }
119
-
120
-        return intval($rgbPercentage, 10);
121
-    }
122
-
123
-    /**
124
-     * Converts a RGB color into a HEX color
125
-     * @param array $rgbColors
126
-     * @return array
127
-     */
128
-    public static function rgbToHex($rgbColors)
129
-    {
130
-        $hexColors = array();
131
-
132
-        // Values outside the sRGB color space should be clipped (0-255)
133
-        for ($i = 0, $l = count($rgbColors); $i < $l; $i++) {
134
-            $hexColors[$i] = sprintf("%02x", self::clampNumberSrgb(self::rgbPercentageToRgbInteger($rgbColors[$i])));
135
-        }
136
-
137
-        return $hexColors;
138
-    }
139
-
140
-    /**
141
-     * Rounds a number to its closest integer
142
-     * @param $n
143
-     * @return int
144
-     */
145
-    public static function roundNumber($n)
146
-    {
147
-        return intval(round(floatval($n)), 10);
148
-    }
7
+	/**
8
+	 * Clamps a number between a minimum and a maximum value.
9
+	 * @param int|float $n the number to clamp
10
+	 * @param int|float $min the lower end number allowed
11
+	 * @param int|float $max the higher end number allowed
12
+	 * @return int|float
13
+	 */
14
+	public static function clampNumber($n, $min, $max)
15
+	{
16
+		return min(max($n, $min), $max);
17
+	}
18
+
19
+	/**
20
+	 * Clamps a RGB color number outside the sRGB color space
21
+	 * @param int|float $n the number to clamp
22
+	 * @return int|float
23
+	 */
24
+	public static function clampNumberSrgb($n)
25
+	{
26
+		return self::clampNumber($n, 0, 255);
27
+	}
28
+
29
+	/**
30
+	 * Converts a HSL color into a RGB color
31
+	 * @param array $hslValues
32
+	 * @return array
33
+	 */
34
+	public static function hslToRgb($hslValues)
35
+	{
36
+		$h = floatval($hslValues[0]);
37
+		$s = floatval(str_replace('%', '', $hslValues[1]));
38
+		$l = floatval(str_replace('%', '', $hslValues[2]));
39
+
40
+		// Wrap and clamp, then fraction!
41
+		$h = ((($h % 360) + 360) % 360) / 360;
42
+		$s = self::clampNumber($s, 0, 100) / 100;
43
+		$l = self::clampNumber($l, 0, 100) / 100;
44
+
45
+		if ($s == 0) {
46
+			$r = $g = $b = self::roundNumber(255 * $l);
47
+		} else {
48
+			$v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49
+			$v1 = (2 * $l) - $v2;
50
+			$r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
51
+			$g = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h));
52
+			$b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1/3)));
53
+		}
54
+
55
+		return array($r, $g, $b);
56
+	}
57
+
58
+	/**
59
+	 * Tests and selects the correct formula for each RGB color channel
60
+	 * @param $v1
61
+	 * @param $v2
62
+	 * @param $vh
63
+	 * @return mixed
64
+	 */
65
+	public static function hueToRgb($v1, $v2, $vh)
66
+	{
67
+		$vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
68
+
69
+		if ($vh * 6 < 1) {
70
+			return $v1 + ($v2 - $v1) * 6 * $vh;
71
+		}
72
+
73
+		if ($vh * 2 < 1) {
74
+			return $v2;
75
+		}
76
+
77
+		if ($vh * 3 < 2) {
78
+			return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
79
+		}
80
+
81
+		return $v1;
82
+	}
83
+
84
+	/**
85
+	 * Convert strings like "64M" or "30" to int values
86
+	 * @param mixed $size
87
+	 * @return int
88
+	 */
89
+	public static function normalizeInt($size)
90
+	{
91
+		if (is_string($size)) {
92
+			$letter = substr($size, -1);
93
+			$size = intval($size);
94
+			switch ($letter) {
95
+				case 'M':
96
+				case 'm':
97
+					return (int) $size * 1048576;
98
+				case 'K':
99
+				case 'k':
100
+					return (int) $size * 1024;
101
+				case 'G':
102
+				case 'g':
103
+					return (int) $size * 1073741824;
104
+			}
105
+		}
106
+		return (int) $size;
107
+	}
108
+
109
+	/**
110
+	 * Converts a string containing and RGB percentage value into a RGB integer value i.e. '90%' -> 229.5
111
+	 * @param $rgbPercentage
112
+	 * @return int
113
+	 */
114
+	public static function rgbPercentageToRgbInteger($rgbPercentage)
115
+	{
116
+		if (strpos($rgbPercentage, '%') !== false) {
117
+			$rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55);
118
+		}
119
+
120
+		return intval($rgbPercentage, 10);
121
+	}
122
+
123
+	/**
124
+	 * Converts a RGB color into a HEX color
125
+	 * @param array $rgbColors
126
+	 * @return array
127
+	 */
128
+	public static function rgbToHex($rgbColors)
129
+	{
130
+		$hexColors = array();
131
+
132
+		// Values outside the sRGB color space should be clipped (0-255)
133
+		for ($i = 0, $l = count($rgbColors); $i < $l; $i++) {
134
+			$hexColors[$i] = sprintf("%02x", self::clampNumberSrgb(self::rgbPercentageToRgbInteger($rgbColors[$i])));
135
+		}
136
+
137
+		return $hexColors;
138
+	}
139
+
140
+	/**
141
+	 * Rounds a number to its closest integer
142
+	 * @param $n
143
+	 * @return int
144
+	 */
145
+	public static function roundNumber($n)
146
+	{
147
+		return intval(round(floatval($n)), 10);
148
+	}
149 149
 }
Please login to merge, or discard this patch.
Braces   +19 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,9 +42,12 @@  discard block
 block discarded – undo
42 42
         $s = self::clampNumber($s, 0, 100) / 100;
43 43
         $l = self::clampNumber($l, 0, 100) / 100;
44 44
 
45
-        if ($s == 0) {
45
+        if ($s == 0)
46
+        {
46 47
             $r = $g = $b = self::roundNumber(255 * $l);
47
-        } else {
48
+        }
49
+        else
50
+        {
48 51
             $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49 52
             $v1 = (2 * $l) - $v2;
50 53
             $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
@@ -66,15 +69,18 @@  discard block
 block discarded – undo
66 69
     {
67 70
         $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
68 71
 
69
-        if ($vh * 6 < 1) {
72
+        if ($vh * 6 < 1)
73
+        {
70 74
             return $v1 + ($v2 - $v1) * 6 * $vh;
71 75
         }
72 76
 
73
-        if ($vh * 2 < 1) {
77
+        if ($vh * 2 < 1)
78
+        {
74 79
             return $v2;
75 80
         }
76 81
 
77
-        if ($vh * 3 < 2) {
82
+        if ($vh * 3 < 2)
83
+        {
78 84
             return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
79 85
         }
80 86
 
@@ -88,10 +94,12 @@  discard block
 block discarded – undo
88 94
      */
89 95
     public static function normalizeInt($size)
90 96
     {
91
-        if (is_string($size)) {
97
+        if (is_string($size))
98
+        {
92 99
             $letter = substr($size, -1);
93 100
             $size = intval($size);
94
-            switch ($letter) {
101
+            switch ($letter)
102
+            {
95 103
                 case 'M':
96 104
                 case 'm':
97 105
                     return (int) $size * 1048576;
@@ -113,7 +121,8 @@  discard block
 block discarded – undo
113 121
      */
114 122
     public static function rgbPercentageToRgbInteger($rgbPercentage)
115 123
     {
116
-        if (strpos($rgbPercentage, '%') !== false) {
124
+        if (strpos($rgbPercentage, '%') !== false)
125
+        {
117 126
             $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55);
118 127
         }
119 128
 
@@ -130,7 +139,8 @@  discard block
 block discarded – undo
130 139
         $hexColors = array();
131 140
 
132 141
         // Values outside the sRGB color space should be clipped (0-255)
133
-        for ($i = 0, $l = count($rgbColors); $i < $l; $i++) {
142
+        for ($i = 0, $l = count($rgbColors); $i < $l; $i++)
143
+        {
134 144
             $hexColors[$i] = sprintf("%02x", self::clampNumberSrgb(self::rgbPercentageToRgbInteger($rgbColors[$i])));
135 145
         }
136 146
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@
 block discarded – undo
47 47
         } else {
48 48
             $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49 49
             $v1 = (2 * $l) - $v2;
50
-            $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
50
+            $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1 / 3)));
51 51
             $g = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h));
52
-            $b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1/3)));
52
+            $b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1 / 3)));
53 53
         }
54 54
 
55 55
         return array($r, $g, $b);
Please login to merge, or discard this patch.
sources/ext/cssmin/tubalmartin/Command.php 4 patches
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -4,188 +4,188 @@  discard block
 block discarded – undo
4 4
 
5 5
 class Command
6 6
 {
7
-    const SUCCESS_EXIT = 0;
8
-    const FAILURE_EXIT = 1;
7
+	const SUCCESS_EXIT = 0;
8
+	const FAILURE_EXIT = 1;
9 9
     
10
-    protected $stats = array();
10
+	protected $stats = array();
11 11
     
12
-    public static function main()
13
-    {
14
-        $command = new self;
15
-        $command->run();
16
-    }
17
-
18
-    public function run()
19
-    {
20
-        $opts = getopt(
21
-            'hi:o:',
22
-            array(
23
-                'help',
24
-                'input:',
25
-                'output:',
26
-                'dry-run',
27
-                'keep-sourcemap',
28
-                'keep-sourcemap-comment',
29
-                'linebreak-position:',
30
-                'memory-limit:',
31
-                'pcre-backtrack-limit:',
32
-                'pcre-recursion-limit:',
33
-                'remove-important-comments'
34
-            )
35
-        );
36
-
37
-        $help = $this->getOpt(array('h', 'help'), $opts);
38
-        $input = $this->getOpt(array('i', 'input'), $opts);
39
-        $output = $this->getOpt(array('o', 'output'), $opts);
40
-        $dryrun = $this->getOpt('dry-run', $opts);
41
-        $keepSourceMapComment = $this->getOpt(array('keep-sourcemap', 'keep-sourcemap-comment'), $opts);
42
-        $linebreakPosition = $this->getOpt('linebreak-position', $opts);
43
-        $memoryLimit = $this->getOpt('memory-limit', $opts);
44
-        $backtrackLimit = $this->getOpt('pcre-backtrack-limit', $opts);
45
-        $recursionLimit = $this->getOpt('pcre-recursion-limit', $opts);
46
-        $removeImportantComments = $this->getOpt('remove-important-comments', $opts);
47
-
48
-        if (!is_null($help)) {
49
-            $this->showHelp();
50
-            die(self::SUCCESS_EXIT);
51
-        }
52
-
53
-        if (is_null($input)) {
54
-            fwrite(STDERR, '-i <file> argument is missing' . PHP_EOL);
55
-            $this->showHelp();
56
-            die(self::FAILURE_EXIT);
57
-        }
58
-
59
-        if (!is_readable($input)) {
60
-            fwrite(STDERR, 'Input file is not readable' . PHP_EOL);
61
-            die(self::FAILURE_EXIT);
62
-        }
63
-
64
-        $css = file_get_contents($input);
65
-
66
-        if ($css === false) {
67
-            fwrite(STDERR, 'Input CSS code could not be retrieved from input file' . PHP_EOL);
68
-            die(self::FAILURE_EXIT);
69
-        }
12
+	public static function main()
13
+	{
14
+		$command = new self;
15
+		$command->run();
16
+	}
17
+
18
+	public function run()
19
+	{
20
+		$opts = getopt(
21
+			'hi:o:',
22
+			array(
23
+				'help',
24
+				'input:',
25
+				'output:',
26
+				'dry-run',
27
+				'keep-sourcemap',
28
+				'keep-sourcemap-comment',
29
+				'linebreak-position:',
30
+				'memory-limit:',
31
+				'pcre-backtrack-limit:',
32
+				'pcre-recursion-limit:',
33
+				'remove-important-comments'
34
+			)
35
+		);
36
+
37
+		$help = $this->getOpt(array('h', 'help'), $opts);
38
+		$input = $this->getOpt(array('i', 'input'), $opts);
39
+		$output = $this->getOpt(array('o', 'output'), $opts);
40
+		$dryrun = $this->getOpt('dry-run', $opts);
41
+		$keepSourceMapComment = $this->getOpt(array('keep-sourcemap', 'keep-sourcemap-comment'), $opts);
42
+		$linebreakPosition = $this->getOpt('linebreak-position', $opts);
43
+		$memoryLimit = $this->getOpt('memory-limit', $opts);
44
+		$backtrackLimit = $this->getOpt('pcre-backtrack-limit', $opts);
45
+		$recursionLimit = $this->getOpt('pcre-recursion-limit', $opts);
46
+		$removeImportantComments = $this->getOpt('remove-important-comments', $opts);
47
+
48
+		if (!is_null($help)) {
49
+			$this->showHelp();
50
+			die(self::SUCCESS_EXIT);
51
+		}
52
+
53
+		if (is_null($input)) {
54
+			fwrite(STDERR, '-i <file> argument is missing' . PHP_EOL);
55
+			$this->showHelp();
56
+			die(self::FAILURE_EXIT);
57
+		}
58
+
59
+		if (!is_readable($input)) {
60
+			fwrite(STDERR, 'Input file is not readable' . PHP_EOL);
61
+			die(self::FAILURE_EXIT);
62
+		}
63
+
64
+		$css = file_get_contents($input);
65
+
66
+		if ($css === false) {
67
+			fwrite(STDERR, 'Input CSS code could not be retrieved from input file' . PHP_EOL);
68
+			die(self::FAILURE_EXIT);
69
+		}
70 70
         
71
-        $this->setStat('original-size', strlen($css));
71
+		$this->setStat('original-size', strlen($css));
72 72
         
73
-        $cssmin = new Minifier;
73
+		$cssmin = new Minifier;
74 74
 
75
-        if (!is_null($keepSourceMapComment)) {
76
-            $cssmin->keepSourceMapComment();
77
-        }
75
+		if (!is_null($keepSourceMapComment)) {
76
+			$cssmin->keepSourceMapComment();
77
+		}
78 78
 
79
-        if (!is_null($removeImportantComments)) {
80
-            $cssmin->removeImportantComments();
81
-        }
79
+		if (!is_null($removeImportantComments)) {
80
+			$cssmin->removeImportantComments();
81
+		}
82 82
 
83
-        if (!is_null($linebreakPosition)) {
84
-            $cssmin->setLineBreakPosition($linebreakPosition);
85
-        }
83
+		if (!is_null($linebreakPosition)) {
84
+			$cssmin->setLineBreakPosition($linebreakPosition);
85
+		}
86 86
         
87
-        if (!is_null($memoryLimit)) {
88
-            $cssmin->setMemoryLimit($memoryLimit);
89
-        }
87
+		if (!is_null($memoryLimit)) {
88
+			$cssmin->setMemoryLimit($memoryLimit);
89
+		}
90 90
 
91
-        if (!is_null($backtrackLimit)) {
92
-            $cssmin->setPcreBacktrackLimit($backtrackLimit);
93
-        }
91
+		if (!is_null($backtrackLimit)) {
92
+			$cssmin->setPcreBacktrackLimit($backtrackLimit);
93
+		}
94 94
 
95
-        if (!is_null($recursionLimit)) {
96
-            $cssmin->setPcreRecursionLimit($recursionLimit);
97
-        }
95
+		if (!is_null($recursionLimit)) {
96
+			$cssmin->setPcreRecursionLimit($recursionLimit);
97
+		}
98 98
         
99
-        $this->setStat('compression-time-start', microtime(true));
99
+		$this->setStat('compression-time-start', microtime(true));
100 100
         
101
-        $css = $cssmin->run($css);
101
+		$css = $cssmin->run($css);
102 102
 
103
-        $this->setStat('compression-time-end', microtime(true));
104
-        $this->setStat('peak-memory-usage', memory_get_peak_usage(true));
105
-        $this->setStat('compressed-size', strlen($css));
103
+		$this->setStat('compression-time-end', microtime(true));
104
+		$this->setStat('peak-memory-usage', memory_get_peak_usage(true));
105
+		$this->setStat('compressed-size', strlen($css));
106 106
         
107
-        if (!is_null($dryrun)) {
108
-            $this->showStats();
109
-            die(self::SUCCESS_EXIT);
110
-        }
111
-
112
-        if (is_null($output)) {
113
-            fwrite(STDOUT, $css . PHP_EOL);
114
-            $this->showStats();
115
-            die(self::SUCCESS_EXIT);
116
-        }
117
-
118
-        if (!is_writable(dirname($output))) {
119
-            fwrite(STDERR, 'Output file is not writable' . PHP_EOL);
120
-            die(self::FAILURE_EXIT);
121
-        }
122
-
123
-        if (file_put_contents($output, $css) === false) {
124
-            fwrite(STDERR, 'Compressed CSS code could not be saved to output file' . PHP_EOL);
125
-            die(self::FAILURE_EXIT);
126
-        }
127
-
128
-        $this->showStats();
129
-
130
-        die(self::SUCCESS_EXIT);
131
-    }
132
-
133
-    protected function getOpt($opts, $options)
134
-    {
135
-        $value = null;
136
-
137
-        if (is_string($opts)) {
138
-            $opts = array($opts);
139
-        }
140
-
141
-        foreach ($opts as $opt) {
142
-            if (array_key_exists($opt, $options)) {
143
-                $value = $options[$opt];
144
-                break;
145
-            }
146
-        }
147
-
148
-        return $value;
149
-    }
107
+		if (!is_null($dryrun)) {
108
+			$this->showStats();
109
+			die(self::SUCCESS_EXIT);
110
+		}
111
+
112
+		if (is_null($output)) {
113
+			fwrite(STDOUT, $css . PHP_EOL);
114
+			$this->showStats();
115
+			die(self::SUCCESS_EXIT);
116
+		}
117
+
118
+		if (!is_writable(dirname($output))) {
119
+			fwrite(STDERR, 'Output file is not writable' . PHP_EOL);
120
+			die(self::FAILURE_EXIT);
121
+		}
122
+
123
+		if (file_put_contents($output, $css) === false) {
124
+			fwrite(STDERR, 'Compressed CSS code could not be saved to output file' . PHP_EOL);
125
+			die(self::FAILURE_EXIT);
126
+		}
127
+
128
+		$this->showStats();
129
+
130
+		die(self::SUCCESS_EXIT);
131
+	}
132
+
133
+	protected function getOpt($opts, $options)
134
+	{
135
+		$value = null;
136
+
137
+		if (is_string($opts)) {
138
+			$opts = array($opts);
139
+		}
140
+
141
+		foreach ($opts as $opt) {
142
+			if (array_key_exists($opt, $options)) {
143
+				$value = $options[$opt];
144
+				break;
145
+			}
146
+		}
147
+
148
+		return $value;
149
+	}
150 150
     
151
-    protected function setStat($statName, $statValue)
152
-    {
153
-        $this->stats[$statName] = $statValue;
154
-    }
151
+	protected function setStat($statName, $statValue)
152
+	{
153
+		$this->stats[$statName] = $statValue;
154
+	}
155 155
     
156
-    protected function formatBytes($size, $precision = 2)
157
-    {
158
-        $base = log($size, 1024);
159
-        $suffixes = array('B', 'K', 'M', 'G', 'T');
160
-        return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
161
-    }
156
+	protected function formatBytes($size, $precision = 2)
157
+	{
158
+		$base = log($size, 1024);
159
+		$suffixes = array('B', 'K', 'M', 'G', 'T');
160
+		return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
161
+	}
162 162
     
163
-    protected function formatMicroSeconds($microSecs, $precision = 2)
164
-    {
165
-        // ms
166
-        $time = round($microSecs * 1000, $precision);
163
+	protected function formatMicroSeconds($microSecs, $precision = 2)
164
+	{
165
+		// ms
166
+		$time = round($microSecs * 1000, $precision);
167 167
         
168
-        if ($time >= 60 * 1000) {
169
-            $time = round($time / 60 * 1000, $precision) .' m'; // m
170
-        } elseif ($time >= 1000) {
171
-            $time = round($time / 1000, $precision) .' s'; // s
172
-        } else {
173
-            $time .= ' ms';
174
-        }
168
+		if ($time >= 60 * 1000) {
169
+			$time = round($time / 60 * 1000, $precision) .' m'; // m
170
+		} elseif ($time >= 1000) {
171
+			$time = round($time / 1000, $precision) .' s'; // s
172
+		} else {
173
+			$time .= ' ms';
174
+		}
175 175
         
176
-        return $time;
177
-    }
176
+		return $time;
177
+	}
178 178
     
179
-    protected function showStats()
180
-    {
181
-        $spaceSavings = round((1 - ($this->stats['compressed-size'] / $this->stats['original-size'])) * 100, 2);
182
-        $compressionRatio = round($this->stats['original-size'] / $this->stats['compressed-size'], 2);
183
-        $compressionTime = $this->formatMicroSeconds(
184
-            $this->stats['compression-time-end'] - $this->stats['compression-time-start']
185
-        );
186
-        $peakMemoryUsage = $this->formatBytes($this->stats['peak-memory-usage']);
179
+	protected function showStats()
180
+	{
181
+		$spaceSavings = round((1 - ($this->stats['compressed-size'] / $this->stats['original-size'])) * 100, 2);
182
+		$compressionRatio = round($this->stats['original-size'] / $this->stats['compressed-size'], 2);
183
+		$compressionTime = $this->formatMicroSeconds(
184
+			$this->stats['compression-time-end'] - $this->stats['compression-time-start']
185
+		);
186
+		$peakMemoryUsage = $this->formatBytes($this->stats['peak-memory-usage']);
187 187
         
188
-        print <<<EOT
188
+		print <<<EOT
189 189
         
190 190
 ------------------------------
191 191
 CSSMIN STATS        
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 
198 198
 
199 199
 EOT;
200
-    }
200
+	}
201 201
 
202
-    protected function showHelp()
203
-    {
204
-        print <<<'EOT'
202
+	protected function showHelp()
203
+	{
204
+		print <<<'EOT'
205 205
 Usage: cssmin [options] -i <file> [-o <file>]
206 206
   
207 207
   -i|--input <file>              File containing uncompressed CSS code.
@@ -219,5 +219,5 @@  discard block
 block discarded – undo
219 219
   --remove-important-comments    Removes !important comments from output.
220 220
 
221 221
 EOT;
222
-    }
222
+	}
223 223
 }
Please login to merge, or discard this patch.
Braces   +42 added lines, -20 removed lines patch added patch discarded remove patch
@@ -45,25 +45,29 @@  discard block
 block discarded – undo
45 45
         $recursionLimit = $this->getOpt('pcre-recursion-limit', $opts);
46 46
         $removeImportantComments = $this->getOpt('remove-important-comments', $opts);
47 47
 
48
-        if (!is_null($help)) {
48
+        if (!is_null($help))
49
+        {
49 50
             $this->showHelp();
50 51
             die(self::SUCCESS_EXIT);
51 52
         }
52 53
 
53
-        if (is_null($input)) {
54
+        if (is_null($input))
55
+        {
54 56
             fwrite(STDERR, '-i <file> argument is missing' . PHP_EOL);
55 57
             $this->showHelp();
56 58
             die(self::FAILURE_EXIT);
57 59
         }
58 60
 
59
-        if (!is_readable($input)) {
61
+        if (!is_readable($input))
62
+        {
60 63
             fwrite(STDERR, 'Input file is not readable' . PHP_EOL);
61 64
             die(self::FAILURE_EXIT);
62 65
         }
63 66
 
64 67
         $css = file_get_contents($input);
65 68
 
66
-        if ($css === false) {
69
+        if ($css === false)
70
+        {
67 71
             fwrite(STDERR, 'Input CSS code could not be retrieved from input file' . PHP_EOL);
68 72
             die(self::FAILURE_EXIT);
69 73
         }
@@ -72,27 +76,33 @@  discard block
 block discarded – undo
72 76
         
73 77
         $cssmin = new Minifier;
74 78
 
75
-        if (!is_null($keepSourceMapComment)) {
79
+        if (!is_null($keepSourceMapComment))
80
+        {
76 81
             $cssmin->keepSourceMapComment();
77 82
         }
78 83
 
79
-        if (!is_null($removeImportantComments)) {
84
+        if (!is_null($removeImportantComments))
85
+        {
80 86
             $cssmin->removeImportantComments();
81 87
         }
82 88
 
83
-        if (!is_null($linebreakPosition)) {
89
+        if (!is_null($linebreakPosition))
90
+        {
84 91
             $cssmin->setLineBreakPosition($linebreakPosition);
85 92
         }
86 93
         
87
-        if (!is_null($memoryLimit)) {
94
+        if (!is_null($memoryLimit))
95
+        {
88 96
             $cssmin->setMemoryLimit($memoryLimit);
89 97
         }
90 98
 
91
-        if (!is_null($backtrackLimit)) {
99
+        if (!is_null($backtrackLimit))
100
+        {
92 101
             $cssmin->setPcreBacktrackLimit($backtrackLimit);
93 102
         }
94 103
 
95
-        if (!is_null($recursionLimit)) {
104
+        if (!is_null($recursionLimit))
105
+        {
96 106
             $cssmin->setPcreRecursionLimit($recursionLimit);
97 107
         }
98 108
         
@@ -104,23 +114,27 @@  discard block
 block discarded – undo
104 114
         $this->setStat('peak-memory-usage', memory_get_peak_usage(true));
105 115
         $this->setStat('compressed-size', strlen($css));
106 116
         
107
-        if (!is_null($dryrun)) {
117
+        if (!is_null($dryrun))
118
+        {
108 119
             $this->showStats();
109 120
             die(self::SUCCESS_EXIT);
110 121
         }
111 122
 
112
-        if (is_null($output)) {
123
+        if (is_null($output))
124
+        {
113 125
             fwrite(STDOUT, $css . PHP_EOL);
114 126
             $this->showStats();
115 127
             die(self::SUCCESS_EXIT);
116 128
         }
117 129
 
118
-        if (!is_writable(dirname($output))) {
130
+        if (!is_writable(dirname($output)))
131
+        {
119 132
             fwrite(STDERR, 'Output file is not writable' . PHP_EOL);
120 133
             die(self::FAILURE_EXIT);
121 134
         }
122 135
 
123
-        if (file_put_contents($output, $css) === false) {
136
+        if (file_put_contents($output, $css) === false)
137
+        {
124 138
             fwrite(STDERR, 'Compressed CSS code could not be saved to output file' . PHP_EOL);
125 139
             die(self::FAILURE_EXIT);
126 140
         }
@@ -134,12 +148,15 @@  discard block
 block discarded – undo
134 148
     {
135 149
         $value = null;
136 150
 
137
-        if (is_string($opts)) {
151
+        if (is_string($opts))
152
+        {
138 153
             $opts = array($opts);
139 154
         }
140 155
 
141
-        foreach ($opts as $opt) {
142
-            if (array_key_exists($opt, $options)) {
156
+        foreach ($opts as $opt)
157
+        {
158
+            if (array_key_exists($opt, $options))
159
+            {
143 160
                 $value = $options[$opt];
144 161
                 break;
145 162
             }
@@ -165,11 +182,16 @@  discard block
 block discarded – undo
165 182
         // ms
166 183
         $time = round($microSecs * 1000, $precision);
167 184
         
168
-        if ($time >= 60 * 1000) {
185
+        if ($time >= 60 * 1000)
186
+        {
169 187
             $time = round($time / 60 * 1000, $precision) .' m'; // m
170
-        } elseif ($time >= 1000) {
188
+        }
189
+        elseif ($time >= 1000)
190
+        {
171 191
             $time = round($time / 1000, $precision) .' s'; // s
172
-        } else {
192
+        }
193
+        else
194
+        {
173 195
             $time .= ' ms';
174 196
         }
175 197
         
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 Peak memory usage:   $peakMemoryUsage
197 197
 
198 198
 
199
-EOT;
199
+eot;
200 200
     }
201 201
 
202 202
     protected function showHelp()
@@ -218,6 +218,6 @@  discard block
 block discarded – undo
218 218
   --pcre-recursion-limit <limit> Sets the PCRE recursion limit for this script.
219 219
   --remove-important-comments    Removes !important comments from output.
220 220
 
221
-EOT;
221
+eot;
222 222
     }
223 223
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $base = log($size, 1024);
159 159
         $suffixes = array('B', 'K', 'M', 'G', 'T');
160
-        return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)];
160
+        return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
161 161
     }
162 162
     
163 163
     protected function formatMicroSeconds($microSecs, $precision = 2)
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
         $time = round($microSecs * 1000, $precision);
167 167
         
168 168
         if ($time >= 60 * 1000) {
169
-            $time = round($time / 60 * 1000, $precision) .' m'; // m
169
+            $time = round($time / 60 * 1000, $precision) . ' m'; // m
170 170
         } elseif ($time >= 1000) {
171
-            $time = round($time / 1000, $precision) .' s'; // s
171
+            $time = round($time / 1000, $precision) . ' s'; // s
172 172
         } else {
173 173
             $time .= ' ms';
174 174
         }
Please login to merge, or discard this patch.
sources/ext/cssmin/tubalmartin/Colors.php 1 patch
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -4,152 +4,152 @@
 block discarded – undo
4 4
 
5 5
 class Colors
6 6
 {
7
-    public static function getHexToNamedMap()
8
-    {
9
-        // Hex colors longer than named counterpart
10
-        return array(
11
-            '#f0ffff' => 'azure',
12
-            '#f5f5dc' => 'beige',
13
-            '#ffe4c4' => 'bisque',
14
-            '#a52a2a' => 'brown',
15
-            '#ff7f50' => 'coral',
16
-            '#ffd700' => 'gold',
17
-            '#808080' => 'gray',
18
-            '#008000' => 'green',
19
-            '#4b0082' => 'indigo',
20
-            '#fffff0' => 'ivory',
21
-            '#f0e68c' => 'khaki',
22
-            '#faf0e6' => 'linen',
23
-            '#800000' => 'maroon',
24
-            '#000080' => 'navy',
25
-            '#fdf5e6' => 'oldlace',
26
-            '#808000' => 'olive',
27
-            '#ffa500' => 'orange',
28
-            '#da70d6' => 'orchid',
29
-            '#cd853f' => 'peru',
30
-            '#ffc0cb' => 'pink',
31
-            '#dda0dd' => 'plum',
32
-            '#800080' => 'purple',
33
-            '#f00'    => 'red',
34
-            '#fa8072' => 'salmon',
35
-            '#a0522d' => 'sienna',
36
-            '#c0c0c0' => 'silver',
37
-            '#fffafa' => 'snow',
38
-            '#d2b48c' => 'tan',
39
-            '#008080' => 'teal',
40
-            '#ff6347' => 'tomato',
41
-            '#ee82ee' => 'violet',
42
-            '#f5deb3' => 'wheat'
43
-        );
44
-    }
7
+	public static function getHexToNamedMap()
8
+	{
9
+		// Hex colors longer than named counterpart
10
+		return array(
11
+			'#f0ffff' => 'azure',
12
+			'#f5f5dc' => 'beige',
13
+			'#ffe4c4' => 'bisque',
14
+			'#a52a2a' => 'brown',
15
+			'#ff7f50' => 'coral',
16
+			'#ffd700' => 'gold',
17
+			'#808080' => 'gray',
18
+			'#008000' => 'green',
19
+			'#4b0082' => 'indigo',
20
+			'#fffff0' => 'ivory',
21
+			'#f0e68c' => 'khaki',
22
+			'#faf0e6' => 'linen',
23
+			'#800000' => 'maroon',
24
+			'#000080' => 'navy',
25
+			'#fdf5e6' => 'oldlace',
26
+			'#808000' => 'olive',
27
+			'#ffa500' => 'orange',
28
+			'#da70d6' => 'orchid',
29
+			'#cd853f' => 'peru',
30
+			'#ffc0cb' => 'pink',
31
+			'#dda0dd' => 'plum',
32
+			'#800080' => 'purple',
33
+			'#f00'    => 'red',
34
+			'#fa8072' => 'salmon',
35
+			'#a0522d' => 'sienna',
36
+			'#c0c0c0' => 'silver',
37
+			'#fffafa' => 'snow',
38
+			'#d2b48c' => 'tan',
39
+			'#008080' => 'teal',
40
+			'#ff6347' => 'tomato',
41
+			'#ee82ee' => 'violet',
42
+			'#f5deb3' => 'wheat'
43
+		);
44
+	}
45 45
 
46
-    public static function getNamedToHexMap()
47
-    {
48
-        // Named colors longer than hex counterpart
49
-        return array(
50
-            'aliceblue' => '#f0f8ff',
51
-            'antiquewhite' => '#faebd7',
52
-            'aquamarine' => '#7fffd4',
53
-            'black' => '#000',
54
-            'blanchedalmond' => '#ffebcd',
55
-            'blueviolet' => '#8a2be2',
56
-            'burlywood' => '#deb887',
57
-            'cadetblue' => '#5f9ea0',
58
-            'chartreuse' => '#7fff00',
59
-            'chocolate' => '#d2691e',
60
-            'cornflowerblue' => '#6495ed',
61
-            'cornsilk' => '#fff8dc',
62
-            'darkblue' => '#00008b',
63
-            'darkcyan' => '#008b8b',
64
-            'darkgoldenrod' => '#b8860b',
65
-            'darkgray' => '#a9a9a9',
66
-            'darkgreen' => '#006400',
67
-            'darkgrey' => '#a9a9a9',
68
-            'darkkhaki' => '#bdb76b',
69
-            'darkmagenta' => '#8b008b',
70
-            'darkolivegreen' => '#556b2f',
71
-            'darkorange' => '#ff8c00',
72
-            'darkorchid' => '#9932cc',
73
-            'darksalmon' => '#e9967a',
74
-            'darkseagreen' => '#8fbc8f',
75
-            'darkslateblue' => '#483d8b',
76
-            'darkslategray' => '#2f4f4f',
77
-            'darkslategrey' => '#2f4f4f',
78
-            'darkturquoise' => '#00ced1',
79
-            'darkviolet' => '#9400d3',
80
-            'deeppink' => '#ff1493',
81
-            'deepskyblue' => '#00bfff',
82
-            'dodgerblue' => '#1e90ff',
83
-            'firebrick' => '#b22222',
84
-            'floralwhite' => '#fffaf0',
85
-            'forestgreen' => '#228b22',
86
-            'fuchsia' => '#f0f',
87
-            'gainsboro' => '#dcdcdc',
88
-            'ghostwhite' => '#f8f8ff',
89
-            'goldenrod' => '#daa520',
90
-            'greenyellow' => '#adff2f',
91
-            'honeydew' => '#f0fff0',
92
-            'indianred' => '#cd5c5c',
93
-            'lavender' => '#e6e6fa',
94
-            'lavenderblush' => '#fff0f5',
95
-            'lawngreen' => '#7cfc00',
96
-            'lemonchiffon' => '#fffacd',
97
-            'lightblue' => '#add8e6',
98
-            'lightcoral' => '#f08080',
99
-            'lightcyan' => '#e0ffff',
100
-            'lightgoldenrodyellow' => '#fafad2',
101
-            'lightgray' => '#d3d3d3',
102
-            'lightgreen' => '#90ee90',
103
-            'lightgrey' => '#d3d3d3',
104
-            'lightpink' => '#ffb6c1',
105
-            'lightsalmon' => '#ffa07a',
106
-            'lightseagreen' => '#20b2aa',
107
-            'lightskyblue' => '#87cefa',
108
-            'lightslategray' => '#778899',
109
-            'lightslategrey' => '#778899',
110
-            'lightsteelblue' => '#b0c4de',
111
-            'lightyellow' => '#ffffe0',
112
-            'limegreen' => '#32cd32',
113
-            'mediumaquamarine' => '#66cdaa',
114
-            'mediumblue' => '#0000cd',
115
-            'mediumorchid' => '#ba55d3',
116
-            'mediumpurple' => '#9370db',
117
-            'mediumseagreen' => '#3cb371',
118
-            'mediumslateblue' => '#7b68ee',
119
-            'mediumspringgreen' => '#00fa9a',
120
-            'mediumturquoise' => '#48d1cc',
121
-            'mediumvioletred' => '#c71585',
122
-            'midnightblue' => '#191970',
123
-            'mintcream' => '#f5fffa',
124
-            'mistyrose' => '#ffe4e1',
125
-            'moccasin' => '#ffe4b5',
126
-            'navajowhite' => '#ffdead',
127
-            'olivedrab' => '#6b8e23',
128
-            'orangered' => '#ff4500',
129
-            'palegoldenrod' => '#eee8aa',
130
-            'palegreen' => '#98fb98',
131
-            'paleturquoise' => '#afeeee',
132
-            'palevioletred' => '#db7093',
133
-            'papayawhip' => '#ffefd5',
134
-            'peachpuff' => '#ffdab9',
135
-            'powderblue' => '#b0e0e6',
136
-            'rebeccapurple' => '#663399',
137
-            'rosybrown' => '#bc8f8f',
138
-            'royalblue' => '#4169e1',
139
-            'saddlebrown' => '#8b4513',
140
-            'sandybrown' => '#f4a460',
141
-            'seagreen' => '#2e8b57',
142
-            'seashell' => '#fff5ee',
143
-            'slateblue' => '#6a5acd',
144
-            'slategray' => '#708090',
145
-            'slategrey' => '#708090',
146
-            'springgreen' => '#00ff7f',
147
-            'steelblue' => '#4682b4',
148
-            'turquoise' => '#40e0d0',
149
-            'white' => '#fff',
150
-            'whitesmoke' => '#f5f5f5',
151
-            'yellow' => '#ff0',
152
-            'yellowgreen' => '#9acd32'
153
-        );
154
-    }
46
+	public static function getNamedToHexMap()
47
+	{
48
+		// Named colors longer than hex counterpart
49
+		return array(
50
+			'aliceblue' => '#f0f8ff',
51
+			'antiquewhite' => '#faebd7',
52
+			'aquamarine' => '#7fffd4',
53
+			'black' => '#000',
54
+			'blanchedalmond' => '#ffebcd',
55
+			'blueviolet' => '#8a2be2',
56
+			'burlywood' => '#deb887',
57
+			'cadetblue' => '#5f9ea0',
58
+			'chartreuse' => '#7fff00',
59
+			'chocolate' => '#d2691e',
60
+			'cornflowerblue' => '#6495ed',
61
+			'cornsilk' => '#fff8dc',
62
+			'darkblue' => '#00008b',
63
+			'darkcyan' => '#008b8b',
64
+			'darkgoldenrod' => '#b8860b',
65
+			'darkgray' => '#a9a9a9',
66
+			'darkgreen' => '#006400',
67
+			'darkgrey' => '#a9a9a9',
68
+			'darkkhaki' => '#bdb76b',
69
+			'darkmagenta' => '#8b008b',
70
+			'darkolivegreen' => '#556b2f',
71
+			'darkorange' => '#ff8c00',
72
+			'darkorchid' => '#9932cc',
73
+			'darksalmon' => '#e9967a',
74
+			'darkseagreen' => '#8fbc8f',
75
+			'darkslateblue' => '#483d8b',
76
+			'darkslategray' => '#2f4f4f',
77
+			'darkslategrey' => '#2f4f4f',
78
+			'darkturquoise' => '#00ced1',
79
+			'darkviolet' => '#9400d3',
80
+			'deeppink' => '#ff1493',
81
+			'deepskyblue' => '#00bfff',
82
+			'dodgerblue' => '#1e90ff',
83
+			'firebrick' => '#b22222',
84
+			'floralwhite' => '#fffaf0',
85
+			'forestgreen' => '#228b22',
86
+			'fuchsia' => '#f0f',
87
+			'gainsboro' => '#dcdcdc',
88
+			'ghostwhite' => '#f8f8ff',
89
+			'goldenrod' => '#daa520',
90
+			'greenyellow' => '#adff2f',
91
+			'honeydew' => '#f0fff0',
92
+			'indianred' => '#cd5c5c',
93
+			'lavender' => '#e6e6fa',
94
+			'lavenderblush' => '#fff0f5',
95
+			'lawngreen' => '#7cfc00',
96
+			'lemonchiffon' => '#fffacd',
97
+			'lightblue' => '#add8e6',
98
+			'lightcoral' => '#f08080',
99
+			'lightcyan' => '#e0ffff',
100
+			'lightgoldenrodyellow' => '#fafad2',
101
+			'lightgray' => '#d3d3d3',
102
+			'lightgreen' => '#90ee90',
103
+			'lightgrey' => '#d3d3d3',
104
+			'lightpink' => '#ffb6c1',
105
+			'lightsalmon' => '#ffa07a',
106
+			'lightseagreen' => '#20b2aa',
107
+			'lightskyblue' => '#87cefa',
108
+			'lightslategray' => '#778899',
109
+			'lightslategrey' => '#778899',
110
+			'lightsteelblue' => '#b0c4de',
111
+			'lightyellow' => '#ffffe0',
112
+			'limegreen' => '#32cd32',
113
+			'mediumaquamarine' => '#66cdaa',
114
+			'mediumblue' => '#0000cd',
115
+			'mediumorchid' => '#ba55d3',
116
+			'mediumpurple' => '#9370db',
117
+			'mediumseagreen' => '#3cb371',
118
+			'mediumslateblue' => '#7b68ee',
119
+			'mediumspringgreen' => '#00fa9a',
120
+			'mediumturquoise' => '#48d1cc',
121
+			'mediumvioletred' => '#c71585',
122
+			'midnightblue' => '#191970',
123
+			'mintcream' => '#f5fffa',
124
+			'mistyrose' => '#ffe4e1',
125
+			'moccasin' => '#ffe4b5',
126
+			'navajowhite' => '#ffdead',
127
+			'olivedrab' => '#6b8e23',
128
+			'orangered' => '#ff4500',
129
+			'palegoldenrod' => '#eee8aa',
130
+			'palegreen' => '#98fb98',
131
+			'paleturquoise' => '#afeeee',
132
+			'palevioletred' => '#db7093',
133
+			'papayawhip' => '#ffefd5',
134
+			'peachpuff' => '#ffdab9',
135
+			'powderblue' => '#b0e0e6',
136
+			'rebeccapurple' => '#663399',
137
+			'rosybrown' => '#bc8f8f',
138
+			'royalblue' => '#4169e1',
139
+			'saddlebrown' => '#8b4513',
140
+			'sandybrown' => '#f4a460',
141
+			'seagreen' => '#2e8b57',
142
+			'seashell' => '#fff5ee',
143
+			'slateblue' => '#6a5acd',
144
+			'slategray' => '#708090',
145
+			'slategrey' => '#708090',
146
+			'springgreen' => '#00ff7f',
147
+			'steelblue' => '#4682b4',
148
+			'turquoise' => '#40e0d0',
149
+			'white' => '#fff',
150
+			'whitesmoke' => '#f5f5f5',
151
+			'yellow' => '#ff0',
152
+			'yellowgreen' => '#9acd32'
153
+		);
154
+	}
155 155
 }
Please login to merge, or discard this patch.
sources/ext/serialize.php 2 patches
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,9 +92,12 @@  discard block
 block discarded – undo
92 92
 		mb_internal_encoding('ASCII');
93 93
 	}
94 94
 
95
-	try {
95
+	try
96
+	{
96 97
 		$out = _safe_serialize($value);
97
-	} catch(Exception $e) {
98
+	}
99
+	catch(Exception $e)
100
+	{
98 101
 		$out = false;
99 102
 	}
100 103
 
@@ -215,7 +218,8 @@  discard block
 block discarded – undo
215 218
 
216 219
 					// go to terminal state if we're at the end of the root array
217 220
 					array_pop($expected);
218
-					if(count($expected) == 0) {
221
+					if(count($expected) == 0)
222
+					{
219 223
 						$state = 1;
220 224
 					}
221 225
 					break;
@@ -287,9 +291,12 @@  discard block
 block discarded – undo
287 291
 		mb_internal_encoding('ASCII');
288 292
 	}
289 293
 
290
-	try {
294
+	try
295
+	{
291 296
 		$out = _safe_unserialize($str);
292
-	} catch(Exception $e) {
297
+	}
298
+	catch(Exception $e)
299
+	{
293 300
 		$out = '';
294 301
 	}
295 302
 
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -31,48 +31,48 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  * @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects)
33 33
  */
34
-function _safe_serialize( $value )
34
+function _safe_serialize($value)
35 35
 {
36
-	if(is_null($value))
36
+	if (is_null($value))
37 37
 	{
38 38
 		return 'N;';
39 39
 	}
40
-	if(is_bool($value))
40
+	if (is_bool($value))
41 41
 	{
42
-		return 'b:'.(int)$value.';';
42
+		return 'b:' . (int) $value . ';';
43 43
 	}
44
-	if(is_int($value))
44
+	if (is_int($value))
45 45
 	{
46
-		return 'i:'.$value.';';
46
+		return 'i:' . $value . ';';
47 47
 	}
48
-	if(is_float($value))
48
+	if (is_float($value))
49 49
 	{
50
-		return 'd:'.$value.';';
50
+		return 'd:' . $value . ';';
51 51
 	}
52
-	if(is_string($value))
52
+	if (is_string($value))
53 53
 	{
54
-		return 's:'.strlen($value).':"'.$value.'";';
54
+		return 's:' . strlen($value) . ':"' . $value . '";';
55 55
 	}
56
-	if(is_array($value))
56
+	if (is_array($value))
57 57
 	{
58 58
 		$out = '';
59
-		foreach($value as $k => $v)
59
+		foreach ($value as $k => $v)
60 60
 		{
61 61
 			$out .= _safe_serialize($k) . _safe_serialize($v);
62 62
 		}
63 63
 
64
-		return 'a:'.count($value).':{'.$out.'}';
64
+		return 'a:' . count($value) . ':{' . $out . '}';
65 65
 	}
66
-	if(is_resource($value))
66
+	if (is_resource($value))
67 67
 	{
68 68
 		// built-in returns 'i:0;'
69 69
 		throw new \Exception('safe_serialize: resources not supported');
70 70
 	}
71
-	if(is_object($value) || gettype($value) == 'object')
71
+	if (is_object($value) || gettype($value) == 'object')
72 72
 	{
73 73
 		throw new \Exception('safe_serialize: objects not supported');
74 74
 	}
75
-	throw new \Exception('safe_serialize cannot serialize: '.gettype($value));
75
+	throw new \Exception('safe_serialize cannot serialize: ' . gettype($value));
76 76
 }
77 77
 
78 78
 /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
  * @param mixed $value
83 83
  * @return string
84 84
  */
85
-function safe_serialize( $value )
85
+function safe_serialize($value)
86 86
 {
87 87
 	// ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
88 88
 	if (function_exists('mb_internal_encoding') &&
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 	try {
96 96
 		$out = _safe_serialize($value);
97
-	} catch(Exception $e) {
97
+	} catch (Exception $e) {
98 98
 		$out = false;
99 99
 	}
100 100
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function _safe_unserialize($str)
116 116
 {
117
-	if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
117
+	if (strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
118 118
 	{
119 119
 		throw new \Exception('safe_unserialize: input exceeds ' . MAX_SERIALIZED_INPUT_LENGTH);
120 120
 	}
121 121
 
122
-	if(empty($str) || !is_string($str))
122
+	if (empty($str) || !is_string($str))
123 123
 	{
124 124
 		return false;
125 125
 	}
@@ -128,59 +128,59 @@  discard block
 block discarded – undo
128 128
 	$expected = array();
129 129
 	$state = 0;
130 130
 
131
-	while($state != 1)
131
+	while ($state != 1)
132 132
 	{
133 133
 		$type = isset($str[0]) ? $str[0] : '';
134 134
 
135
-		if($type == '}')
135
+		if ($type == '}')
136 136
 		{
137 137
 			$str = substr($str, 1);
138 138
 		}
139
-		else if($type == 'N' && $str[1] == ';')
139
+		else if ($type == 'N' && $str[1] == ';')
140 140
 		{
141 141
 			$value = null;
142 142
 			$str = substr($str, 2);
143 143
 		}
144
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
144
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
145 145
 		{
146 146
 			$value = $matches[1] == '1' ? true : false;
147 147
 			$str = substr($str, 4);
148 148
 		}
149
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
149
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
150 150
 		{
151
-			$value = (int)$matches[1];
151
+			$value = (int) $matches[1];
152 152
 			$str = $matches[2];
153 153
 		}
154
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
154
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
155 155
 		{
156
-			$value = (float)$matches[1];
156
+			$value = (float) $matches[1];
157 157
 			$str = $matches[3];
158 158
 		}
159
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
159
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
160 160
 		{
161
-			$value = substr($matches[2], 0, (int)$matches[1]);
162
-			$str = substr($matches[2], (int)$matches[1] + 2);
161
+			$value = substr($matches[2], 0, (int) $matches[1]);
162
+			$str = substr($matches[2], (int) $matches[1] + 2);
163 163
 		}
164
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH)
164
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH)
165 165
 		{
166
-			$expectedLength = (int)$matches[1];
166
+			$expectedLength = (int) $matches[1];
167 167
 			$str = $matches[2];
168 168
 		}
169
-		else if($type == 'O')
169
+		else if ($type == 'O')
170 170
 		{
171 171
 			throw new \Exception('safe_unserialize: objects not supported');
172 172
 		}
173 173
 		else
174 174
 		{
175
-			throw new \Exception('safe_unserialize: unknown/malformed type: '.$type);
175
+			throw new \Exception('safe_unserialize: unknown/malformed type: ' . $type);
176 176
 		}
177 177
 
178
-		switch($state)
178
+		switch ($state)
179 179
 		{
180 180
 			case 3: // in array, expecting value or another array
181
-				if($type == 'a')
181
+				if ($type == 'a')
182 182
 				{
183
-					if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
183
+					if (count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
184 184
 					{
185 185
 						throw new \Exception('safe_unserialize: array nesting exceeds ' . MAX_SERIALIZED_ARRAY_DEPTH);
186 186
 					}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 					$state = 2;
193 193
 					break;
194 194
 				}
195
-				if($type != '}')
195
+				if ($type != '}')
196 196
 				{
197 197
 					$list[$key] = $value;
198 198
 					$state = 2;
@@ -202,31 +202,31 @@  discard block
 block discarded – undo
202 202
 				throw new \Exception('safe_unserialize: missing array value');
203 203
 
204 204
 			case 2: // in array, expecting end of array or a key
205
-				if($type == '}')
205
+				if ($type == '}')
206 206
 				{
207
-					if(count($list) < end($expected))
207
+					if (count($list) < end($expected))
208 208
 					{
209 209
 						throw new \Exception('safe_unserialize: array size less than expected ' . $expected[0]);
210 210
 					}
211 211
 
212 212
 					unset($list);
213
-					$list = &$stack[count($stack)-1];
213
+					$list = &$stack[count($stack) - 1];
214 214
 					array_pop($stack);
215 215
 
216 216
 					// go to terminal state if we're at the end of the root array
217 217
 					array_pop($expected);
218
-					if(count($expected) == 0) {
218
+					if (count($expected) == 0) {
219 219
 						$state = 1;
220 220
 					}
221 221
 					break;
222 222
 				}
223
-				if($type == 'i' || $type == 's')
223
+				if ($type == 'i' || $type == 's')
224 224
 				{
225
-					if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
225
+					if (count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
226 226
 					{
227 227
 						throw new \Exception('safe_unserialize: array size exceeds ' . MAX_SERIALIZED_ARRAY_LENGTH);
228 228
 					}
229
-					if(count($list) >= end($expected))
229
+					if (count($list) >= end($expected))
230 230
 					{
231 231
 						throw new \Exception('safe_unserialize: array size exceeds expected length');
232 232
 					}
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 				throw new \Exception('safe_unserialize: illegal array index type');
240 240
 
241 241
 			case 0: // expecting array or value
242
-				if($type == 'a')
242
+				if ($type == 'a')
243 243
 				{
244
-					if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
244
+					if (count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
245 245
 					{
246 246
 						throw new \Exception('safe_unserialize: array nesting exceeds ' . MAX_SERIALIZED_ARRAY_DEPTH);
247 247
 					}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 					$state = 2;
253 253
 					break;
254 254
 				}
255
-				if($type != '}')
255
+				if ($type != '}')
256 256
 				{
257 257
 					$data = $value;
258 258
 					$state = 1;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 	}
265 265
 
266
-	if(!empty($str))
266
+	if (!empty($str))
267 267
 	{
268 268
 		throw new \Exception('safe_unserialize: trailing data in input');
269 269
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  * @param string $str
278 278
  * @return mixed
279 279
  */
280
-function safe_unserialize( $str )
280
+function safe_unserialize($str)
281 281
 {
282 282
 	// ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
283 283
 	if (function_exists('mb_internal_encoding') &&
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
 	try {
291 291
 		$out = _safe_unserialize($str);
292
-	} catch(Exception $e) {
292
+	} catch (Exception $e) {
293 293
 		$out = '';
294 294
 	}
295 295
 
Please login to merge, or discard this patch.
sources/Server.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
 		// Should we account for how much is currently being used?
60 60
 		if ($in_use)
61
-			$memory_needed += memory_get_usage();
61
+		{
62
+					$memory_needed += memory_get_usage();
63
+		}
62 64
 
63 65
 		// If more is needed, request it
64 66
 		if ($memory_current < $memory_needed)
@@ -117,7 +119,9 @@  discard block
 block discarded – undo
117 119
 
118 120
 		// Don't let apache close the connection
119 121
 		if ($server_reset && function_exists('apache_reset_timeout'))
120
-			@apache_reset_timeout();
122
+		{
123
+					@apache_reset_timeout();
124
+		}
121 125
 
122 126
 		return ini_get('max_execution_time');
123 127
 	}
Please login to merge, or discard this patch.
sources/Session.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,14 +37,18 @@  discard block
 block discarded – undo
37 37
 
38 38
 	// Secure PHPSESSIONID
39 39
 	if (parse_url($boardurl, PHP_URL_SCHEME) === 'https')
40
-		@ini_set('session.cookie_secure', true);
40
+	{
41
+			@ini_set('session.cookie_secure', true);
42
+	}
41 43
 
42 44
 	if (!empty($modSettings['globalCookies']))
43 45
 	{
44 46
 		$parsed_url = parse_url($boardurl);
45 47
 
46 48
 		if (preg_match('~^\d{1,3}(\.\d{1,3}){3}$~', $parsed_url['host']) == 0 && preg_match('~(?:[^\.]+\.)?([^\.]{2,}\..+)\z~i', $parsed_url['host'], $parts) == 1)
47
-			@ini_set('session.cookie_domain', '.' . $parts[1]);
49
+		{
50
+					@ini_set('session.cookie_domain', '.' . $parts[1]);
51
+		}
48 52
 	}
49 53
 
50 54
 	// @todo Set the session cookie path?
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 	{
54 58
 		// Attempt to end the already-started session.
55 59
 		if (ini_get('session.auto_start') == 1)
56
-			session_write_close();
60
+		{
61
+					session_write_close();
62
+		}
57 63
 
58 64
 		// This is here to stop people from using bad junky PHPSESSIDs.
59 65
 		if (isset($_REQUEST[session_name()]) && preg_match('~^[A-Za-z0-9,-]{16,64}$~', $_REQUEST[session_name()]) == 0 && !isset($_COOKIE[session_name()]))
@@ -96,7 +102,9 @@  discard block
 block discarded – undo
96 102
 			// APC destroys static class members before sessions can be written.  To work around this we
97 103
 			// explicitly call session_write_close on script end/exit bugs.php.net/bug.php?id=60657
98 104
 			if (extension_loaded('apc') && ini_get('apc.enabled') && !extension_loaded('apcu'))
99
-				register_shutdown_function('session_write_close');
105
+			{
106
+							register_shutdown_function('session_write_close');
107
+			}
100 108
 		}
101 109
 
102 110
 		// Start the session
@@ -104,7 +112,9 @@  discard block
 block discarded – undo
104 112
 
105 113
 		// Change it so the cache settings are a little looser than default.
106 114
 		if (!empty($modSettings['databaseSession_loose']) || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'search'))
107
-			header('Cache-Control: private');
115
+		{
116
+					header('Cache-Control: private');
117
+		}
108 118
 	}
109 119
 
110 120
 	// Set the randomly generated code.
Please login to merge, or discard this patch.
sources/Theme.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,9 @@
 block discarded – undo
133 133
 		}
134 134
 
135 135
 		foreach ($vars as $key => $value)
136
-			$this->js_vars[$key] = !empty($escape) ? JavaScriptEscape($value) : $value;
136
+		{
137
+					$this->js_vars[$key] = !empty($escape) ? JavaScriptEscape($value) : $value;
138
+		}
137 139
 	}
138 140
 
139 141
 	/**
Please login to merge, or discard this patch.
sources/admin/ManagePaid.controller.php 2 patches
Braces   +63 added lines, -22 removed lines patch added patch discarded remove patch
@@ -154,7 +154,9 @@  discard block
 block discarded – undo
154 154
 				$validator->text_replacements(array('paid_email_to' => $txt['paid_email_to']));
155 155
 
156 156
 				if ($validator->validate($this->_req->post))
157
-					$this->_req->post->paid_email_to = $validator->validation_data('paid_email_to');
157
+				{
158
+									$this->_req->post->paid_email_to = $validator->validation_data('paid_email_to');
159
+				}
158 160
 				else
159 161
 				{
160 162
 					// That's not an email, lets set it back in the form to be fixed and let them know its wrong
@@ -162,7 +164,9 @@  discard block
 block discarded – undo
162 164
 					$context['error_type'] = 'minor';
163 165
 					$context['settings_message'] = array();
164 166
 					foreach ($validator->validation_errors() as $id => $error)
165
-						$context['settings_message'][] = $error;
167
+					{
168
+											$context['settings_message'][] = $error;
169
+					}
166 170
 				}
167 171
 			}
168 172
 
@@ -201,7 +205,9 @@  discard block
 block discarded – undo
201 205
 		// If the currency is set to something different then we need to set it to other for this to work and set it back shortly.
202 206
 		$modSettings['paid_currency'] = !empty($modSettings['paid_currency_code']) ? $modSettings['paid_currency_code'] : '';
203 207
 		if (!empty($modSettings['paid_currency_code']) && !in_array($modSettings['paid_currency_code'], array('usd', 'eur', 'gbp')))
204
-			$modSettings['paid_currency'] = 'other';
208
+		{
209
+					$modSettings['paid_currency'] = 'other';
210
+		}
205 211
 
206 212
 		// These are all the default settings.
207 213
 		$config_vars = array(
@@ -257,7 +263,9 @@  discard block
 block discarded – undo
257 263
 
258 264
 		// Not made the settings yet?
259 265
 		if (empty($modSettings['paid_currency_symbol']))
260
-			throw new Elk_Exception('paid_not_set_currency', false, array($scripturl . '?action=admin;area=paidsubscribe;sa=settings'));
266
+		{
267
+					throw new Elk_Exception('paid_not_set_currency', false, array($scripturl . '?action=admin;area=paidsubscribe;sa=settings'));
268
+		}
261 269
 
262 270
 		// Some basic stuff.
263 271
 		$context['page_title'] = $txt['paid_subs_view'];
@@ -460,7 +468,9 @@  discard block
 block discarded – undo
460 468
 
461 469
 				// There needs to be something.
462 470
 				if (empty($this->_req->post->span_value) || empty($this->_req->post->cost))
463
-					throw new Elk_Exception('paid_no_cost_value');
471
+				{
472
+									throw new Elk_Exception('paid_no_cost_value');
473
+				}
464 474
 			}
465 475
 			// Flexible is harder but more fun ;)
466 476
 			else
@@ -475,7 +485,9 @@  discard block
 block discarded – undo
475 485
 				);
476 486
 
477 487
 				if (empty($this->_req->post->cost_day) && empty($this->_req->post->cost_week) && empty($this->_req->post->cost_month) && empty($this->_req->post->cost_year))
478
-					throw new Elk_Exception('paid_all_freq_blank');
488
+				{
489
+									throw new Elk_Exception('paid_all_freq_blank');
490
+				}
479 491
 			}
480 492
 
481 493
 			$cost = serialize($cost);
@@ -485,7 +497,9 @@  discard block
 block discarded – undo
485 497
 			if (!empty($this->_req->post->addgroup))
486 498
 			{
487 499
 				foreach ($this->_req->post->addgroup as $id => $dummy)
488
-					$addGroups[] = (int) $id;
500
+				{
501
+									$addGroups[] = (int) $id;
502
+				}
489 503
 			}
490 504
 			$addGroups = implode(',', $addGroups);
491 505
 
@@ -813,16 +827,22 @@  discard block
 block discarded – undo
813 827
 
814 828
 		// If we haven't been passed the subscription ID get it.
815 829
 		if ($context['log_id'] && !$context['sub_id'])
816
-			$context['sub_id'] = validateSubscriptionID($context['log_id']);
830
+		{
831
+					$context['sub_id'] = validateSubscriptionID($context['log_id']);
832
+		}
817 833
 
818 834
 		if (!isset($context['subscriptions'][$context['sub_id']]))
819
-			throw new Elk_Exception('no_access', false);
835
+		{
836
+					throw new Elk_Exception('no_access', false);
837
+		}
820 838
 
821 839
 		$context['current_subscription'] = $context['subscriptions'][$context['sub_id']];
822 840
 
823 841
 		// Searching?
824 842
 		if (isset($this->_req->post->ssearch))
825
-			return $this->action_viewsub();
843
+		{
844
+					return $this->action_viewsub();
845
+		}
826 846
 		// Saving?
827 847
 		elseif (isset($this->_req->post->save_sub))
828 848
 		{
@@ -843,14 +863,20 @@  discard block
 block discarded – undo
843 863
 				$member = getMemberByName($this->_req->post->name);
844 864
 
845 865
 				if (empty($member))
846
-					throw new Elk_Exception('error_member_not_found');
866
+				{
867
+									throw new Elk_Exception('error_member_not_found');
868
+				}
847 869
 
848 870
 				if (alreadySubscribed($context['sub_id'], $member['id_member']))
849
-					throw new Elk_Exception('member_already_subscribed');
871
+				{
872
+									throw new Elk_Exception('member_already_subscribed');
873
+				}
850 874
 
851 875
 				// Actually put the subscription in place.
852 876
 				if ($status == 1)
853
-					addSubscription($context['sub_id'], $member['id_member'], 0, $starttime, $endtime);
877
+				{
878
+									addSubscription($context['sub_id'], $member['id_member'], 0, $starttime, $endtime);
879
+				}
854 880
 				else
855 881
 				{
856 882
 					$details = array(
@@ -872,10 +898,14 @@  discard block
 block discarded – undo
872 898
 
873 899
 				// Pick the right permission stuff depending on what the status is changing from/to.
874 900
 				if ($subscription_status['old_status'] == 1 && $status != 1)
875
-					removeSubscription($context['sub_id'], $subscription_status['id_member']);
901
+				{
902
+									removeSubscription($context['sub_id'], $subscription_status['id_member']);
903
+				}
876 904
 
877 905
 				elseif ($status == 1 && $subscription_status['old_status'] != 1)
878
-					addSubscription($context['sub_id'], $subscription_status['id_member'], 0, $starttime, $endtime);
906
+				{
907
+									addSubscription($context['sub_id'], $subscription_status['id_member'], 0, $starttime, $endtime);
908
+				}
879 909
 
880 910
 				else
881 911
 				{
@@ -902,12 +932,16 @@  discard block
 block discarded – undo
902 932
 			{
903 933
 				$toDelete = array();
904 934
 				foreach ($this->_req->post->delsub as $id => $dummy)
905
-					$toDelete[] = (int) $id;
935
+				{
936
+									$toDelete[] = (int) $id;
937
+				}
906 938
 
907 939
 				$deletes = prepareDeleteSubscriptions($toDelete);
908 940
 
909 941
 				foreach ($deletes as $id_subscribe => $id_member)
910
-					removeSubscription($id_subscribe, $id_member, isset($this->_req->post->delete));
942
+				{
943
+									removeSubscription($id_subscribe, $id_member, isset($this->_req->post->delete));
944
+				}
911 945
 			}
912 946
 			redirectexit('action=admin;area=paidsubscribe;sa=viewsub;sid=' . $context['sub_id']);
913 947
 		}
@@ -946,15 +980,18 @@  discard block
 block discarded – undo
946 980
 				$result = getBasicMemberData((int) $this->_req->query->uid);
947 981
 				$context['sub']['username'] = $result['real_name'];
948 982
 			}
949
-			else
950
-				$context['sub']['username'] = '';
983
+			else {
984
+							$context['sub']['username'] = '';
985
+			}
951 986
 		}
952 987
 		// Otherwise load the existing info.
953 988
 		else
954 989
 		{
955 990
 			$row = getPendingSubscriptions($context['log_id']);
956 991
 			if (empty($row))
957
-				throw new Elk_Exception('no_access', false);
992
+			{
993
+							throw new Elk_Exception('no_access', false);
994
+			}
958 995
 
959 996
 			// Any pending payments?
960 997
 			$context['pending_payments'] = array();
@@ -974,9 +1011,11 @@  discard block
 block discarded – undo
974 1011
 							foreach ($costs as $duration => $cost)
975 1012
 							{
976 1013
 								if ($cost != 0 && $cost == $pending[1] && $duration == $pending[2])
977
-									$context['pending_payments'][$id] = array(
1014
+								{
1015
+																	$context['pending_payments'][$id] = array(
978 1016
 										'desc' => sprintf($modSettings['paid_currency_symbol'], $cost . '/' . $txt[$duration]),
979 1017
 									);
1018
+								}
980 1019
 							}
981 1020
 						}
982 1021
 						elseif ($costs['fixed'] == $pending[1])
@@ -998,7 +1037,9 @@  discard block
 block discarded – undo
998 1037
 						{
999 1038
 							// Flexible?
1000 1039
 							if (isset($this->_req->query->accept))
1001
-								addSubscription($context['current_subscription']['id'], $row['id_member'], $context['current_subscription']['real_length'] === 'F' ? strtoupper(substr($pending[2], 0, 1)) : 0);
1040
+							{
1041
+															addSubscription($context['current_subscription']['id'], $row['id_member'], $context['current_subscription']['real_length'] === 'F' ? strtoupper(substr($pending[2], 0, 1)) : 0);
1042
+							}
1002 1043
 							unset($pending_details[$id]);
1003 1044
 
1004 1045
 							$new_details = serialize($pending_details);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
 			'items_per_page' => 20,
271 271
 			'base_href' => $scripturl . '?action=admin;area=paidsubscribe;sa=view',
272 272
 			'get_items' => array(
273
-				'function' => function () {
273
+				'function' => function() {
274 274
 					global $context;
275 275
 					return $context['subscriptions'];
276 276
 				},
277 277
 			),
278 278
 			'get_count' => array(
279
-				'function' => function () {
279
+				'function' => function() {
280 280
 					global $context;
281 281
 					return count($context['subscriptions']);
282 282
 				},
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 						'style' => 'width: 30%;',
290 290
 					),
291 291
 					'data' => array(
292
-						'function' => function ($rowData) {
292
+						'function' => function($rowData) {
293 293
 							global $scripturl;
294 294
 
295 295
 							return sprintf('<a href="%1$s?action=admin;area=paidsubscribe;sa=viewsub;sid=%2$s">%3$s</a>', $scripturl, $rowData['id'], $rowData['name']);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 						'value' => $txt['paid_cost'],
302 302
 					),
303 303
 					'data' => array(
304
-						'function' => function ($rowData) {
304
+						'function' => function($rowData) {
305 305
 							global $txt;
306 306
 
307 307
 							return $rowData['flexible'] ? '<em>' . $txt['flexible'] . '</em>' : $rowData['cost'] . ' / ' . $rowData['length'];
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 						'value' => $txt['paid_is_active'],
339 339
 					),
340 340
 					'data' => array(
341
-						'function' => function ($rowData) {
341
+						'function' => function($rowData) {
342 342
 							global $txt;
343 343
 
344 344
 							return '<span class="' . ($rowData['active'] ? 'success' : 'alert') . '">' . ($rowData['active'] ? $txt['yes'] : $txt['no']) . '</span>';
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 						'value' => $txt['subscribers'],
351 351
 					),
352 352
 					'data' => array(
353
-						'function' => function ($rowData) {
353
+						'function' => function($rowData) {
354 354
 							global $scripturl, $txt;
355 355
 
356 356
 							return '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=viewsub;sid=' . $rowData['id'] . '"><i class="icon i-view" title="' . $txt['view'] . '"></i></a>';
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 						'value' => $txt['modify'],
364 364
 					),
365 365
 					'data' => array(
366
-						'function' => function ($rowData) {
366
+						'function' => function($rowData) {
367 367
 							global $txt, $scripturl;
368 368
 
369 369
 							return '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modify;sid=' . $rowData['id'] . '"><i class="icon i-modify" title="' . $txt['modify'] . '"></i></a>';
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 						'value' => $txt['remove']
377 377
 					),
378 378
 					'data' => array(
379
-						'function' => function ($rowData) {
379
+						'function' => function($rowData) {
380 380
 							global $txt, $scripturl;
381 381
 
382 382
 							return '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modify;delete;sid=' . $rowData['id'] . '"><i class="icon i-delete" title="' . $txt['delete'] . '"></i></a>';
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 						'style' => 'width: 20%;',
637 637
 					),
638 638
 					'data' => array(
639
-						'function' => function ($rowData) {
639
+						'function' => function($rowData) {
640 640
 							global $txt, $scripturl;
641 641
 
642 642
 							return $rowData['id_member'] == 0 ? $txt['guest'] : '<a href="' . $scripturl . '?action=profile;u=' . $rowData['id_member'] . '">' . $rowData['name'] . '</a>';
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 						'value' => $txt['edit_subscriber'],
709 709
 					),
710 710
 					'data' => array(
711
-						'function' => function ($rowData) {
711
+						'function' => function($rowData) {
712 712
 							global $txt, $scripturl;
713 713
 
714 714
 							return '<a href="' . $scripturl . '?action=admin;area=paidsubscribe;sa=modifyuser;lid=' . $rowData['id'] . '">' . $txt['modify'] . '</a>';
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 						'class' => 'centertext',
723 723
 					),
724 724
 					'data' => array(
725
-						'function' => function ($rowData) {
725
+						'function' => function($rowData) {
726 726
 							return '<input type="checkbox" name="delsub[' . $rowData['id'] . ']" class="input_check" />';
727 727
 						},
728 728
 						'class' => 'centertext',
Please login to merge, or discard this patch.
sources/admin/ManageRegistration.controller.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,8 +137,10 @@  discard block
 block discarded – undo
137 137
 
138 138
 			// @todo move this to a filter/sanitation class
139 139
 			foreach ($this->_req->post as $key => $value)
140
-				if (!is_array($value))
140
+			{
141
+							if (!is_array($value))
141 142
 					$this->_req->post[$key] = htmltrim__recursive(str_replace(array("\n", "\r"), '', $value));
143
+			}
142 144
 
143 145
 			// Generate a password
144 146
 			if (empty($this->_req->post->password) || !is_string($this->_req->post->password) || trim($this->_req->post->password) === '')
@@ -472,7 +474,9 @@  discard block
 block discarded – undo
472 474
 
473 475
 			// Are there some contacts missing?
474 476
 			if (!empty($this->_req->post->coppaAge) && !empty($this->_req->post->coppaType) && empty($this->_req->post->coppaPost) && empty($this->_req->post->coppaFax))
475
-				throw new Elk_Exception('admin_setting_coppa_require_contact');
477
+			{
478
+							throw new Elk_Exception('admin_setting_coppa_require_contact');
479
+			}
476 480
 
477 481
 			// Post needs to take into account line breaks.
478 482
 			$this->_req->post->coppaPost = str_replace("\n", '<br />', empty($this->_req->post->coppaPost) ? '' : $this->_req->post->coppaPost);
Please login to merge, or discard this patch.