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 — develop (#1814)
by
unknown
11:57
created
security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/AlphaValue.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
4 4
 {
5 5
 
6
-    public function __construct() {
7
-        parent::__construct(false); // opacity is non-negative, but we will clamp it
8
-    }
6
+	public function __construct() {
7
+		parent::__construct(false); // opacity is non-negative, but we will clamp it
8
+	}
9 9
 
10
-    public function validate($number, $config, $context) {
11
-        $result = parent::validate($number, $config, $context);
12
-        if ($result === false) return $result;
13
-        $float = (float) $result;
14
-        if ($float < 0.0) $result = '0';
15
-        if ($float > 1.0) $result = '1';
16
-        return $result;
17
-    }
10
+	public function validate($number, $config, $context) {
11
+		$result = parent::validate($number, $config, $context);
12
+		if ($result === false) return $result;
13
+		$float = (float) $result;
14
+		if ($float < 0.0) $result = '0';
15
+		if ($float > 1.0) $result = '1';
16
+		return $result;
17
+	}
18 18
 
19 19
 }
20 20
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,10 +9,16 @@
 block discarded – undo
9 9
 
10 10
     public function validate($number, $config, $context) {
11 11
         $result = parent::validate($number, $config, $context);
12
-        if ($result === false) return $result;
12
+        if ($result === false) {
13
+        	return $result;
14
+        }
13 15
         $float = (float) $result;
14
-        if ($float < 0.0) $result = '0';
15
-        if ($float > 1.0) $result = '1';
16
+        if ($float < 0.0) {
17
+        	$result = '0';
18
+        }
19
+        if ($float > 1.0) {
20
+        	$result = '1';
21
+        }
16 22
         return $result;
17 23
     }
18 24
 
Please login to merge, or discard this patch.
security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Background.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@
 block discarded – undo
7 7
 class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
8 8
 {
9 9
 
10
-    /**
11
-     * Local copy of component validators.
12
-     * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
13
-     */
14
-    protected $info;
15
-
16
-    public function __construct($config) {
17
-        $def = $config->getCSSDefinition();
18
-        $this->info['background-color'] = $def->info['background-color'];
19
-        $this->info['background-image'] = $def->info['background-image'];
20
-        $this->info['background-repeat'] = $def->info['background-repeat'];
21
-        $this->info['background-attachment'] = $def->info['background-attachment'];
22
-        $this->info['background-position'] = $def->info['background-position'];
23
-    }
24
-
25
-    public function validate($string, $config, $context) {
26
-
27
-        // regular pre-processing
28
-        $string = $this->parseCDATA($string);
29
-        if ($string === '') return false;
30
-
31
-        // munge rgb() decl if necessary
32
-        $string = $this->mungeRgb($string);
33
-
34
-        // assumes URI doesn't have spaces in it
35
-        $bits = explode(' ', strtolower($string)); // bits to process
36
-
37
-        $caught = array();
38
-        $caught['color']    = false;
39
-        $caught['image']    = false;
40
-        $caught['repeat']   = false;
41
-        $caught['attachment'] = false;
42
-        $caught['position'] = false;
43
-
44
-        $i = 0; // number of catches
45
-        $none = false;
46
-
47
-        foreach ($bits as $bit) {
48
-            if ($bit === '') continue;
49
-            foreach ($caught as $key => $status) {
50
-                if ($key != 'position') {
51
-                    if ($status !== false) continue;
52
-                    $r = $this->info['background-' . $key]->validate($bit, $config, $context);
53
-                } else {
54
-                    $r = $bit;
55
-                }
56
-                if ($r === false) continue;
57
-                if ($key == 'position') {
58
-                    if ($caught[$key] === false) $caught[$key] = '';
59
-                    $caught[$key] .= $r . ' ';
60
-                } else {
61
-                    $caught[$key] = $r;
62
-                }
63
-                $i++;
64
-                break;
65
-            }
66
-        }
67
-
68
-        if (!$i) return false;
69
-        if ($caught['position'] !== false) {
70
-            $caught['position'] = $this->info['background-position']->
71
-                validate($caught['position'], $config, $context);
72
-        }
73
-
74
-        $ret = array();
75
-        foreach ($caught as $value) {
76
-            if ($value === false) continue;
77
-            $ret[] = $value;
78
-        }
79
-
80
-        if (empty($ret)) return false;
81
-        return implode(' ', $ret);
82
-
83
-    }
10
+	/**
11
+	 * Local copy of component validators.
12
+	 * @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
13
+	 */
14
+	protected $info;
15
+
16
+	public function __construct($config) {
17
+		$def = $config->getCSSDefinition();
18
+		$this->info['background-color'] = $def->info['background-color'];
19
+		$this->info['background-image'] = $def->info['background-image'];
20
+		$this->info['background-repeat'] = $def->info['background-repeat'];
21
+		$this->info['background-attachment'] = $def->info['background-attachment'];
22
+		$this->info['background-position'] = $def->info['background-position'];
23
+	}
24
+
25
+	public function validate($string, $config, $context) {
26
+
27
+		// regular pre-processing
28
+		$string = $this->parseCDATA($string);
29
+		if ($string === '') return false;
30
+
31
+		// munge rgb() decl if necessary
32
+		$string = $this->mungeRgb($string);
33
+
34
+		// assumes URI doesn't have spaces in it
35
+		$bits = explode(' ', strtolower($string)); // bits to process
36
+
37
+		$caught = array();
38
+		$caught['color']    = false;
39
+		$caught['image']    = false;
40
+		$caught['repeat']   = false;
41
+		$caught['attachment'] = false;
42
+		$caught['position'] = false;
43
+
44
+		$i = 0; // number of catches
45
+		$none = false;
46
+
47
+		foreach ($bits as $bit) {
48
+			if ($bit === '') continue;
49
+			foreach ($caught as $key => $status) {
50
+				if ($key != 'position') {
51
+					if ($status !== false) continue;
52
+					$r = $this->info['background-' . $key]->validate($bit, $config, $context);
53
+				} else {
54
+					$r = $bit;
55
+				}
56
+				if ($r === false) continue;
57
+				if ($key == 'position') {
58
+					if ($caught[$key] === false) $caught[$key] = '';
59
+					$caught[$key] .= $r . ' ';
60
+				} else {
61
+					$caught[$key] = $r;
62
+				}
63
+				$i++;
64
+				break;
65
+			}
66
+		}
67
+
68
+		if (!$i) return false;
69
+		if ($caught['position'] !== false) {
70
+			$caught['position'] = $this->info['background-position']->
71
+				validate($caught['position'], $config, $context);
72
+		}
73
+
74
+		$ret = array();
75
+		foreach ($caught as $value) {
76
+			if ($value === false) continue;
77
+			$ret[] = $value;
78
+		}
79
+
80
+		if (empty($ret)) return false;
81
+		return implode(' ', $ret);
82
+
83
+	}
84 84
 
85 85
 }
86 86
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
         // regular pre-processing
28 28
         $string = $this->parseCDATA($string);
29
-        if ($string === '') return false;
29
+        if ($string === '') {
30
+        	return false;
31
+        }
30 32
 
31 33
         // munge rgb() decl if necessary
32 34
         $string = $this->mungeRgb($string);
@@ -45,17 +47,25 @@  discard block
 block discarded – undo
45 47
         $none = false;
46 48
 
47 49
         foreach ($bits as $bit) {
48
-            if ($bit === '') continue;
50
+            if ($bit === '') {
51
+            	continue;
52
+            }
49 53
             foreach ($caught as $key => $status) {
50 54
                 if ($key != 'position') {
51
-                    if ($status !== false) continue;
55
+                    if ($status !== false) {
56
+                    	continue;
57
+                    }
52 58
                     $r = $this->info['background-' . $key]->validate($bit, $config, $context);
53 59
                 } else {
54 60
                     $r = $bit;
55 61
                 }
56
-                if ($r === false) continue;
62
+                if ($r === false) {
63
+                	continue;
64
+                }
57 65
                 if ($key == 'position') {
58
-                    if ($caught[$key] === false) $caught[$key] = '';
66
+                    if ($caught[$key] === false) {
67
+                    	$caught[$key] = '';
68
+                    }
59 69
                     $caught[$key] .= $r . ' ';
60 70
                 } else {
61 71
                     $caught[$key] = $r;
@@ -65,7 +75,9 @@  discard block
 block discarded – undo
65 75
             }
66 76
         }
67 77
 
68
-        if (!$i) return false;
78
+        if (!$i) {
79
+        	return false;
80
+        }
69 81
         if ($caught['position'] !== false) {
70 82
             $caught['position'] = $this->info['background-position']->
71 83
                 validate($caught['position'], $config, $context);
@@ -73,11 +85,15 @@  discard block
 block discarded – undo
73 85
 
74 86
         $ret = array();
75 87
         foreach ($caught as $value) {
76
-            if ($value === false) continue;
88
+            if ($value === false) {
89
+            	continue;
90
+            }
77 91
             $ret[] = $value;
78 92
         }
79 93
 
80
-        if (empty($ret)) return false;
94
+        if (empty($ret)) {
95
+        	return false;
96
+        }
81 97
         return implode(' ', $ret);
82 98
 
83 99
     }
Please login to merge, or discard this patch.
htmlpurifier/library/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php 3 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -44,89 +44,89 @@
 block discarded – undo
44 44
 class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
45 45
 {
46 46
 
47
-    protected $length;
48
-    protected $percentage;
49
-
50
-    public function __construct() {
51
-        $this->length     = new HTMLPurifier_AttrDef_CSS_Length();
52
-        $this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
53
-    }
54
-
55
-    public function validate($string, $config, $context) {
56
-        $string = $this->parseCDATA($string);
57
-        $bits = explode(' ', $string);
58
-
59
-        $keywords = array();
60
-        $keywords['h'] = false; // left, right
61
-        $keywords['v'] = false; // top, bottom
62
-        $keywords['ch'] = false; // center (first word)
63
-        $keywords['cv'] = false; // center (second word)
64
-        $measures = array();
65
-
66
-        $i = 0;
67
-
68
-        $lookup = array(
69
-            'top' => 'v',
70
-            'bottom' => 'v',
71
-            'left' => 'h',
72
-            'right' => 'h',
73
-            'center' => 'c'
74
-        );
75
-
76
-        foreach ($bits as $bit) {
77
-            if ($bit === '') continue;
78
-
79
-            // test for keyword
80
-            $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
81
-            if (isset($lookup[$lbit])) {
82
-                $status = $lookup[$lbit];
83
-                if ($status == 'c') {
84
-                    if ($i == 0) {
85
-                        $status = 'ch';
86
-                    } else {
87
-                        $status = 'cv';
88
-                    }
89
-                }
90
-                $keywords[$status] = $lbit;
91
-                $i++;
92
-            }
93
-
94
-            // test for length
95
-            $r = $this->length->validate($bit, $config, $context);
96
-            if ($r !== false) {
97
-                $measures[] = $r;
98
-                $i++;
99
-            }
100
-
101
-            // test for percentage
102
-            $r = $this->percentage->validate($bit, $config, $context);
103
-            if ($r !== false) {
104
-                $measures[] = $r;
105
-                $i++;
106
-            }
107
-
108
-        }
109
-
110
-        if (!$i) return false; // no valid values were caught
111
-
112
-        $ret = array();
113
-
114
-        // first keyword
115
-        if     ($keywords['h'])     $ret[] = $keywords['h'];
116
-        elseif ($keywords['ch']) {
117
-            $ret[] = $keywords['ch'];
118
-            $keywords['cv'] = false; // prevent re-use: center = center center
119
-        }
120
-        elseif (count($measures))   $ret[] = array_shift($measures);
121
-
122
-        if     ($keywords['v'])     $ret[] = $keywords['v'];
123
-        elseif ($keywords['cv'])    $ret[] = $keywords['cv'];
124
-        elseif (count($measures))   $ret[] = array_shift($measures);
125
-
126
-        if (empty($ret)) return false;
127
-        return implode(' ', $ret);
128
-
129
-    }
47
+	protected $length;
48
+	protected $percentage;
49
+
50
+	public function __construct() {
51
+		$this->length     = new HTMLPurifier_AttrDef_CSS_Length();
52
+		$this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
53
+	}
54
+
55
+	public function validate($string, $config, $context) {
56
+		$string = $this->parseCDATA($string);
57
+		$bits = explode(' ', $string);
58
+
59
+		$keywords = array();
60
+		$keywords['h'] = false; // left, right
61
+		$keywords['v'] = false; // top, bottom
62
+		$keywords['ch'] = false; // center (first word)
63
+		$keywords['cv'] = false; // center (second word)
64
+		$measures = array();
65
+
66
+		$i = 0;
67
+
68
+		$lookup = array(
69
+			'top' => 'v',
70
+			'bottom' => 'v',
71
+			'left' => 'h',
72
+			'right' => 'h',
73
+			'center' => 'c'
74
+		);
75
+
76
+		foreach ($bits as $bit) {
77
+			if ($bit === '') continue;
78
+
79
+			// test for keyword
80
+			$lbit = ctype_lower($bit) ? $bit : strtolower($bit);
81
+			if (isset($lookup[$lbit])) {
82
+				$status = $lookup[$lbit];
83
+				if ($status == 'c') {
84
+					if ($i == 0) {
85
+						$status = 'ch';
86
+					} else {
87
+						$status = 'cv';
88
+					}
89
+				}
90
+				$keywords[$status] = $lbit;
91
+				$i++;
92
+			}
93
+
94
+			// test for length
95
+			$r = $this->length->validate($bit, $config, $context);
96
+			if ($r !== false) {
97
+				$measures[] = $r;
98
+				$i++;
99
+			}
100
+
101
+			// test for percentage
102
+			$r = $this->percentage->validate($bit, $config, $context);
103
+			if ($r !== false) {
104
+				$measures[] = $r;
105
+				$i++;
106
+			}
107
+
108
+		}
109
+
110
+		if (!$i) return false; // no valid values were caught
111
+
112
+		$ret = array();
113
+
114
+		// first keyword
115
+		if     ($keywords['h'])     $ret[] = $keywords['h'];
116
+		elseif ($keywords['ch']) {
117
+			$ret[] = $keywords['ch'];
118
+			$keywords['cv'] = false; // prevent re-use: center = center center
119
+		}
120
+		elseif (count($measures))   $ret[] = array_shift($measures);
121
+
122
+		if     ($keywords['v'])     $ret[] = $keywords['v'];
123
+		elseif ($keywords['cv'])    $ret[] = $keywords['cv'];
124
+		elseif (count($measures))   $ret[] = array_shift($measures);
125
+
126
+		if (empty($ret)) return false;
127
+		return implode(' ', $ret);
128
+
129
+	}
130 130
 
131 131
 }
132 132
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,14 +112,14 @@
 block discarded – undo
112 112
         $ret = array();
113 113
 
114 114
         // first keyword
115
-        if     ($keywords['h'])     $ret[] = $keywords['h'];
115
+        if ($keywords['h'])     $ret[] = $keywords['h'];
116 116
         elseif ($keywords['ch']) {
117 117
             $ret[] = $keywords['ch'];
118 118
             $keywords['cv'] = false; // prevent re-use: center = center center
119 119
         }
120 120
         elseif (count($measures))   $ret[] = array_shift($measures);
121 121
 
122
-        if     ($keywords['v'])     $ret[] = $keywords['v'];
122
+        if ($keywords['v'])     $ret[] = $keywords['v'];
123 123
         elseif ($keywords['cv'])    $ret[] = $keywords['cv'];
124 124
         elseif (count($measures))   $ret[] = array_shift($measures);
125 125
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
         );
75 75
 
76 76
         foreach ($bits as $bit) {
77
-            if ($bit === '') continue;
77
+            if ($bit === '') {
78
+            	continue;
79
+            }
78 80
 
79 81
             // test for keyword
80 82
             $lbit = ctype_lower($bit) ? $bit : strtolower($bit);
@@ -107,23 +109,34 @@  discard block
 block discarded – undo
107 109
 
108 110
         }
109 111
 
110
-        if (!$i) return false; // no valid values were caught
112
+        if (!$i) {
113
+        	return false;
114
+        }
115
+        // no valid values were caught
111 116
 
112 117
         $ret = array();
113 118
 
114 119
         // first keyword
115
-        if     ($keywords['h'])     $ret[] = $keywords['h'];
116
-        elseif ($keywords['ch']) {
120
+        if     ($keywords['h']) {
121
+        	$ret[] = $keywords['h'];
122
+        } elseif ($keywords['ch']) {
117 123
             $ret[] = $keywords['ch'];
118 124
             $keywords['cv'] = false; // prevent re-use: center = center center
125
+        } elseif (count($measures)) {
126
+        	$ret[] = array_shift($measures);
119 127
         }
120
-        elseif (count($measures))   $ret[] = array_shift($measures);
121 128
 
122
-        if     ($keywords['v'])     $ret[] = $keywords['v'];
123
-        elseif ($keywords['cv'])    $ret[] = $keywords['cv'];
124
-        elseif (count($measures))   $ret[] = array_shift($measures);
129
+        if     ($keywords['v']) {
130
+        	$ret[] = $keywords['v'];
131
+        } elseif ($keywords['cv']) {
132
+        	$ret[] = $keywords['cv'];
133
+        } elseif (count($measures)) {
134
+        	$ret[] = array_shift($measures);
135
+        }
125 136
 
126
-        if (empty($ret)) return false;
137
+        if (empty($ret)) {
138
+        	return false;
139
+        }
127 140
         return implode(' ', $ret);
128 141
 
129 142
     }
Please login to merge, or discard this patch.
classes/security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Border.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,37 +6,37 @@
 block discarded – undo
6 6
 class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
7 7
 {
8 8
 
9
-    /**
10
-     * Local copy of properties this property is shorthand for.
11
-     */
12
-    protected $info = array();
9
+	/**
10
+	 * Local copy of properties this property is shorthand for.
11
+	 */
12
+	protected $info = array();
13 13
 
14
-    public function __construct($config) {
15
-        $def = $config->getCSSDefinition();
16
-        $this->info['border-width'] = $def->info['border-width'];
17
-        $this->info['border-style'] = $def->info['border-style'];
18
-        $this->info['border-top-color'] = $def->info['border-top-color'];
19
-    }
14
+	public function __construct($config) {
15
+		$def = $config->getCSSDefinition();
16
+		$this->info['border-width'] = $def->info['border-width'];
17
+		$this->info['border-style'] = $def->info['border-style'];
18
+		$this->info['border-top-color'] = $def->info['border-top-color'];
19
+	}
20 20
 
21
-    public function validate($string, $config, $context) {
22
-        $string = $this->parseCDATA($string);
23
-        $string = $this->mungeRgb($string);
24
-        $bits = explode(' ', $string);
25
-        $done = array(); // segments we've finished
26
-        $ret = ''; // return value
27
-        foreach ($bits as $bit) {
28
-            foreach ($this->info as $propname => $validator) {
29
-                if (isset($done[$propname])) continue;
30
-                $r = $validator->validate($bit, $config, $context);
31
-                if ($r !== false) {
32
-                    $ret .= $r . ' ';
33
-                    $done[$propname] = true;
34
-                    break;
35
-                }
36
-            }
37
-        }
38
-        return rtrim($ret);
39
-    }
21
+	public function validate($string, $config, $context) {
22
+		$string = $this->parseCDATA($string);
23
+		$string = $this->mungeRgb($string);
24
+		$bits = explode(' ', $string);
25
+		$done = array(); // segments we've finished
26
+		$ret = ''; // return value
27
+		foreach ($bits as $bit) {
28
+			foreach ($this->info as $propname => $validator) {
29
+				if (isset($done[$propname])) continue;
30
+				$r = $validator->validate($bit, $config, $context);
31
+				if ($r !== false) {
32
+					$ret .= $r . ' ';
33
+					$done[$propname] = true;
34
+					break;
35
+				}
36
+			}
37
+		}
38
+		return rtrim($ret);
39
+	}
40 40
 
41 41
 }
42 42
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@
 block discarded – undo
26 26
         $ret = ''; // return value
27 27
         foreach ($bits as $bit) {
28 28
             foreach ($this->info as $propname => $validator) {
29
-                if (isset($done[$propname])) continue;
29
+                if (isset($done[$propname])) {
30
+                	continue;
31
+                }
30 32
                 $r = $validator->validate($bit, $config, $context);
31 33
                 if ($r !== false) {
32 34
                     $ret .= $r . ' ';
Please login to merge, or discard this patch.
classes/security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Color.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -6,72 +6,72 @@
 block discarded – undo
6 6
 class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
7 7
 {
8 8
 
9
-    public function validate($color, $config, $context) {
9
+	public function validate($color, $config, $context) {
10 10
 
11
-        static $colors = null;
12
-        if ($colors === null) $colors = $config->get('Core.ColorKeywords');
11
+		static $colors = null;
12
+		if ($colors === null) $colors = $config->get('Core.ColorKeywords');
13 13
 
14
-        $color = trim($color);
15
-        if ($color === '') return false;
14
+		$color = trim($color);
15
+		if ($color === '') return false;
16 16
 
17
-        $lower = strtolower($color);
18
-        if (isset($colors[$lower])) return $colors[$lower];
17
+		$lower = strtolower($color);
18
+		if (isset($colors[$lower])) return $colors[$lower];
19 19
 
20
-        if (strpos($color, 'rgb(') !== false) {
21
-            // rgb literal handling
22
-            $length = strlen($color);
23
-            if (strpos($color, ')') !== $length - 1) return false;
24
-            $triad = substr($color, 4, $length - 4 - 1);
25
-            $parts = explode(',', $triad);
26
-            if (count($parts) !== 3) return false;
27
-            $type = false; // to ensure that they're all the same type
28
-            $new_parts = array();
29
-            foreach ($parts as $part) {
30
-                $part = trim($part);
31
-                if ($part === '') return false;
32
-                $length = strlen($part);
33
-                if ($part[$length - 1] === '%') {
34
-                    // handle percents
35
-                    if (!$type) {
36
-                        $type = 'percentage';
37
-                    } elseif ($type !== 'percentage') {
38
-                        return false;
39
-                    }
40
-                    $num = (float) substr($part, 0, $length - 1);
41
-                    if ($num < 0) $num = 0;
42
-                    if ($num > 100) $num = 100;
43
-                    $new_parts[] = "$num%";
44
-                } else {
45
-                    // handle integers
46
-                    if (!$type) {
47
-                        $type = 'integer';
48
-                    } elseif ($type !== 'integer') {
49
-                        return false;
50
-                    }
51
-                    $num = (int) $part;
52
-                    if ($num < 0) $num = 0;
53
-                    if ($num > 255) $num = 255;
54
-                    $new_parts[] = (string) $num;
55
-                }
56
-            }
57
-            $new_triad = implode(',', $new_parts);
58
-            $color = "rgb($new_triad)";
59
-        } else {
60
-            // hexadecimal handling
61
-            if ($color[0] === '#') {
62
-                $hex = substr($color, 1);
63
-            } else {
64
-                $hex = $color;
65
-                $color = '#' . $color;
66
-            }
67
-            $length = strlen($hex);
68
-            if ($length !== 3 && $length !== 6) return false;
69
-            if (!ctype_xdigit($hex)) return false;
70
-        }
20
+		if (strpos($color, 'rgb(') !== false) {
21
+			// rgb literal handling
22
+			$length = strlen($color);
23
+			if (strpos($color, ')') !== $length - 1) return false;
24
+			$triad = substr($color, 4, $length - 4 - 1);
25
+			$parts = explode(',', $triad);
26
+			if (count($parts) !== 3) return false;
27
+			$type = false; // to ensure that they're all the same type
28
+			$new_parts = array();
29
+			foreach ($parts as $part) {
30
+				$part = trim($part);
31
+				if ($part === '') return false;
32
+				$length = strlen($part);
33
+				if ($part[$length - 1] === '%') {
34
+					// handle percents
35
+					if (!$type) {
36
+						$type = 'percentage';
37
+					} elseif ($type !== 'percentage') {
38
+						return false;
39
+					}
40
+					$num = (float) substr($part, 0, $length - 1);
41
+					if ($num < 0) $num = 0;
42
+					if ($num > 100) $num = 100;
43
+					$new_parts[] = "$num%";
44
+				} else {
45
+					// handle integers
46
+					if (!$type) {
47
+						$type = 'integer';
48
+					} elseif ($type !== 'integer') {
49
+						return false;
50
+					}
51
+					$num = (int) $part;
52
+					if ($num < 0) $num = 0;
53
+					if ($num > 255) $num = 255;
54
+					$new_parts[] = (string) $num;
55
+				}
56
+			}
57
+			$new_triad = implode(',', $new_parts);
58
+			$color = "rgb($new_triad)";
59
+		} else {
60
+			// hexadecimal handling
61
+			if ($color[0] === '#') {
62
+				$hex = substr($color, 1);
63
+			} else {
64
+				$hex = $color;
65
+				$color = '#' . $color;
66
+			}
67
+			$length = strlen($hex);
68
+			if ($length !== 3 && $length !== 6) return false;
69
+			if (!ctype_xdigit($hex)) return false;
70
+		}
71 71
 
72
-        return $color;
72
+		return $color;
73 73
 
74
-    }
74
+	}
75 75
 
76 76
 }
77 77
 
Please login to merge, or discard this patch.
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,26 +9,38 @@  discard block
 block discarded – undo
9 9
     public function validate($color, $config, $context) {
10 10
 
11 11
         static $colors = null;
12
-        if ($colors === null) $colors = $config->get('Core.ColorKeywords');
12
+        if ($colors === null) {
13
+        	$colors = $config->get('Core.ColorKeywords');
14
+        }
13 15
 
14 16
         $color = trim($color);
15
-        if ($color === '') return false;
17
+        if ($color === '') {
18
+        	return false;
19
+        }
16 20
 
17 21
         $lower = strtolower($color);
18
-        if (isset($colors[$lower])) return $colors[$lower];
22
+        if (isset($colors[$lower])) {
23
+        	return $colors[$lower];
24
+        }
19 25
 
20 26
         if (strpos($color, 'rgb(') !== false) {
21 27
             // rgb literal handling
22 28
             $length = strlen($color);
23
-            if (strpos($color, ')') !== $length - 1) return false;
29
+            if (strpos($color, ')') !== $length - 1) {
30
+            	return false;
31
+            }
24 32
             $triad = substr($color, 4, $length - 4 - 1);
25 33
             $parts = explode(',', $triad);
26
-            if (count($parts) !== 3) return false;
34
+            if (count($parts) !== 3) {
35
+            	return false;
36
+            }
27 37
             $type = false; // to ensure that they're all the same type
28 38
             $new_parts = array();
29 39
             foreach ($parts as $part) {
30 40
                 $part = trim($part);
31
-                if ($part === '') return false;
41
+                if ($part === '') {
42
+                	return false;
43
+                }
32 44
                 $length = strlen($part);
33 45
                 if ($part[$length - 1] === '%') {
34 46
                     // handle percents
@@ -38,8 +50,12 @@  discard block
 block discarded – undo
38 50
                         return false;
39 51
                     }
40 52
                     $num = (float) substr($part, 0, $length - 1);
41
-                    if ($num < 0) $num = 0;
42
-                    if ($num > 100) $num = 100;
53
+                    if ($num < 0) {
54
+                    	$num = 0;
55
+                    }
56
+                    if ($num > 100) {
57
+                    	$num = 100;
58
+                    }
43 59
                     $new_parts[] = "$num%";
44 60
                 } else {
45 61
                     // handle integers
@@ -49,8 +65,12 @@  discard block
 block discarded – undo
49 65
                         return false;
50 66
                     }
51 67
                     $num = (int) $part;
52
-                    if ($num < 0) $num = 0;
53
-                    if ($num > 255) $num = 255;
68
+                    if ($num < 0) {
69
+                    	$num = 0;
70
+                    }
71
+                    if ($num > 255) {
72
+                    	$num = 255;
73
+                    }
54 74
                     $new_parts[] = (string) $num;
55 75
                 }
56 76
             }
@@ -65,8 +85,12 @@  discard block
 block discarded – undo
65 85
                 $color = '#' . $color;
66 86
             }
67 87
             $length = strlen($hex);
68
-            if ($length !== 3 && $length !== 6) return false;
69
-            if (!ctype_xdigit($hex)) return false;
88
+            if ($length !== 3 && $length !== 6) {
89
+            	return false;
90
+            }
91
+            if (!ctype_xdigit($hex)) {
92
+            	return false;
93
+            }
70 94
         }
71 95
 
72 96
         return $color;
Please login to merge, or discard this patch.
security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Composite.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@
 block discarded – undo
12 12
 class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
13 13
 {
14 14
 
15
-    /**
16
-     * List of HTMLPurifier_AttrDef objects that may process strings
17
-     * @todo Make protected
18
-     */
19
-    public $defs;
15
+	/**
16
+	 * List of HTMLPurifier_AttrDef objects that may process strings
17
+	 * @todo Make protected
18
+	 */
19
+	public $defs;
20 20
 
21
-    /**
22
-     * @param $defs List of HTMLPurifier_AttrDef objects
23
-     */
24
-    public function __construct($defs) {
25
-        $this->defs = $defs;
26
-    }
21
+	/**
22
+	 * @param $defs List of HTMLPurifier_AttrDef objects
23
+	 */
24
+	public function __construct($defs) {
25
+		$this->defs = $defs;
26
+	}
27 27
 
28
-    public function validate($string, $config, $context) {
29
-        foreach ($this->defs as $i => $def) {
30
-            $result = $this->defs[$i]->validate($string, $config, $context);
31
-            if ($result !== false) return $result;
32
-        }
33
-        return false;
34
-    }
28
+	public function validate($string, $config, $context) {
29
+		foreach ($this->defs as $i => $def) {
30
+			$result = $this->defs[$i]->validate($string, $config, $context);
31
+			if ($result !== false) return $result;
32
+		}
33
+		return false;
34
+	}
35 35
 
36 36
 }
37 37
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@
 block discarded – undo
28 28
     public function validate($string, $config, $context) {
29 29
         foreach ($this->defs as $i => $def) {
30 30
             $result = $this->defs[$i]->validate($string, $config, $context);
31
-            if ($result !== false) return $result;
31
+            if ($result !== false) {
32
+            	return $result;
33
+            }
32 34
         }
33 35
         return false;
34 36
     }
Please login to merge, or discard this patch.
htmlpurifier/library/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@
 block discarded – undo
5 5
  */
6 6
 class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
7 7
 {
8
-    public $def, $element;
8
+	public $def, $element;
9 9
 
10
-    /**
11
-     * @param $def Definition to wrap
12
-     * @param $element Element to deny
13
-     */
14
-    public function __construct($def, $element) {
15
-        $this->def = $def;
16
-        $this->element = $element;
17
-    }
18
-    /**
19
-     * Checks if CurrentToken is set and equal to $this->element
20
-     */
21
-    public function validate($string, $config, $context) {
22
-        $token = $context->get('CurrentToken', true);
23
-        if ($token && $token->name == $this->element) return false;
24
-        return $this->def->validate($string, $config, $context);
25
-    }
10
+	/**
11
+	 * @param $def Definition to wrap
12
+	 * @param $element Element to deny
13
+	 */
14
+	public function __construct($def, $element) {
15
+		$this->def = $def;
16
+		$this->element = $element;
17
+	}
18
+	/**
19
+	 * Checks if CurrentToken is set and equal to $this->element
20
+	 */
21
+	public function validate($string, $config, $context) {
22
+		$token = $context->get('CurrentToken', true);
23
+		if ($token && $token->name == $this->element) return false;
24
+		return $this->def->validate($string, $config, $context);
25
+	}
26 26
 }
27 27
 
28 28
 // vim: et sw=4 sts=4
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
20 20
      */
21 21
     public function validate($string, $config, $context) {
22 22
         $token = $context->get('CurrentToken', true);
23
-        if ($token && $token->name == $this->element) return false;
23
+        if ($token && $token->name == $this->element) {
24
+        	return false;
25
+        }
24 26
         return $this->def->validate($string, $config, $context);
25 27
     }
26 28
 }
Please login to merge, or discard this patch.
classes/security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Filter.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@
 block discarded – undo
8 8
 class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
9 9
 {
10 10
 
11
-    protected $intValidator;
11
+	protected $intValidator;
12 12
 
13
-    public function __construct() {
14
-        $this->intValidator = new HTMLPurifier_AttrDef_Integer();
15
-    }
13
+	public function __construct() {
14
+		$this->intValidator = new HTMLPurifier_AttrDef_Integer();
15
+	}
16 16
 
17
-    public function validate($value, $config, $context) {
18
-        $value = $this->parseCDATA($value);
19
-        if ($value === 'none') return $value;
20
-        // if we looped this we could support multiple filters
21
-        $function_length = strcspn($value, '(');
22
-        $function = trim(substr($value, 0, $function_length));
23
-        if ($function !== 'alpha' &&
24
-            $function !== 'Alpha' &&
25
-            $function !== 'progid:DXImageTransform.Microsoft.Alpha'
26
-            ) return false;
27
-        $cursor = $function_length + 1;
28
-        $parameters_length = strcspn($value, ')', $cursor);
29
-        $parameters = substr($value, $cursor, $parameters_length);
30
-        $params = explode(',', $parameters);
31
-        $ret_params = array();
32
-        $lookup = array();
33
-        foreach ($params as $param) {
34
-            list($key, $value) = explode('=', $param);
35
-            $key   = trim($key);
36
-            $value = trim($value);
37
-            if (isset($lookup[$key])) continue;
38
-            if ($key !== 'opacity') continue;
39
-            $value = $this->intValidator->validate($value, $config, $context);
40
-            if ($value === false) continue;
41
-            $int = (int) $value;
42
-            if ($int > 100) $value = '100';
43
-            if ($int < 0) $value = '0';
44
-            $ret_params[] = "$key=$value";
45
-            $lookup[$key] = true;
46
-        }
47
-        $ret_parameters = implode(',', $ret_params);
48
-        $ret_function = "$function($ret_parameters)";
49
-        return $ret_function;
50
-    }
17
+	public function validate($value, $config, $context) {
18
+		$value = $this->parseCDATA($value);
19
+		if ($value === 'none') return $value;
20
+		// if we looped this we could support multiple filters
21
+		$function_length = strcspn($value, '(');
22
+		$function = trim(substr($value, 0, $function_length));
23
+		if ($function !== 'alpha' &&
24
+			$function !== 'Alpha' &&
25
+			$function !== 'progid:DXImageTransform.Microsoft.Alpha'
26
+			) return false;
27
+		$cursor = $function_length + 1;
28
+		$parameters_length = strcspn($value, ')', $cursor);
29
+		$parameters = substr($value, $cursor, $parameters_length);
30
+		$params = explode(',', $parameters);
31
+		$ret_params = array();
32
+		$lookup = array();
33
+		foreach ($params as $param) {
34
+			list($key, $value) = explode('=', $param);
35
+			$key   = trim($key);
36
+			$value = trim($value);
37
+			if (isset($lookup[$key])) continue;
38
+			if ($key !== 'opacity') continue;
39
+			$value = $this->intValidator->validate($value, $config, $context);
40
+			if ($value === false) continue;
41
+			$int = (int) $value;
42
+			if ($int > 100) $value = '100';
43
+			if ($int < 0) $value = '0';
44
+			$ret_params[] = "$key=$value";
45
+			$lookup[$key] = true;
46
+		}
47
+		$ret_parameters = implode(',', $ret_params);
48
+		$ret_function = "$function($ret_parameters)";
49
+		return $ret_function;
50
+	}
51 51
 
52 52
 }
53 53
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,18 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function validate($value, $config, $context) {
18 18
         $value = $this->parseCDATA($value);
19
-        if ($value === 'none') return $value;
19
+        if ($value === 'none') {
20
+        	return $value;
21
+        }
20 22
         // if we looped this we could support multiple filters
21 23
         $function_length = strcspn($value, '(');
22 24
         $function = trim(substr($value, 0, $function_length));
23 25
         if ($function !== 'alpha' &&
24 26
             $function !== 'Alpha' &&
25 27
             $function !== 'progid:DXImageTransform.Microsoft.Alpha'
26
-            ) return false;
28
+            ) {
29
+        	return false;
30
+        }
27 31
         $cursor = $function_length + 1;
28 32
         $parameters_length = strcspn($value, ')', $cursor);
29 33
         $parameters = substr($value, $cursor, $parameters_length);
@@ -34,13 +38,23 @@  discard block
 block discarded – undo
34 38
             list($key, $value) = explode('=', $param);
35 39
             $key   = trim($key);
36 40
             $value = trim($value);
37
-            if (isset($lookup[$key])) continue;
38
-            if ($key !== 'opacity') continue;
41
+            if (isset($lookup[$key])) {
42
+            	continue;
43
+            }
44
+            if ($key !== 'opacity') {
45
+            	continue;
46
+            }
39 47
             $value = $this->intValidator->validate($value, $config, $context);
40
-            if ($value === false) continue;
48
+            if ($value === false) {
49
+            	continue;
50
+            }
41 51
             $int = (int) $value;
42
-            if ($int > 100) $value = '100';
43
-            if ($int < 0) $value = '0';
52
+            if ($int > 100) {
53
+            	$value = '100';
54
+            }
55
+            if ($int < 0) {
56
+            	$value = '0';
57
+            }
44 58
             $ret_params[] = "$key=$value";
45 59
             $lookup[$key] = true;
46 60
         }
