@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | $bits = explode(' ', $string); |
73 | 73 | |
74 | 74 | $keywords = array(); |
75 | - $keywords['h'] = false; // left, right |
|
76 | - $keywords['v'] = false; // top, bottom |
|
77 | - $keywords['ch'] = false; // center (first word) |
|
78 | - $keywords['cv'] = false; // center (second word) |
|
75 | + $keywords[ 'h' ] = false; // left, right |
|
76 | + $keywords[ 'v' ] = false; // top, bottom |
|
77 | + $keywords[ 'ch' ] = false; // center (first word) |
|
78 | + $keywords[ 'cv' ] = false; // center (second word) |
|
79 | 79 | $measures = array(); |
80 | 80 | |
81 | 81 | $i = 0; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | // test for keyword |
97 | 97 | $lbit = ctype_lower($bit) ? $bit : strtolower($bit); |
98 | - if (isset($lookup[$lbit])) { |
|
99 | - $status = $lookup[$lbit]; |
|
98 | + if (isset($lookup[ $lbit ])) { |
|
99 | + $status = $lookup[ $lbit ]; |
|
100 | 100 | if ($status == 'c') { |
101 | 101 | if ($i == 0) { |
102 | 102 | $status = 'ch'; |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | $status = 'cv'; |
105 | 105 | } |
106 | 106 | } |
107 | - $keywords[$status] = $lbit; |
|
107 | + $keywords[ $status ] = $lbit; |
|
108 | 108 | $i++; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // test for length |
112 | 112 | $r = $this->length->validate($bit, $config, $context); |
113 | 113 | if ($r !== false) { |
114 | - $measures[] = $r; |
|
114 | + $measures[ ] = $r; |
|
115 | 115 | $i++; |
116 | 116 | } |
117 | 117 | |
118 | 118 | // test for percentage |
119 | 119 | $r = $this->percentage->validate($bit, $config, $context); |
120 | 120 | if ($r !== false) { |
121 | - $measures[] = $r; |
|
121 | + $measures[ ] = $r; |
|
122 | 122 | $i++; |
123 | 123 | } |
124 | 124 | } |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | $ret = array(); |
131 | 131 | |
132 | 132 | // first keyword |
133 | - if ($keywords['h']) { |
|
134 | - $ret[] = $keywords['h']; |
|
135 | - } elseif ($keywords['ch']) { |
|
136 | - $ret[] = $keywords['ch']; |
|
137 | - $keywords['cv'] = false; // prevent re-use: center = center center |
|
133 | + if ($keywords[ 'h' ]) { |
|
134 | + $ret[ ] = $keywords[ 'h' ]; |
|
135 | + } elseif ($keywords[ 'ch' ]) { |
|
136 | + $ret[ ] = $keywords[ 'ch' ]; |
|
137 | + $keywords[ 'cv' ] = false; // prevent re-use: center = center center |
|
138 | 138 | } elseif (count($measures)) { |
139 | - $ret[] = array_shift($measures); |
|
139 | + $ret[ ] = array_shift($measures); |
|
140 | 140 | } |
141 | 141 | |
142 | - if ($keywords['v']) { |
|
143 | - $ret[] = $keywords['v']; |
|
144 | - } elseif ($keywords['cv']) { |
|
145 | - $ret[] = $keywords['cv']; |
|
142 | + if ($keywords[ 'v' ]) { |
|
143 | + $ret[ ] = $keywords[ 'v' ]; |
|
144 | + } elseif ($keywords[ 'cv' ]) { |
|
145 | + $ret[ ] = $keywords[ 'cv' ]; |
|
146 | 146 | } elseif (count($measures)) { |
147 | - $ret[] = array_shift($measures); |
|
147 | + $ret[ ] = array_shift($measures); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | if (empty($ret)) { |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | if ($string === '') { |
43 | 43 | return ''; |
44 | 44 | } |
45 | - if ($length > 1 && $string[0] === '[' && $string[$length - 1] === ']') { |
|
45 | + if ($length > 1 && $string[ 0 ] === '[' && $string[ $length - 1 ] === ']') { |
|
46 | 46 | //IPv6 |
47 | 47 | $ip = substr($string, 1, $length - 2); |
48 | 48 | $valid = $this->ipv6->validate($ip, $config, $context); |
49 | 49 | if ($valid === false) { |
50 | 50 | return false; |
51 | 51 | } |
52 | - return '[' . $valid . ']'; |
|
52 | + return '['.$valid.']'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // need to do checks on unusual encodings too |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | $underscore = $config->get('Core.AllowHostnameUnderscore') ? '_' : ''; |
78 | 78 | |
79 | 79 | // The productions describing this are: |
80 | - $a = '[a-z]'; // alpha |
|
81 | - $an = '[a-z0-9]'; // alphanum |
|
80 | + $a = '[a-z]'; // alpha |
|
81 | + $an = '[a-z0-9]'; // alphanum |
|
82 | 82 | $and = "[a-z0-9-$underscore]"; // alphanum | "-" |
83 | 83 | // domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum |
84 | 84 | $domainlabel = "$an($and*$an)?"; |
@@ -102,15 +102,15 @@ discard block |
||
102 | 102 | foreach ($parts as $part) { |
103 | 103 | $encodable = false; |
104 | 104 | for ($i = 0, $c = strlen($part); $i < $c; $i++) { |
105 | - if (ord($part[$i]) > 0x7a) { |
|
105 | + if (ord($part[ $i ]) > 0x7a) { |
|
106 | 106 | $encodable = true; |
107 | 107 | break; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | if (!$encodable) { |
111 | - $new_parts[] = $part; |
|
111 | + $new_parts[ ] = $part; |
|
112 | 112 | } else { |
113 | - $new_parts[] = $idna->encode($part); |
|
113 | + $new_parts[ ] = $idna->encode($part); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $string = implode('.', $new_parts); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $this->_loadRegex(); |
26 | 26 | } |
27 | 27 | |
28 | - if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) { |
|
28 | + if (preg_match('#^'.$this->ip4.'$#s', $aIP)) { |
|
29 | 29 | return $aIP; |
30 | 30 | } |
31 | 31 | return false; |
@@ -57,12 +57,12 @@ |
||
57 | 57 | // certain fringe cases that must not return an integer. |
58 | 58 | |
59 | 59 | // clip leading sign |
60 | - if ($this->negative && $integer[0] === '-') { |
|
60 | + if ($this->negative && $integer[ 0 ] === '-') { |
|
61 | 61 | $digits = substr($integer, 1); |
62 | 62 | if ($digits === '0') { |
63 | 63 | $integer = '0'; |
64 | 64 | } // rm minus sign for zero |
65 | - } elseif ($this->positive && $integer[0] === '+') { |
|
65 | + } elseif ($this->positive && $integer[ 0 ] === '+') { |
|
66 | 66 | $digits = $integer = substr($integer, 1); // rm unnecessary plus |
67 | 67 | } else { |
68 | 68 | $digits = $integer; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $value = trim($value); |
54 | 54 | $ok = false; |
55 | 55 | do { |
56 | - if (isset($definition->info[$property])) { |
|
56 | + if (isset($definition->info[ $property ])) { |
|
57 | 57 | $ok = true; |
58 | 58 | break; |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | break; |
62 | 62 | } |
63 | 63 | $property = strtolower($property); |
64 | - if (isset($definition->info[$property])) { |
|
64 | + if (isset($definition->info[ $property ])) { |
|
65 | 65 | $ok = true; |
66 | 66 | break; |
67 | 67 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // inefficient call, since the validator will do this again |
73 | 73 | if (strtolower(trim($value)) !== 'inherit') { |
74 | 74 | // inherit works for everything (but only on the base property) |
75 | - $result = $definition->info[$property]->validate( |
|
75 | + $result = $definition->info[ $property ]->validate( |
|
76 | 76 | $value, |
77 | 77 | $config, |
78 | 78 | $context |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if ($result === false) { |
84 | 84 | continue; |
85 | 85 | } |
86 | - $propvalues[$property] = $result; |
|
86 | + $propvalues[ $property ] = $result; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $context->destroy('CurrentCSSProperty'); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function __construct($embeds_resource = false) |
24 | 24 | { |
25 | 25 | $this->parser = new HTMLPurifier_URIParser(); |
26 | - $this->embedsResource = (bool)$embeds_resource; |
|
26 | + $this->embedsResource = (bool) $embeds_resource; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // we may want to do full case-insensitive libraries |
47 | 47 | $string = ctype_lower($string) ? $string : strtolower($string); |
48 | 48 | } |
49 | - $result = isset($this->valid_values[$string]); |
|
49 | + $result = isset($this->valid_values[ $string ]); |
|
50 | 50 | |
51 | 51 | return $result ? $string : false; |
52 | 52 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function make($string) |
61 | 61 | { |
62 | - if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') { |
|
62 | + if (strlen($string) > 2 && $string[ 0 ] == 's' && $string[ 1 ] == ':') { |
|
63 | 63 | $string = substr($string, 2); |
64 | 64 | $sensitive = true; |
65 | 65 | } else { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | $length = strlen($string); |
31 | - $last_char = $string[$length - 1]; |
|
31 | + $last_char = $string[ $length - 1 ]; |
|
32 | 32 | |
33 | 33 | if ($last_char !== '*') { |
34 | 34 | return false; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
46 | - $int = (int)$int; |
|
46 | + $int = (int) $int; |
|
47 | 47 | if ($int < 0) { |
48 | 48 | return false; |
49 | 49 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if ($int == 1) { |
54 | 54 | return '*'; |
55 | 55 | } |
56 | - return ((string)$int) . '*'; |
|
56 | + return ((string) $int).'*'; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | $lower = strtolower($string); |
28 | - if (isset($colors[$lower])) { |
|
29 | - return $colors[$lower]; |
|
28 | + if (isset($colors[ $lower ])) { |
|
29 | + return $colors[ $lower ]; |
|
30 | 30 | } |
31 | - if ($string[0] === '#') { |
|
31 | + if ($string[ 0 ] === '#') { |
|
32 | 32 | $hex = substr($string, 1); |
33 | 33 | } else { |
34 | 34 | $hex = $string; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | return false; |
43 | 43 | } |
44 | 44 | if ($length === 3) { |
45 | - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
|
45 | + $hex = $hex[ 0 ].$hex[ 0 ].$hex[ 1 ].$hex[ 1 ].$hex[ 2 ].$hex[ 2 ]; |
|
46 | 46 | } |
47 | 47 | return "#$hex"; |
48 | 48 | } |