@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function toArray($t = NULL) { |
48 | 48 | $a = $this->front; |
49 | - if ($t !== NULL) $a[] = $t; |
|
50 | - for ($i = count($this->back)-1; $i >= 0; $i--) { |
|
51 | - $a[] = $this->back[$i]; |
|
49 | + if ($t !== NULL) $a[ ] = $t; |
|
50 | + for ($i = count($this->back) - 1; $i >= 0; $i--) { |
|
51 | + $a[ ] = $this->back[ $i ]; |
|
52 | 52 | } |
53 | 53 | return $a; |
54 | 54 | } |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | $old = array(); |
145 | 145 | $r = $t; |
146 | 146 | for ($i = $delete; $i > 0; $i--) { |
147 | - $old[] = $r; |
|
147 | + $old[ ] = $r; |
|
148 | 148 | $r = $this->delete(); |
149 | 149 | } |
150 | 150 | // insert |
151 | - for ($i = count($replacement)-1; $i >= 0; $i--) { |
|
151 | + for ($i = count($replacement) - 1; $i >= 0; $i--) { |
|
152 | 152 | $this->insertAfter($r); |
153 | - $r = $replacement[$i]; |
|
153 | + $r = $replacement[ $i ]; |
|
154 | 154 | } |
155 | 155 | return array($old, $r); |
156 | 156 | } |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function toArray($t = NULL) { |
48 | 48 | $a = $this->front; |
49 | - if ($t !== NULL) $a[] = $t; |
|
49 | + if ($t !== NULL) { |
|
50 | + $a[] = $t; |
|
51 | + } |
|
50 | 52 | for ($i = count($this->back)-1; $i >= 0; $i--) { |
51 | 53 | $a[] = $this->back[$i]; |
52 | 54 | } |
@@ -59,7 +61,9 @@ discard block |
||
59 | 61 | * @return Original contents of new hole. |
60 | 62 | */ |
61 | 63 | public function next($t) { |
62 | - if ($t !== NULL) array_push($this->front, $t); |
|
64 | + if ($t !== NULL) { |
|
65 | + array_push($this->front, $t); |
|
66 | + } |
|
63 | 67 | return empty($this->back) ? NULL : array_pop($this->back); |
64 | 68 | } |
65 | 69 | |
@@ -82,7 +86,9 @@ discard block |
||
82 | 86 | * @return Original contents of new hole. |
83 | 87 | */ |
84 | 88 | public function prev($t) { |
85 | - if ($t !== NULL) array_push($this->back, $t); |
|
89 | + if ($t !== NULL) { |
|
90 | + array_push($this->back, $t); |
|
91 | + } |
|
86 | 92 | return empty($this->front) ? NULL : array_pop($this->front); |
87 | 93 | } |
88 | 94 | |
@@ -108,7 +114,9 @@ discard block |
||
108 | 114 | * @param Element to insert |
109 | 115 | */ |
110 | 116 | public function insertBefore($t) { |
111 | - if ($t !== NULL) array_push($this->front, $t); |
|
117 | + if ($t !== NULL) { |
|
118 | + array_push($this->front, $t); |
|
119 | + } |
|
112 | 120 | } |
113 | 121 | |
114 | 122 | /** |
@@ -116,7 +124,9 @@ discard block |
||
116 | 124 | * @param Element to insert |
117 | 125 | */ |
118 | 126 | public function insertAfter($t) { |
119 | - if ($t !== NULL) array_push($this->back, $t); |
|
127 | + if ($t !== NULL) { |
|
128 | + array_push($this->back, $t); |
|
129 | + } |
|
120 | 130 | } |
121 | 131 | |
122 | 132 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function setup() |
76 | 76 | { |
77 | 77 | $this->validator = new HTMLPurifier_AttrDef_Lang(); |
78 | - $this->dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier'; |
|
78 | + $this->dir = HTMLPURIFIER_PREFIX.'/HTMLPurifier'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | if ($code == 'en') { |
108 | 108 | $lang = new HTMLPurifier_Language($config, $context); |
109 | 109 | } else { |
110 | - $class = 'HTMLPurifier_Language_' . $pcode; |
|
111 | - $file = $this->dir . '/Language/classes/' . $code . '.php'; |
|
110 | + $class = 'HTMLPurifier_Language_'.$pcode; |
|
111 | + $file = $this->dir.'/Language/classes/'.$code.'.php'; |
|
112 | 112 | if (file_exists($file) || class_exists($class, false)) { |
113 | 113 | $lang = new $class($config, $context); |
114 | 114 | } else { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function getFallbackFor($code) |
137 | 137 | { |
138 | 138 | $this->loadLanguage($code); |
139 | - return $this->cache[$code]['fallback']; |
|
139 | + return $this->cache[ $code ][ 'fallback' ]; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | static $languages_seen = array(); // recursion guard |
149 | 149 | |
150 | 150 | // abort if we've already loaded it |
151 | - if (isset($this->cache[$code])) { |
|
151 | + if (isset($this->cache[ $code ])) { |
|
152 | 152 | return; |
153 | 153 | } |
154 | 154 | |
155 | 155 | // generate filename |
156 | - $filename = $this->dir . '/Language/messages/' . $code . '.php'; |
|
156 | + $filename = $this->dir.'/Language/messages/'.$code.'.php'; |
|
157 | 157 | |
158 | 158 | // default fallback : may be overwritten by the ensuing include |
159 | 159 | $fallback = ($code != 'en') ? 'en' : false; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // load primary localisation |
162 | 162 | if (!file_exists($filename)) { |
163 | 163 | // skip the include: will rely solely on fallback |
164 | - $filename = $this->dir . '/Language/messages/en.php'; |
|
164 | + $filename = $this->dir.'/Language/messages/en.php'; |
|
165 | 165 | $cache = array(); |
166 | 166 | } else { |
167 | 167 | include $filename; |
@@ -172,36 +172,36 @@ discard block |
||
172 | 172 | if (!empty($fallback)) { |
173 | 173 | |
174 | 174 | // infinite recursion guard |
175 | - if (isset($languages_seen[$code])) { |
|
175 | + if (isset($languages_seen[ $code ])) { |
|
176 | 176 | trigger_error( |
177 | - 'Circular fallback reference in language ' . |
|
177 | + 'Circular fallback reference in language '. |
|
178 | 178 | $code, |
179 | 179 | E_USER_ERROR |
180 | 180 | ); |
181 | 181 | $fallback = 'en'; |
182 | 182 | } |
183 | - $language_seen[$code] = true; |
|
183 | + $language_seen[ $code ] = true; |
|
184 | 184 | |
185 | 185 | // load the fallback recursively |
186 | 186 | $this->loadLanguage($fallback); |
187 | - $fallback_cache = $this->cache[$fallback]; |
|
187 | + $fallback_cache = $this->cache[ $fallback ]; |
|
188 | 188 | |
189 | 189 | // merge fallback with current language |
190 | 190 | foreach ($this->keys as $key) { |
191 | - if (isset($cache[$key]) && isset($fallback_cache[$key])) { |
|
192 | - if (isset($this->mergeable_keys_map[$key])) { |
|
193 | - $cache[$key] = $cache[$key] + $fallback_cache[$key]; |
|
194 | - } elseif (isset($this->mergeable_keys_list[$key])) { |
|
195 | - $cache[$key] = array_merge($fallback_cache[$key], $cache[$key]); |
|
191 | + if (isset($cache[ $key ]) && isset($fallback_cache[ $key ])) { |
|
192 | + if (isset($this->mergeable_keys_map[ $key ])) { |
|
193 | + $cache[ $key ] = $cache[ $key ] + $fallback_cache[ $key ]; |
|
194 | + } elseif (isset($this->mergeable_keys_list[ $key ])) { |
|
195 | + $cache[ $key ] = array_merge($fallback_cache[ $key ], $cache[ $key ]); |
|
196 | 196 | } |
197 | 197 | } else { |
198 | - $cache[$key] = $fallback_cache[$key]; |
|
198 | + $cache[ $key ] = $fallback_cache[ $key ]; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | // save to cache for later retrieval |
204 | - $this->cache[$code] = $cache; |
|
204 | + $this->cache[ $code ] = $cache; |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | } |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | // Note that ["<>] are an addition to the RFC's recommended |
32 | 32 | // characters, because they represent external delimeters. |
33 | 33 | $r_URI = '!'. |
34 | - '(([a-zA-Z0-9\.\+\-]+):)?'. // 2. Scheme |
|
35 | - '(//([^/?#"<>]*))?'. // 4. Authority |
|
36 | - '([^?#"<>]*)'. // 5. Path |
|
37 | - '(\?([^#"<>]*))?'. // 7. Query |
|
38 | - '(#([^"<>]*))?'. // 8. Fragment |
|
34 | + '(([a-zA-Z0-9\.\+\-]+):)?'.// 2. Scheme |
|
35 | + '(//([^/?#"<>]*))?'.// 4. Authority |
|
36 | + '([^?#"<>]*)'.// 5. Path |
|
37 | + '(\?([^#"<>]*))?'.// 7. Query |
|
38 | + '(#([^"<>]*))?'.// 8. Fragment |
|
39 | 39 | '!'; |
40 | 40 | |
41 | 41 | $matches = array(); |
@@ -44,20 +44,20 @@ discard block |
||
44 | 44 | if (!$result) return false; // *really* invalid URI |
45 | 45 | |
46 | 46 | // seperate out parts |
47 | - $scheme = !empty($matches[1]) ? $matches[2] : null; |
|
48 | - $authority = !empty($matches[3]) ? $matches[4] : null; |
|
49 | - $path = $matches[5]; // always present, can be empty |
|
50 | - $query = !empty($matches[6]) ? $matches[7] : null; |
|
51 | - $fragment = !empty($matches[8]) ? $matches[9] : null; |
|
47 | + $scheme = !empty($matches[ 1 ]) ? $matches[ 2 ] : null; |
|
48 | + $authority = !empty($matches[ 3 ]) ? $matches[ 4 ] : null; |
|
49 | + $path = $matches[ 5 ]; // always present, can be empty |
|
50 | + $query = !empty($matches[ 6 ]) ? $matches[ 7 ] : null; |
|
51 | + $fragment = !empty($matches[ 8 ]) ? $matches[ 9 ] : null; |
|
52 | 52 | |
53 | 53 | // further parse authority |
54 | 54 | if ($authority !== null) { |
55 | 55 | $r_authority = "/^((.+?)@)?(\[[^\]]+\]|[^:]*)(:(\d*))?/"; |
56 | 56 | $matches = array(); |
57 | 57 | preg_match($r_authority, $authority, $matches); |
58 | - $userinfo = !empty($matches[1]) ? $matches[2] : null; |
|
59 | - $host = !empty($matches[3]) ? $matches[3] : ''; |
|
60 | - $port = !empty($matches[4]) ? (int) $matches[5] : null; |
|
58 | + $userinfo = !empty($matches[ 1 ]) ? $matches[ 2 ] : null; |
|
59 | + $host = !empty($matches[ 3 ]) ? $matches[ 3 ] : ''; |
|
60 | + $port = !empty($matches[ 4 ]) ? (int) $matches[ 5 ] : null; |
|
61 | 61 | } else { |
62 | 62 | $port = $host = $userinfo = null; |
63 | 63 | } |
@@ -41,7 +41,10 @@ |
||
41 | 41 | $matches = array(); |
42 | 42 | $result = preg_match($r_URI, $uri, $matches); |
43 | 43 | |
44 | - if (!$result) return false; // *really* invalid URI |
|
44 | + if (!$result) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + // *really* invalid URI |
|
45 | 48 | |
46 | 49 | // seperate out parts |
47 | 50 | $scheme = !empty($matches[1]) ? $matches[2] : null; |
@@ -47,24 +47,24 @@ discard block |
||
47 | 47 | // important, otherwise attacker could include arbitrary file |
48 | 48 | $allowed_schemes = $config->get('URI.AllowedSchemes'); |
49 | 49 | if (!$config->get('URI.OverrideAllowedSchemes') && |
50 | - !isset($allowed_schemes[$scheme]) |
|
50 | + !isset($allowed_schemes[ $scheme ]) |
|
51 | 51 | ) { |
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | - if (isset($this->schemes[$scheme])) { |
|
56 | - return $this->schemes[$scheme]; |
|
55 | + if (isset($this->schemes[ $scheme ])) { |
|
56 | + return $this->schemes[ $scheme ]; |
|
57 | 57 | } |
58 | - if (!isset($allowed_schemes[$scheme])) { |
|
58 | + if (!isset($allowed_schemes[ $scheme ])) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - $class = 'HTMLPurifier_URIScheme_' . $scheme; |
|
62 | + $class = 'HTMLPurifier_URIScheme_'.$scheme; |
|
63 | 63 | if (!class_exists($class)) { |
64 | 64 | return; |
65 | 65 | } |
66 | - $this->schemes[$scheme] = new $class(); |
|
67 | - return $this->schemes[$scheme]; |
|
66 | + $this->schemes[ $scheme ] = new $class(); |
|
67 | + return $this->schemes[ $scheme ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function register($scheme, $scheme_obj) |
76 | 76 | { |
77 | - $this->schemes[$scheme] = $scheme_obj; |
|
77 | + $this->schemes[ $scheme ] = $scheme_obj; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $status = parent::add($def, $config); |
36 | 36 | if ($status) { |
37 | - $this->definitions[$this->generateKey($config)] = $def; |
|
37 | + $this->definitions[ $this->generateKey($config) ] = $def; |
|
38 | 38 | } |
39 | 39 | return $status; |
40 | 40 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $status = parent::set($def, $config); |
50 | 50 | if ($status) { |
51 | - $this->definitions[$this->generateKey($config)] = $def; |
|
51 | + $this->definitions[ $this->generateKey($config) ] = $def; |
|
52 | 52 | } |
53 | 53 | return $status; |
54 | 54 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $status = parent::replace($def, $config); |
64 | 64 | if ($status) { |
65 | - $this->definitions[$this->generateKey($config)] = $def; |
|
65 | + $this->definitions[ $this->generateKey($config) ] = $def; |
|
66 | 66 | } |
67 | 67 | return $status; |
68 | 68 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | public function get($config) |
75 | 75 | { |
76 | 76 | $key = $this->generateKey($config); |
77 | - if (isset($this->definitions[$key])) { |
|
78 | - return $this->definitions[$key]; |
|
77 | + if (isset($this->definitions[ $key ])) { |
|
78 | + return $this->definitions[ $key ]; |
|
79 | 79 | } |
80 | - $this->definitions[$key] = parent::get($config); |
|
81 | - return $this->definitions[$key]; |
|
80 | + $this->definitions[ $key ] = parent::get($config); |
|
81 | + return $this->definitions[ $key ]; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $decorator = $this->copy(); |
30 | 30 | // reference is necessary for mocks in PHP 4 |
31 | - $decorator->cache =& $cache; |
|
31 | + $decorator->cache = & $cache; |
|
32 | 32 | $decorator->type = $cache->type; |
33 | 33 | return $decorator; |
34 | 34 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | if (empty($filename)) { |
102 | 102 | continue; |
103 | 103 | } |
104 | - if ($filename[0] === '.') { |
|
104 | + if ($filename[ 0 ] === '.') { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | - unlink($dir . '/' . $filename); |
|
107 | + unlink($dir.'/'.$filename); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | if (empty($filename)) { |
124 | 124 | continue; |
125 | 125 | } |
126 | - if ($filename[0] === '.') { |
|
126 | + if ($filename[ 0 ] === '.') { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | $key = substr($filename, 0, strlen($filename) - 4); |
130 | 130 | if ($this->isOld($key, $config)) { |
131 | - unlink($dir . '/' . $filename); |
|
131 | + unlink($dir.'/'.$filename); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function generateFilePath($config) |
144 | 144 | { |
145 | 145 | $key = $this->generateKey($config); |
146 | - return $this->generateDirectoryPath($config) . '/' . $key . '.ser'; |
|
146 | + return $this->generateDirectoryPath($config).'/'.$key.'.ser'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function generateDirectoryPath($config) |
157 | 157 | { |
158 | 158 | $base = $this->generateBaseDirectoryPath($config); |
159 | - return $base . '/' . $this->type; |
|
159 | + return $base.'/'.$this->type; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function generateBaseDirectoryPath($config) |
170 | 170 | { |
171 | 171 | $base = $config->get('Cache.SerializerPath'); |
172 | - $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base; |
|
172 | + $base = is_null($base) ? HTMLPURIFIER_PREFIX.'/HTMLPurifier/DefinitionCache/Serializer' : $base; |
|
173 | 173 | return $base; |
174 | 174 | } |
175 | 175 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $base = $this->generateBaseDirectoryPath($config); |
212 | 212 | if (!is_dir($base)) { |
213 | 213 | trigger_error( |
214 | - 'Base directory ' . $base . ' does not exist, |
|
214 | + 'Base directory '.$base.' does not exist, |
|
215 | 215 | please create or change using %Cache.SerializerPath', |
216 | 216 | E_USER_WARNING |
217 | 217 | ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | mkdir($directory, $chmod); |
223 | 223 | if (!$this->_testPermissions($directory, $chmod)) { |
224 | 224 | trigger_error( |
225 | - 'Base directory ' . $base . ' does not exist, |
|
225 | + 'Base directory '.$base.' does not exist, |
|
226 | 226 | please create or change using %Cache.SerializerPath', |
227 | 227 | E_USER_WARNING |
228 | 228 | ); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | // generally, you'll want to handle this beforehand |
252 | 252 | // so a more specific error message can be given |
253 | 253 | trigger_error( |
254 | - 'Directory ' . $dir . ' does not exist', |
|
254 | + 'Directory '.$dir.' does not exist', |
|
255 | 255 | E_USER_WARNING |
256 | 256 | ); |
257 | 257 | return false; |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | $chmod = $chmod | 0777; |
273 | 273 | } |
274 | 274 | trigger_error( |
275 | - 'Directory ' . $dir . ' not writable, ' . |
|
276 | - 'please chmod to ' . decoct($chmod), |
|
275 | + 'Directory '.$dir.' not writable, '. |
|
276 | + 'please chmod to '.decoct($chmod), |
|
277 | 277 | E_USER_WARNING |
278 | 278 | ); |
279 | 279 | } else { |
280 | 280 | // generic error message |
281 | 281 | trigger_error( |
282 | - 'Directory ' . $dir . ' not writable, ' . |
|
282 | + 'Directory '.$dir.' not writable, '. |
|
283 | 283 | 'please alter file permissions', |
284 | 284 | E_USER_WARNING |
285 | 285 | ); |
@@ -28,56 +28,56 @@ |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | // process primary subtag : $subtags[0] |
31 | - $length = strlen($subtags[0]); |
|
31 | + $length = strlen($subtags[ 0 ]); |
|
32 | 32 | switch ($length) { |
33 | 33 | case 0: |
34 | 34 | return false; |
35 | 35 | case 1: |
36 | - if (!($subtags[0] == 'x' || $subtags[0] == 'i')) { |
|
36 | + if (!($subtags[ 0 ] == 'x' || $subtags[ 0 ] == 'i')) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | break; |
40 | 40 | case 2: |
41 | 41 | case 3: |
42 | - if (!ctype_alpha($subtags[0])) { |
|
42 | + if (!ctype_alpha($subtags[ 0 ])) { |
|
43 | 43 | return false; |
44 | - } elseif (!ctype_lower($subtags[0])) { |
|
45 | - $subtags[0] = strtolower($subtags[0]); |
|
44 | + } elseif (!ctype_lower($subtags[ 0 ])) { |
|
45 | + $subtags[ 0 ] = strtolower($subtags[ 0 ]); |
|
46 | 46 | } |
47 | 47 | break; |
48 | 48 | default: |
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | - $new_string = $subtags[0]; |
|
52 | + $new_string = $subtags[ 0 ]; |
|
53 | 53 | if ($num_subtags == 1) { |
54 | 54 | return $new_string; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // process second subtag : $subtags[1] |
58 | - $length = strlen($subtags[1]); |
|
59 | - if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) { |
|
58 | + $length = strlen($subtags[ 1 ]); |
|
59 | + if ($length == 0 || ($length == 1 && $subtags[ 1 ] != 'x') || $length > 8 || !ctype_alnum($subtags[ 1 ])) { |
|
60 | 60 | return $new_string; |
61 | 61 | } |
62 | - if (!ctype_lower($subtags[1])) { |
|
63 | - $subtags[1] = strtolower($subtags[1]); |
|
62 | + if (!ctype_lower($subtags[ 1 ])) { |
|
63 | + $subtags[ 1 ] = strtolower($subtags[ 1 ]); |
|
64 | 64 | } |
65 | 65 | |
66 | - $new_string .= '-' . $subtags[1]; |
|
66 | + $new_string .= '-'.$subtags[ 1 ]; |
|
67 | 67 | if ($num_subtags == 2) { |
68 | 68 | return $new_string; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // process all other subtags, index 2 and up |
72 | 72 | for ($i = 2; $i < $num_subtags; $i++) { |
73 | - $length = strlen($subtags[$i]); |
|
74 | - if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) { |
|
73 | + $length = strlen($subtags[ $i ]); |
|
74 | + if ($length == 0 || $length > 8 || !ctype_alnum($subtags[ $i ])) { |
|
75 | 75 | return $new_string; |
76 | 76 | } |
77 | - if (!ctype_lower($subtags[$i])) { |
|
78 | - $subtags[$i] = strtolower($subtags[$i]); |
|
77 | + if (!ctype_lower($subtags[ $i ])) { |
|
78 | + $subtags[ $i ] = strtolower($subtags[ $i ]); |
|
79 | 79 | } |
80 | - $new_string .= '-' . $subtags[$i]; |
|
80 | + $new_string .= '-'.$subtags[ $i ]; |
|
81 | 81 | } |
82 | 82 | return $new_string; |
83 | 83 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | public function __construct($config) |
21 | 21 | { |
22 | 22 | $def = $config->getCSSDefinition(); |
23 | - $this->info['list-style-type'] = $def->info['list-style-type']; |
|
24 | - $this->info['list-style-position'] = $def->info['list-style-position']; |
|
25 | - $this->info['list-style-image'] = $def->info['list-style-image']; |
|
23 | + $this->info[ 'list-style-type' ] = $def->info[ 'list-style-type' ]; |
|
24 | + $this->info[ 'list-style-position' ] = $def->info[ 'list-style-position' ]; |
|
25 | + $this->info[ 'list-style-image' ] = $def->info[ 'list-style-image' ]; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $bits = explode(' ', strtolower($string)); // bits to process |
44 | 44 | |
45 | 45 | $caught = array(); |
46 | - $caught['type'] = false; |
|
47 | - $caught['position'] = false; |
|
48 | - $caught['image'] = false; |
|
46 | + $caught[ 'type' ] = false; |
|
47 | + $caught[ 'position' ] = false; |
|
48 | + $caught[ 'image' ] = false; |
|
49 | 49 | |
50 | 50 | $i = 0; // number of catches |
51 | 51 | $none = false; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | if ($status !== false) { |
62 | 62 | continue; |
63 | 63 | } |
64 | - $r = $this->info['list-style-' . $key]->validate($bit, $config, $context); |
|
64 | + $r = $this->info[ 'list-style-'.$key ]->validate($bit, $config, $context); |
|
65 | 65 | if ($r === false) { |
66 | 66 | continue; |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | } |
78 | - $caught[$key] = $r; |
|
78 | + $caught[ $key ] = $r; |
|
79 | 79 | $i++; |
80 | 80 | break; |
81 | 81 | } |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | $ret = array(); |
89 | 89 | |
90 | 90 | // construct type |
91 | - if ($caught['type']) { |
|
92 | - $ret[] = $caught['type']; |
|
91 | + if ($caught[ 'type' ]) { |
|
92 | + $ret[ ] = $caught[ 'type' ]; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // construct image |
96 | - if ($caught['image']) { |
|
97 | - $ret[] = $caught['image']; |
|
96 | + if ($caught[ 'image' ]) { |
|
97 | + $ret[ ] = $caught[ 'image' ]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // construct position |
101 | - if ($caught['position']) { |
|
102 | - $ret[] = $caught['position']; |
|
101 | + if ($caught[ 'position' ]) { |
|
102 | + $ret[ ] = $caught[ 'position' ]; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if (empty($ret)) { |