Please login to merge, or discard this patch.
classes/security/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/Font.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -6,143 +6,143 @@
 block discarded – undo
6 6
 class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
7 7
 {
8 8
 
9
-    /**
10
-     * Local copy of component validators.
11
-     *
12
-     * @note If we moved specific CSS property definitions to their own
13
-     *       classes instead of having them be assembled at run time by
14
-     *       CSSDefinition, this wouldn't be necessary.  We'd instantiate
15
-     *       our own copies.
16
-     */
17
-    protected $info = array();
9
+	/**
10
+	 * Local copy of component validators.
11
+	 *
12
+	 * @note If we moved specific CSS property definitions to their own
13
+	 *       classes instead of having them be assembled at run time by
14
+	 *       CSSDefinition, this wouldn't be necessary.  We'd instantiate
15
+	 *       our own copies.
16
+	 */
17
+	protected $info = array();
18 18
 
19
-    public function __construct($config) {
20
-        $def = $config->getCSSDefinition();
21
-        $this->info['font-style']   = $def->info['font-style'];
22
-        $this->info['font-variant'] = $def->info['font-variant'];
23
-        $this->info['font-weight']  = $def->info['font-weight'];
24
-        $this->info['font-size']    = $def->info['font-size'];
25
-        $this->info['line-height']  = $def->info['line-height'];
26
-        $this->info['font-family']  = $def->info['font-family'];
27
-    }
19
+	public function __construct($config) {
20
+		$def = $config->getCSSDefinition();
21
+		$this->info['font-style']   = $def->info['font-style'];
22
+		$this->info['font-variant'] = $def->info['font-variant'];
23
+		$this->info['font-weight']  = $def->info['font-weight'];
24
+		$this->info['font-size']    = $def->info['font-size'];
25
+		$this->info['line-height']  = $def->info['line-height'];
26
+		$this->info['font-family']  = $def->info['font-family'];
27
+	}
28 28
 
29
-    public function validate($string, $config, $context) {
29
+	public function validate($string, $config, $context) {
30 30
 
31
-        static $system_fonts = array(
32
-            'caption' => true,
33
-            'icon' => true,
34
-            'menu' => true,
35
-            'message-box' => true,
36
-            'small-caption' => true,
37
-            'status-bar' => true
38
-        );
31
+		static $system_fonts = array(
32
+			'caption' => true,
33
+			'icon' => true,
34
+			'menu' => true,
35
+			'message-box' => true,
36
+			'small-caption' => true,
37
+			'status-bar' => true
38
+		);
39 39
 
40
-        // regular pre-processing
41
-        $string = $this->parseCDATA($string);
42
-        if ($string === '') return false;
40
+		// regular pre-processing
41
+		$string = $this->parseCDATA($string);
42
+		if ($string === '') return false;
43 43
 
44
-        // check if it's one of the keywords
45
-        $lowercase_string = strtolower($string);
46
-        if (isset($system_fonts[$lowercase_string])) {
47
-            return $lowercase_string;
48
-        }
44
+		// check if it's one of the keywords
45
+		$lowercase_string = strtolower($string);
46
+		if (isset($system_fonts[$lowercase_string])) {
47
+			return $lowercase_string;
48
+		}
49 49
 
50
-        $bits = explode(' ', $string); // bits to process
51
-        $stage = 0; // this indicates what we're looking for
52
-        $caught = array(); // which stage 0 properties have we caught?
53
-        $stage_1 = array('font-style', 'font-variant', 'font-weight');
54
-        $final = ''; // output
50
+		$bits = explode(' ', $string); // bits to process
51
+		$stage = 0; // this indicates what we're looking for
52
+		$caught = array(); // which stage 0 properties have we caught?
53
+		$stage_1 = array('font-style', 'font-variant', 'font-weight');
54
+		$final = ''; // output
55 55
 
56
-        for ($i = 0, $size = count($bits); $i < $size; $i++) {
57
-            if ($bits[$i] === '') continue;
58
-            switch ($stage) {
56
+		for ($i = 0, $size = count($bits); $i < $size; $i++) {
57
+			if ($bits[$i] === '') continue;
58
+			switch ($stage) {
59 59
 
60
-                // attempting to catch font-style, font-variant or font-weight
61
-                case 0:
62
-                    foreach ($stage_1 as $validator_name) {
63
-                        if (isset($caught[$validator_name])) continue;
64
-                        $r = $this->info[$validator_name]->validate(
65
-                                                $bits[$i], $config, $context);
66
-                        if ($r !== false) {
67
-                            $final .= $r . ' ';
68
-                            $caught[$validator_name] = true;
69
-                            break;
70
-                        }
71
-                    }
72
-                    // all three caught, continue on
73
-                    if (count($caught) >= 3) $stage = 1;
74
-                    if ($r !== false) break;
60
+				// attempting to catch font-style, font-variant or font-weight
61
+				case 0:
62
+					foreach ($stage_1 as $validator_name) {
63
+						if (isset($caught[$validator_name])) continue;
64
+						$r = $this->info[$validator_name]->validate(
65
+												$bits[$i], $config, $context);
66
+						if ($r !== false) {
67
+							$final .= $r . ' ';
68
+							$caught[$validator_name] = true;
69
+							break;
70
+						}
71
+					}
72
+					// all three caught, continue on
73
+					if (count($caught) >= 3) $stage = 1;
74
+					if ($r !== false) break;
75 75
 
76
-                // attempting to catch font-size and perhaps line-height
77
-                case 1:
78
-                    $found_slash = false;
79
-                    if (strpos($bits[$i], '/') !== false) {
80
-                        list($font_size, $line_height) =
81
-                                                    explode('/', $bits[$i]);
82
-                        if ($line_height === '') {
83
-                            // ooh, there's a space after the slash!
84
-                            $line_height = false;
85
-                            $found_slash = true;
86
-                        }
87
-                    } else {
88
-                        $font_size = $bits[$i];
89
-                        $line_height = false;
90
-                    }
91
-                    $r = $this->info['font-size']->validate(
92
-                                              $font_size, $config, $context);
93
-                    if ($r !== false) {
94
-                        $final .= $r;
95
-                        // attempt to catch line-height
96
-                        if ($line_height === false) {
97
-                            // we need to scroll forward
98
-                            for ($j = $i + 1; $j < $size; $j++) {
99
-                                if ($bits[$j] === '') continue;
100
-                                if ($bits[$j] === '/') {
101
-                                    if ($found_slash) {
102
-                                        return false;
103
-                                    } else {
104
-                                        $found_slash = true;
105
-                                        continue;
106
-                                    }
107
-                                }
108
-                                $line_height = $bits[$j];
109
-                                break;
110
-                            }
111
-                        } else {
112
-                            // slash already found
113
-                            $found_slash = true;
114
-                            $j = $i;
115
-                        }
116
-                        if ($found_slash) {
117
-                            $i = $j;
118
-                            $r = $this->info['line-height']->validate(
119
-                                              $line_height, $config, $context);
120
-                            if ($r !== false) {
121
-                                $final .= '/' . $r;
122
-                            }
123
-                        }
124
-                        $final .= ' ';
125
-                        $stage = 2;
126
-                        break;
127
-                    }
128
-                    return false;
76
+				// attempting to catch font-size and perhaps line-height
77
+				case 1:
78
+					$found_slash = false;
79
+					if (strpos($bits[$i], '/') !== false) {
80
+						list($font_size, $line_height) =
81
+													explode('/', $bits[$i]);
82
+						if ($line_height === '') {
83
+							// ooh, there's a space after the slash!
84
+							$line_height = false;
85
+							$found_slash = true;
86
+						}
87
+					} else {
88
+						$font_size = $bits[$i];
89
+						$line_height = false;
90
+					}
91
+					$r = $this->info['font-size']->validate(
92
+											  $font_size, $config, $context);
93
+					if ($r !== false) {
94
+						$final .= $r;
95
+						// attempt to catch line-height
96
+						if ($line_height === false) {
97
+							// we need to scroll forward
98
+							for ($j = $i + 1; $j < $size; $j++) {
99
+								if ($bits[$j] === '') continue;
100
+								if ($bits[$j] === '/') {
101
+									if ($found_slash) {
102
+										return false;
103
+									} else {
104
+										$found_slash = true;
105
+										continue;
106
+									}
107
+								}
108
+								$line_height = $bits[$j];
109
+								break;
110
+							}
111
+						} else {
112
+							// slash already found
113
+							$found_slash = true;
114
+							$j = $i;
115
+						}
116
+						if ($found_slash) {
117
+							$i = $j;
118
+							$r = $this->info['line-height']->validate(
119
+											  $line_height, $config, $context);
120
+							if ($r !== false) {
121
+								$final .= '/' . $r;
122
+							}
123
+						}
124
+						$final .= ' ';
125
+						$stage = 2;
126
+						break;
127
+					}
128
+					return false;
129 129
 
130
-                // attempting to catch font-family
131
-                case 2:
132
-                    $font_family =
133
-                        implode(' ', array_slice($bits, $i, $size - $i));
134
-                    $r = $this->info['font-family']->validate(
135
-                                              $font_family, $config, $context);
136
-                    if ($r !== false) {
137
-                        $final .= $r . ' ';
138
-                        // processing completed successfully
139
-                        return rtrim($final);
140
-                    }
141
-                    return false;
142
-            }
143
-        }
144
-        return false;
145
-    }
130
+				// attempting to catch font-family
131
+				case 2:
132
+					$font_family =
133
+						implode(' ', array_slice($bits, $i, $size - $i));
134
+					$r = $this->info['font-family']->validate(
135
+											  $font_family, $config, $context);
136
+					if ($r !== false) {
137
+						$final .= $r . ' ';
138
+						// processing completed successfully
139
+						return rtrim($final);
140
+					}
141
+					return false;
142
+			}
143
+		}
144
+		return false;
145
+	}
146 146
 
147 147
 }
