@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | // match a generic name |
75 | - if (isset($generic_names[$font])) { |
|
76 | - if ($allowed_fonts === null || isset($allowed_fonts[$font])) { |
|
77 | - $final .= $font . ', '; |
|
75 | + if (isset($generic_names[ $font ])) { |
|
76 | + if ($allowed_fonts === null || isset($allowed_fonts[ $font ])) { |
|
77 | + $final .= $font.', '; |
|
78 | 78 | } |
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | // match a quoted name |
82 | - if ($font[0] === '"' || $font[0] === "'") { |
|
82 | + if ($font[ 0 ] === '"' || $font[ 0 ] === "'") { |
|
83 | 83 | $length = strlen($font); |
84 | 84 | if ($length <= 2) { |
85 | 85 | continue; |
86 | 86 | } |
87 | - $quote = $font[0]; |
|
88 | - if ($font[$length - 1] !== $quote) { |
|
87 | + $quote = $font[ 0 ]; |
|
88 | + if ($font[ $length - 1 ] !== $quote) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | $font = substr($font, 1, $length - 2); |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | |
96 | 96 | // $font is a pure representation of the font name |
97 | 97 | |
98 | - if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) { |
|
98 | + if ($allowed_fonts !== null && !isset($allowed_fonts[ $font ])) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | 102 | if (ctype_alnum($font) && $font !== '') { |
103 | 103 | // very simple font, allow it in unharmed |
104 | - $final .= $font . ', '; |
|
104 | + $final .= $font.', '; |
|
105 | 105 | continue; |
106 | 106 | } |
107 | 107 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | if ($result === false) { |
21 | 21 | return $result; |
22 | 22 | } |
23 | - $float = (float)$result; |
|
23 | + $float = (float) $result; |
|
24 | 24 | if ($float < 0.0) { |
25 | 25 | $result = '0'; |
26 | 26 | } |
@@ -52,12 +52,12 @@ |
||
52 | 52 | $length = count($parts); |
53 | 53 | $final = ''; |
54 | 54 | for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) { |
55 | - if (ctype_space($parts[$i])) { |
|
55 | + if (ctype_space($parts[ $i ])) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | - $result = $this->single->validate($parts[$i], $config, $context); |
|
58 | + $result = $this->single->validate($parts[ $i ], $config, $context); |
|
59 | 59 | if ($result !== false) { |
60 | - $final .= $result . ' '; |
|
60 | + $final .= $result.' '; |
|
61 | 61 | $num++; |
62 | 62 | } |
63 | 63 | } |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | public function __construct($config) |
21 | 21 | { |
22 | 22 | $def = $config->getCSSDefinition(); |
23 | - $this->info['background-color'] = $def->info['background-color']; |
|
24 | - $this->info['background-image'] = $def->info['background-image']; |
|
25 | - $this->info['background-repeat'] = $def->info['background-repeat']; |
|
26 | - $this->info['background-attachment'] = $def->info['background-attachment']; |
|
27 | - $this->info['background-position'] = $def->info['background-position']; |
|
23 | + $this->info[ 'background-color' ] = $def->info[ 'background-color' ]; |
|
24 | + $this->info[ 'background-image' ] = $def->info[ 'background-image' ]; |
|
25 | + $this->info[ 'background-repeat' ] = $def->info[ 'background-repeat' ]; |
|
26 | + $this->info[ 'background-attachment' ] = $def->info[ 'background-attachment' ]; |
|
27 | + $this->info[ 'background-position' ] = $def->info[ 'background-position' ]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $bits = explode(' ', $string); // bits to process |
49 | 49 | |
50 | 50 | $caught = array(); |
51 | - $caught['color'] = false; |
|
52 | - $caught['image'] = false; |
|
53 | - $caught['repeat'] = false; |
|
54 | - $caught['attachment'] = false; |
|
55 | - $caught['position'] = false; |
|
51 | + $caught[ 'color' ] = false; |
|
52 | + $caught[ 'image' ] = false; |
|
53 | + $caught[ 'repeat' ] = false; |
|
54 | + $caught[ 'attachment' ] = false; |
|
55 | + $caught[ 'position' ] = false; |
|
56 | 56 | |
57 | 57 | $i = 0; // number of catches |
58 | 58 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($status !== false) { |
66 | 66 | continue; |
67 | 67 | } |
68 | - $r = $this->info['background-' . $key]->validate($bit, $config, $context); |
|
68 | + $r = $this->info[ 'background-'.$key ]->validate($bit, $config, $context); |
|
69 | 69 | } else { |
70 | 70 | $r = $bit; |
71 | 71 | } |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | if ($key == 'position') { |
76 | - if ($caught[$key] === false) { |
|
77 | - $caught[$key] = ''; |
|
76 | + if ($caught[ $key ] === false) { |
|
77 | + $caught[ $key ] = ''; |
|
78 | 78 | } |
79 | - $caught[$key] .= $r . ' '; |
|
79 | + $caught[ $key ] .= $r.' '; |
|
80 | 80 | } else { |
81 | - $caught[$key] = $r; |
|
81 | + $caught[ $key ] = $r; |
|
82 | 82 | } |
83 | 83 | $i++; |
84 | 84 | break; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | if (!$i) { |
89 | 89 | return false; |
90 | 90 | } |
91 | - if ($caught['position'] !== false) { |
|
92 | - $caught['position'] = $this->info['background-position']-> |
|
93 | - validate($caught['position'], $config, $context); |
|
91 | + if ($caught[ 'position' ] !== false) { |
|
92 | + $caught[ 'position' ] = $this->info[ 'background-position' ]-> |
|
93 | + validate($caught[ 'position' ], $config, $context); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $ret = array(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if ($value === false) { |
99 | 99 | continue; |
100 | 100 | } |
101 | - $ret[] = $value; |
|
101 | + $ret[ ] = $value; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if (empty($ret)) { |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | $lower = strtolower($color); |
28 | - if (isset($colors[$lower])) { |
|
29 | - return $colors[$lower]; |
|
28 | + if (isset($colors[ $lower ])) { |
|
29 | + return $colors[ $lower ]; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if (strpos($color, 'rgb(') !== false) { |
@@ -48,21 +48,21 @@ discard block |
||
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | $length = strlen($part); |
51 | - if ($part[$length - 1] === '%') { |
|
51 | + if ($part[ $length - 1 ] === '%') { |
|
52 | 52 | // handle percents |
53 | 53 | if (!$type) { |
54 | 54 | $type = 'percentage'; |
55 | 55 | } elseif ($type !== 'percentage') { |
56 | 56 | return false; |
57 | 57 | } |
58 | - $num = (float)substr($part, 0, $length - 1); |
|
58 | + $num = (float) substr($part, 0, $length - 1); |
|
59 | 59 | if ($num < 0) { |
60 | 60 | $num = 0; |
61 | 61 | } |
62 | 62 | if ($num > 100) { |
63 | 63 | $num = 100; |
64 | 64 | } |
65 | - $new_parts[] = "$num%"; |
|
65 | + $new_parts[ ] = "$num%"; |
|
66 | 66 | } else { |
67 | 67 | // handle integers |
68 | 68 | if (!$type) { |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | } elseif ($type !== 'integer') { |
71 | 71 | return false; |
72 | 72 | } |
73 | - $num = (int)$part; |
|
73 | + $num = (int) $part; |
|
74 | 74 | if ($num < 0) { |
75 | 75 | $num = 0; |
76 | 76 | } |
77 | 77 | if ($num > 255) { |
78 | 78 | $num = 255; |
79 | 79 | } |
80 | - $new_parts[] = (string)$num; |
|
80 | + $new_parts[ ] = (string) $num; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | $new_triad = implode(',', $new_parts); |
84 | 84 | $color = "rgb($new_triad)"; |
85 | 85 | } else { |
86 | 86 | // hexadecimal handling |
87 | - if ($color[0] === '#') { |
|
87 | + if ($color[ 0 ] === '#') { |
|
88 | 88 | $hex = substr($color, 1); |
89 | 89 | } else { |
90 | 90 | $hex = $color; |
91 | - $color = '#' . $color; |
|
91 | + $color = '#'.$color; |
|
92 | 92 | } |
93 | 93 | $length = strlen($hex); |
94 | 94 | if ($length !== 3 && $length !== 6) { |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | public function __construct($config) |
19 | 19 | { |
20 | 20 | $def = $config->getCSSDefinition(); |
21 | - $this->info['border-width'] = $def->info['border-width']; |
|
22 | - $this->info['border-style'] = $def->info['border-style']; |
|
23 | - $this->info['border-top-color'] = $def->info['border-top-color']; |
|
21 | + $this->info[ 'border-width' ] = $def->info[ 'border-width' ]; |
|
22 | + $this->info[ 'border-style' ] = $def->info[ 'border-style' ]; |
|
23 | + $this->info[ 'border-top-color' ] = $def->info[ 'border-top-color' ]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $ret = ''; // return value |
39 | 39 | foreach ($bits as $bit) { |
40 | 40 | foreach ($this->info as $propname => $validator) { |
41 | - if (isset($done[$propname])) { |
|
41 | + if (isset($done[ $propname ])) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 | $r = $validator->validate($bit, $config, $context); |
45 | 45 | if ($r !== false) { |
46 | - $ret .= $r . ' '; |
|
47 | - $done[$propname] = true; |
|
46 | + $ret .= $r.' '; |
|
47 | + $done[ $propname ] = true; |
|
48 | 48 | break; |
49 | 49 | } |
50 | 50 | } |
@@ -34,15 +34,15 @@ |
||
34 | 34 | } |
35 | 35 | $uri_string = substr($uri_string, 4); |
36 | 36 | $new_length = strlen($uri_string) - 1; |
37 | - if ($uri_string[$new_length] != ')') { |
|
37 | + if ($uri_string[ $new_length ] != ')') { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | $uri = trim(substr($uri_string, 0, $new_length)); |
41 | 41 | |
42 | - if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) { |
|
43 | - $quote = $uri[0]; |
|
42 | + if (!empty($uri) && ($uri[ 0 ] == "'" || $uri[ 0 ] == '"')) { |
|
43 | + $quote = $uri[ 0 ]; |
|
44 | 44 | $new_length = strlen($uri) - 1; |
45 | - if ($uri[$new_length] !== $quote) { |
|
45 | + if ($uri[ $new_length ] !== $quote) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | $uri = substr($uri, 1, $new_length - 1); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function validate($string, $config, $context) |
37 | 37 | { |
38 | 38 | foreach ($this->defs as $i => $def) { |
39 | - $result = $this->defs[$i]->validate($string, $config, $context); |
|
39 | + $result = $this->defs[ $i ]->validate($string, $config, $context); |
|
40 | 40 | if ($result !== false) { |
41 | 41 | return $result; |
42 | 42 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | if ($length === 1) { |
38 | 38 | return false; |
39 | 39 | } |
40 | - if ($string[$length - 1] !== '%') { |
|
40 | + if ($string[ $length - 1 ] !== '%') { |
|
41 | 41 | return false; |
42 | 42 | } |
43 | 43 |