148 148
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
         // regular pre-processing
41 41
         $string = $this->parseCDATA($string);
42
-        if ($string === '') return false;
42
+        if ($string === '') {
43
+        	return false;
44
+        }
43 45
 
44 46
         // check if it's one of the keywords
45 47
         $lowercase_string = strtolower($string);
@@ -54,13 +56,17 @@  discard block
 block discarded – undo
54 56
         $final = ''; // output
55 57
 
56 58
         for ($i = 0, $size = count($bits); $i < $size; $i++) {
57
-            if ($bits[$i] === '') continue;
59
+            if ($bits[$i] === '') {
60
+            	continue;
61
+            }
58 62
             switch ($stage) {
59 63
 
60 64
                 // attempting to catch font-style, font-variant or font-weight
61 65
                 case 0:
62 66
                     foreach ($stage_1 as $validator_name) {
63
-                        if (isset($caught[$validator_name])) continue;
67
+                        if (isset($caught[$validator_name])) {
68
+                        	continue;
69
+                        }
64 70
                         $r = $this->info[$validator_name]->validate(
65 71
                                                 $bits[$i], $config, $context);
66 72
                         if ($r !== false) {
@@ -70,8 +76,12 @@  discard block
 block discarded – undo
70 76
                         }
71 77
                     }
72 78
                     // all three caught, continue on
73
-                    if (count($caught) >= 3) $stage = 1;
74
-                    if ($r !== false) break;
79
+                    if (count($caught) >= 3) {
80
+                    	$stage = 1;
81
+                    }
82
+                    if ($r !== false) {
83
+                    	break;
84
+                    }
75 85
 
76 86
                 // attempting to catch font-size and perhaps line-height
77 87
                 case 1:
@@ -96,7 +106,9 @@  discard block
 block discarded – undo
96 106
                         if ($line_height === false) {
97 107
                             // we need to scroll forward
98 108
                             for ($j = $i + 1; $j < $size; $j++) {
99
-                                if ($bits[$j] === '') continue;
109
+                                if ($bits[$j] === '') {
110
+                                	continue;
111
+                                }
100 112
                                 if ($bits[$j] === '/') {
101 113
                                     if ($found_slash) {
102 114
                                         return false;
Please login to merge, or discard this patch.