@@ -9,23 +9,23 @@ discard block |
||
9 | 9 | * by creating a 'config.php' file. |
10 | 10 | */ |
11 | 11 | |
12 | -if(!defined("PHORUM_ADMIN")) exit; |
|
12 | +if (!defined("PHORUM_ADMIN")) exit; |
|
13 | 13 | |
14 | 14 | // error reporting is good! |
15 | 15 | error_reporting(E_ALL ^ E_NOTICE); |
16 | 16 | |
17 | 17 | // load library and other paraphenalia |
18 | 18 | require_once './include/admin/PhorumInputForm.php'; |
19 | -require_once (dirname(__FILE__) . '/htmlpurifier/HTMLPurifier.auto.php'); |
|
20 | -require_once (dirname(__FILE__) . '/init-config.php'); |
|
21 | -require_once (dirname(__FILE__) . '/settings/migrate-sigs-form.php'); |
|
22 | -require_once (dirname(__FILE__) . '/settings/migrate-sigs.php'); |
|
23 | -require_once (dirname(__FILE__) . '/settings/form.php'); |
|
24 | -require_once (dirname(__FILE__) . '/settings/save.php'); |
|
19 | +require_once (dirname(__FILE__).'/htmlpurifier/HTMLPurifier.auto.php'); |
|
20 | +require_once (dirname(__FILE__).'/init-config.php'); |
|
21 | +require_once (dirname(__FILE__).'/settings/migrate-sigs-form.php'); |
|
22 | +require_once (dirname(__FILE__).'/settings/migrate-sigs.php'); |
|
23 | +require_once (dirname(__FILE__).'/settings/form.php'); |
|
24 | +require_once (dirname(__FILE__).'/settings/save.php'); |
|
25 | 25 | |
26 | 26 | // define friendly configuration directives. you can expand this array |
27 | 27 | // to get more web-definable directives |
28 | -$PHORUM['mod_htmlpurifier']['directives'] = array( |
|
28 | +$PHORUM[ 'mod_htmlpurifier' ][ 'directives' ] = array( |
|
29 | 29 | 'URI.Host', // auto-detectable |
30 | 30 | 'URI.DisableExternal', |
31 | 31 | 'URI.DisableExternalResources', |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | // lower this setting if you're getting time outs/out of memory |
46 | -$PHORUM['mod_htmlpurifier']['migrate-sigs-increment'] = 100; |
|
46 | +$PHORUM[ 'mod_htmlpurifier' ][ 'migrate-sigs-increment' ] = 100; |
|
47 | 47 | |
48 | -if (isset($_POST['reset'])) { |
|
49 | - unset($PHORUM['mod_htmlpurifier']['config']); |
|
48 | +if (isset($_POST[ 'reset' ])) { |
|
49 | + unset($PHORUM[ 'mod_htmlpurifier' ][ 'config' ]); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($offset = phorum_htmlpurifier_migrate_sigs_check()) { |
53 | 53 | // migrate signatures |
54 | 54 | phorum_htmlpurifier_migrate_sigs($offset); |
55 | -} elseif(!empty($_POST)){ |
|
55 | +} elseif (!empty($_POST)) { |
|
56 | 56 | // save settings |
57 | 57 | phorum_htmlpurifier_save_settings(); |
58 | 58 | } |
@@ -9,7 +9,9 @@ |
||
9 | 9 | * by creating a 'config.php' file. |
10 | 10 | */ |
11 | 11 | |
12 | -if(!defined("PHORUM_ADMIN")) exit; |
|
12 | +if(!defined("PHORUM_ADMIN")) { |
|
13 | + exit; |
|
14 | +} |
|
13 | 15 | |
14 | 16 | // error reporting is good! |
15 | 17 | error_reporting(E_ALL ^ E_NOTICE); |
@@ -6,6 +6,6 @@ |
||
6 | 6 | * without any other side-effects. |
7 | 7 | */ |
8 | 8 | |
9 | -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); |
|
9 | +set_include_path(dirname(__FILE__).PATH_SEPARATOR.get_include_path()); |
|
10 | 10 | |
11 | 11 | // vim: et sw=4 sts=4 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | * This is a stub include that automatically configures the include path. |
5 | 5 | */ |
6 | 6 | |
7 | -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); |
|
7 | +set_include_path(dirname(__FILE__).PATH_SEPARATOR.get_include_path()); |
|
8 | 8 | require_once 'HTMLPurifier/Bootstrap.php'; |
9 | 9 | require_once 'HTMLPurifier.autoload.php'; |
10 | 10 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * Emulation layer for code that used kses(), substituting in HTML Purifier. |
6 | 6 | */ |
7 | 7 | |
8 | -require_once dirname(__FILE__) . '/HTMLPurifier.auto.php'; |
|
8 | +require_once dirname(__FILE__).'/HTMLPurifier.auto.php'; |
|
9 | 9 | |
10 | 10 | function kses($string, $allowed_html, $allowed_protocols = null) |
11 | 11 | { |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | $allowed_elements = array(); |
14 | 14 | $allowed_attributes = array(); |
15 | 15 | foreach ($allowed_html as $element => $attributes) { |
16 | - $allowed_elements[$element] = true; |
|
16 | + $allowed_elements[ $element ] = true; |
|
17 | 17 | foreach ($attributes as $attribute => $x) { |
18 | - $allowed_attributes["$element.$attribute"] = true; |
|
18 | + $allowed_attributes[ "$element.$attribute" ] = true; |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | $config->set('HTML.AllowedElements', $allowed_elements); |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | public function addFilter($filter) |
126 | 126 | { |
127 | 127 | trigger_error( |
128 | - 'HTMLPurifier->addFilter() is deprecated, use configuration directives' . |
|
128 | + 'HTMLPurifier->addFilter() is deprecated, use configuration directives'. |
|
129 | 129 | ' in the Filter namespace or Filter.Custom', |
130 | 130 | E_USER_WARNING |
131 | 131 | ); |
132 | - $this->filters[] = $filter; |
|
132 | + $this->filters[ ] = $filter; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | |
179 | 179 | // setup filters |
180 | 180 | $filter_flags = $config->getBatch('Filter'); |
181 | - $custom_filters = $filter_flags['Custom']; |
|
182 | - unset($filter_flags['Custom']); |
|
181 | + $custom_filters = $filter_flags[ 'Custom' ]; |
|
182 | + unset($filter_flags[ 'Custom' ]); |
|
183 | 183 | $filters = array(); |
184 | 184 | foreach ($filter_flags as $filter => $flag) { |
185 | 185 | if (!$flag) { |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | continue; |
190 | 190 | } |
191 | 191 | $class = "HTMLPurifier_Filter_$filter"; |
192 | - $filters[] = new $class; |
|
192 | + $filters[ ] = new $class; |
|
193 | 193 | } |
194 | 194 | foreach ($custom_filters as $filter) { |
195 | 195 | // maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat |
196 | - $filters[] = $filter; |
|
196 | + $filters[ ] = $filter; |
|
197 | 197 | } |
198 | 198 | $filters = array_merge($filters, $this->filters); |
199 | 199 | // maybe prepare(), but later |
200 | 200 | |
201 | 201 | for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) { |
202 | - $html = $filters[$i]->preFilter($html, $config, $context); |
|
202 | + $html = $filters[ $i ]->preFilter($html, $config, $context); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // purified HTML |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | ); |
221 | 221 | |
222 | 222 | for ($i = $filter_size - 1; $i >= 0; $i--) { |
223 | - $html = $filters[$i]->postFilter($html, $config, $context); |
|
223 | + $html = $filters[ $i ]->postFilter($html, $config, $context); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | $html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context); |
227 | - $this->context =& $context; |
|
227 | + $this->context = & $context; |
|
228 | 228 | return $html; |
229 | 229 | } |
230 | 230 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | { |
242 | 242 | $context_array = array(); |
243 | 243 | foreach ($array_of_html as $key => $html) { |
244 | - $array_of_html[$key] = $this->purify($html, $config); |
|
245 | - $context_array[$key] = $this->context; |
|
244 | + $array_of_html[ $key ] = $this->purify($html, $config); |
|
245 | + $context_array[ $key ] = $this->context; |
|
246 | 246 | } |
247 | 247 | $this->context = $context_array; |
248 | 248 | return $array_of_html; |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | $nodes = array($level => new HTMLPurifier_Queue(array($node))); |
95 | 95 | $closingNodes = array(); |
96 | 96 | do { |
97 | - while (!$nodes[$level]->isEmpty()) { |
|
98 | - $node = $nodes[$level]->shift(); // FIFO |
|
97 | + while (!$nodes[ $level ]->isEmpty()) { |
|
98 | + $node = $nodes[ $level ]->shift(); // FIFO |
|
99 | 99 | $collect = $level > 0 ? true : false; |
100 | 100 | $needEndingTag = $this->createStartNode($node, $tokens, $collect); |
101 | 101 | if ($needEndingTag) { |
102 | - $closingNodes[$level][] = $node; |
|
102 | + $closingNodes[ $level ][ ] = $node; |
|
103 | 103 | } |
104 | 104 | if ($node->childNodes && $node->childNodes->length) { |
105 | 105 | $level++; |
106 | - $nodes[$level] = new HTMLPurifier_Queue(); |
|
106 | + $nodes[ $level ] = new HTMLPurifier_Queue(); |
|
107 | 107 | foreach ($node->childNodes as $childNode) { |
108 | - $nodes[$level]->push($childNode); |
|
108 | + $nodes[ $level ]->push($childNode); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | $level--; |
113 | - if ($level && isset($closingNodes[$level])) { |
|
114 | - while ($node = array_pop($closingNodes[$level])) { |
|
113 | + if ($level && isset($closingNodes[ $level ])) { |
|
114 | + while ($node = array_pop($closingNodes[ $level ])) { |
|
115 | 115 | $this->createEndNode($node, $tokens); |
116 | 116 | } |
117 | 117 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | // but we're not getting the character reference nodes because |
134 | 134 | // those should have been preprocessed |
135 | 135 | if ($node->nodeType === XML_TEXT_NODE) { |
136 | - $tokens[] = $this->factory->createText($node->data); |
|
136 | + $tokens[ ] = $this->factory->createText($node->data); |
|
137 | 137 | return false; |
138 | 138 | } elseif ($node->nodeType === XML_CDATA_SECTION_NODE) { |
139 | 139 | // undo libxml's special treatment of <script> and <style> tags |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
154 | - $tokens[] = $this->factory->createText($this->parseData($data)); |
|
154 | + $tokens[ ] = $this->factory->createText($this->parseData($data)); |
|
155 | 155 | return false; |
156 | 156 | } elseif ($node->nodeType === XML_COMMENT_NODE) { |
157 | 157 | // this is code is only invoked for comments in script/style in versions |
158 | 158 | // of libxml pre-2.6.28 (regular comments, of course, are still |
159 | 159 | // handled regularly) |
160 | - $tokens[] = $this->factory->createComment($node->data); |
|
160 | + $tokens[ ] = $this->factory->createComment($node->data); |
|
161 | 161 | return false; |
162 | 162 | } elseif ($node->nodeType !== XML_ELEMENT_NODE) { |
163 | 163 | // not-well tested: there may be other nodes we have to grab |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | // We still have to make sure that the element actually IS empty |
170 | 170 | if (!$node->childNodes->length) { |
171 | 171 | if ($collect) { |
172 | - $tokens[] = $this->factory->createEmpty($node->tagName, $attr); |
|
172 | + $tokens[ ] = $this->factory->createEmpty($node->tagName, $attr); |
|
173 | 173 | } |
174 | 174 | return false; |
175 | 175 | } else { |
176 | 176 | if ($collect) { |
177 | - $tokens[] = $this->factory->createStart( |
|
177 | + $tokens[ ] = $this->factory->createStart( |
|
178 | 178 | $tag_name = $node->tagName, // somehow, it get's dropped |
179 | 179 | $attr |
180 | 180 | ); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function createEndNode($node, &$tokens) |
191 | 191 | { |
192 | - $tokens[] = $this->factory->createEnd($node->tagName); |
|
192 | + $tokens[ ] = $this->factory->createEnd($node->tagName); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | $array = array(); |
211 | 211 | foreach ($node_map as $attr) { |
212 | - $array[$attr->name] = $attr->value; |
|
212 | + $array[ $attr->name ] = $attr->value; |
|
213 | 213 | } |
214 | 214 | return $array; |
215 | 215 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function callbackUndoCommentSubst($matches) |
233 | 233 | { |
234 | - return '<!--' . strtr($matches[1], array('&' => '&', '<' => '<')) . $matches[2]; |
|
234 | + return '<!--'.strtr($matches[ 1 ], array('&' => '&', '<' => '<')).$matches[ 2 ]; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function callbackArmorCommentEntities($matches) |
244 | 244 | { |
245 | - return '<!--' . str_replace('&', '&', $matches[1]) . $matches[2]; |
|
245 | + return '<!--'.str_replace('&', '&', $matches[ 1 ]).$matches[ 2 ]; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | if (!empty($def->doctype->dtdPublic) || !empty($def->doctype->dtdSystem)) { |
261 | 261 | $ret .= '<!DOCTYPE html '; |
262 | 262 | if (!empty($def->doctype->dtdPublic)) { |
263 | - $ret .= 'PUBLIC "' . $def->doctype->dtdPublic . '" '; |
|
263 | + $ret .= 'PUBLIC "'.$def->doctype->dtdPublic.'" '; |
|
264 | 264 | } |
265 | 265 | if (!empty($def->doctype->dtdSystem)) { |
266 | - $ret .= '"' . $def->doctype->dtdSystem . '" '; |
|
266 | + $ret .= '"'.$def->doctype->dtdSystem.'" '; |
|
267 | 267 | } |
268 | 268 | $ret .= '>'; |
269 | 269 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $ret .= '<html><head>'; |
272 | 272 | $ret .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; |
273 | 273 | // No protection if $html contains a stray </div>! |
274 | - $ret .= '</head><body>' . $html . '</body></html>'; |
|
274 | + $ret .= '</head><body>'.$html.'</body></html>'; |
|
275 | 275 | return $ret; |
276 | 276 | } |
277 | 277 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function scriptCallback($matches) |
32 | 32 | { |
33 | - return $matches[1] . htmlspecialchars($matches[2], ENT_COMPAT, 'UTF-8') . $matches[3]; |
|
33 | + return $matches[ 1 ].htmlspecialchars($matches[ 2 ], ENT_COMPAT, 'UTF-8').$matches[ 3 ]; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $e = false; |
87 | 87 | if ($config->get('Core.CollectErrors')) { |
88 | - $e =& $context->get('ErrorCollector'); |
|
88 | + $e = & $context->get('ErrorCollector'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // for testing synchronization |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | if ($maintain_line_numbers) { |
100 | 100 | // $rcursor, however, is always at the start of a token. |
101 | - $rcursor = $cursor - (int)$inside_tag; |
|
101 | + $rcursor = $cursor - (int) $inside_tag; |
|
102 | 102 | |
103 | 103 | // Column number is cheap, so we calculate it every round. |
104 | 104 | // We're interested at the *end* of the newline string, so |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $token->rawPosition($current_line, $current_col); |
142 | 142 | $current_line += $this->substrCount($html, $nl, $cursor, $position_next_lt - $cursor); |
143 | 143 | } |
144 | - $array[] = $token; |
|
144 | + $array[ ] = $token; |
|
145 | 145 | $cursor = $position_next_lt + 1; |
146 | 146 | $inside_tag = true; |
147 | 147 | continue; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ($maintain_line_numbers) { |
165 | 165 | $token->rawPosition($current_line, $current_col); |
166 | 166 | } |
167 | - $array[] = $token; |
|
167 | + $array[ ] = $token; |
|
168 | 168 | break; |
169 | 169 | } elseif ($inside_tag && $position_next_gt !== false) { |
170 | 170 | // We are in tag and it is well formed |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $token->rawPosition($current_line, $current_col); |
217 | 217 | $current_line += $this->substrCount($html, $nl, $cursor, $strlen_segment); |
218 | 218 | } |
219 | - $array[] = $token; |
|
219 | + $array[ ] = $token; |
|
220 | 220 | $cursor = $end ? $position_comment_end : $position_comment_end + 3; |
221 | 221 | $inside_tag = false; |
222 | 222 | continue; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $token->rawPosition($current_line, $current_col); |
232 | 232 | $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor); |
233 | 233 | } |
234 | - $array[] = $token; |
|
234 | + $array[ ] = $token; |
|
235 | 235 | $inside_tag = false; |
236 | 236 | $cursor = $position_next_gt + 1; |
237 | 237 | continue; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // Check leading character is alnum, if not, we may |
241 | 241 | // have accidently grabbed an emoticon. Translate into |
242 | 242 | // text and go our merry way |
243 | - if (!ctype_alpha($segment[0])) { |
|
243 | + if (!ctype_alpha($segment[ 0 ])) { |
|
244 | 244 | // XML: $segment[0] !== '_' && $segment[0] !== ':' |
245 | 245 | if ($e) { |
246 | 246 | $e->send(E_NOTICE, 'Lexer: Unescaped lt'); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $token->rawPosition($current_line, $current_col); |
251 | 251 | $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor); |
252 | 252 | } |
253 | - $array[] = $token; |
|
253 | + $array[ ] = $token; |
|
254 | 254 | $inside_tag = false; |
255 | 255 | continue; |
256 | 256 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $token->rawPosition($current_line, $current_col); |
279 | 279 | $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor); |
280 | 280 | } |
281 | - $array[] = $token; |
|
281 | + $array[ ] = $token; |
|
282 | 282 | $inside_tag = false; |
283 | 283 | $cursor = $position_next_gt + 1; |
284 | 284 | continue; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $token->rawPosition($current_line, $current_col); |
313 | 313 | $current_line += $this->substrCount($html, $nl, $cursor, $position_next_gt - $cursor); |
314 | 314 | } |
315 | - $array[] = $token; |
|
315 | + $array[ ] = $token; |
|
316 | 316 | $cursor = $position_next_gt + 1; |
317 | 317 | $inside_tag = false; |
318 | 318 | continue; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | $token = new |
325 | 325 | HTMLPurifier_Token_Text( |
326 | - '<' . |
|
326 | + '<'. |
|
327 | 327 | $this->parseData( |
328 | 328 | substr($html, $cursor) |
329 | 329 | ) |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $token->rawPosition($current_line, $current_col); |
333 | 333 | } |
334 | 334 | // no cursor scroll? Hmm... |
335 | - $array[] = $token; |
|
335 | + $array[ ] = $token; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | break; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function parseAttributeString($string, $config, $context) |
377 | 377 | { |
378 | - $string = (string)$string; // quick typecast |
|
378 | + $string = (string) $string; // quick typecast |
|
379 | 379 | |
380 | 380 | if ($string == '') { |
381 | 381 | return array(); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | $e = false; |
385 | 385 | if ($config->get('Core.CollectErrors')) { |
386 | - $e =& $context->get('ErrorCollector'); |
|
386 | + $e = & $context->get('ErrorCollector'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | // let's see if we can abort as quickly as possible |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | if (!$quoted_value) { |
407 | 407 | return array($key => ''); |
408 | 408 | } |
409 | - $first_char = @$quoted_value[0]; |
|
410 | - $last_char = @$quoted_value[strlen($quoted_value) - 1]; |
|
409 | + $first_char = @$quoted_value[ 0 ]; |
|
410 | + $last_char = @$quoted_value[ strlen($quoted_value) - 1 ]; |
|
411 | 411 | |
412 | 412 | $same_quote = ($first_char == $last_char); |
413 | 413 | $open_quote = ($first_char == '"' || $first_char == "'"); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $key_begin = $cursor; //we're currently at the start of the key |
455 | 455 | |
456 | 456 | // scroll past all characters that are the key (not whitespace or =) |
457 | - $cursor += strcspn($string, $this->_whitespace . '=', $cursor); |
|
457 | + $cursor += strcspn($string, $this->_whitespace.'=', $cursor); |
|
458 | 458 | |
459 | 459 | $key_end = $cursor; // now at the end of the key |
460 | 460 | |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | $cursor += strspn($string, $this->_whitespace, $cursor); |
473 | 473 | |
474 | 474 | if ($cursor >= $size) { |
475 | - $array[$key] = $key; |
|
475 | + $array[ $key ] = $key; |
|
476 | 476 | break; |
477 | 477 | } |
478 | 478 | |
479 | 479 | // if the next character is an equal sign, we've got a regular |
480 | 480 | // pair, otherwise, it's a bool attribute |
481 | - $first_char = @$string[$cursor]; |
|
481 | + $first_char = @$string[ $cursor ]; |
|
482 | 482 | |
483 | 483 | if ($first_char == '=') { |
484 | 484 | // key="value" |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | $cursor += strspn($string, $this->_whitespace, $cursor); |
488 | 488 | |
489 | 489 | if ($cursor === false) { |
490 | - $array[$key] = ''; |
|
490 | + $array[ $key ] = ''; |
|
491 | 491 | break; |
492 | 492 | } |
493 | 493 | |
494 | 494 | // we might be in front of a quote right now |
495 | 495 | |
496 | - $char = @$string[$cursor]; |
|
496 | + $char = @$string[ $cursor ]; |
|
497 | 497 | |
498 | 498 | if ($char == '"' || $char == "'") { |
499 | 499 | // it's quoted, end bound is $char |
@@ -518,12 +518,12 @@ discard block |
||
518 | 518 | if ($value === false) { |
519 | 519 | $value = ''; |
520 | 520 | } |
521 | - $array[$key] = $this->parseData($value); |
|
521 | + $array[ $key ] = $this->parseData($value); |
|
522 | 522 | $cursor++; |
523 | 523 | } else { |
524 | 524 | // boolattr |
525 | 525 | if ($key !== '') { |
526 | - $array[$key] = $key; |
|
526 | + $array[ $key ] = $key; |
|
527 | 527 | } else { |
528 | 528 | // purely theoretical |
529 | 529 | if ($e) { |
@@ -60,47 +60,46 @@ |
||
60 | 60 | $prepend_style = ''; |
61 | 61 | |
62 | 62 | // handle color transform |
63 | - if (isset($attr['color'])) { |
|
64 | - $prepend_style .= 'color:' . $attr['color'] . ';'; |
|
65 | - unset($attr['color']); |
|
63 | + if (isset($attr[ 'color' ])) { |
|
64 | + $prepend_style .= 'color:'.$attr[ 'color' ].';'; |
|
65 | + unset($attr[ 'color' ]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // handle face transform |
69 | - if (isset($attr['face'])) { |
|
70 | - $prepend_style .= 'font-family:' . $attr['face'] . ';'; |
|
71 | - unset($attr['face']); |
|
69 | + if (isset($attr[ 'face' ])) { |
|
70 | + $prepend_style .= 'font-family:'.$attr[ 'face' ].';'; |
|
71 | + unset($attr[ 'face' ]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // handle size transform |
75 | - if (isset($attr['size'])) { |
|
75 | + if (isset($attr[ 'size' ])) { |
|
76 | 76 | // normalize large numbers |
77 | - if ($attr['size'] !== '') { |
|
78 | - if ($attr['size']{0} == '+' || $attr['size']{0} == '-') { |
|
79 | - $size = (int)$attr['size']; |
|
77 | + if ($attr[ 'size' ] !== '') { |
|
78 | + if ($attr[ 'size' ]{0} == '+' || $attr[ 'size' ]{0} == '-') { |
|
79 | + $size = (int) $attr[ 'size' ]; |
|
80 | 80 | if ($size < -2) { |
81 | - $attr['size'] = '-2'; |
|
81 | + $attr[ 'size' ] = '-2'; |
|
82 | 82 | } |
83 | 83 | if ($size > 4) { |
84 | - $attr['size'] = '+4'; |
|
84 | + $attr[ 'size' ] = '+4'; |
|
85 | 85 | } |
86 | 86 | } else { |
87 | - $size = (int)$attr['size']; |
|
87 | + $size = (int) $attr[ 'size' ]; |
|
88 | 88 | if ($size > 7) { |
89 | - $attr['size'] = '7'; |
|
89 | + $attr[ 'size' ] = '7'; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | - if (isset($this->_size_lookup[$attr['size']])) { |
|
94 | - $prepend_style .= 'font-size:' . |
|
95 | - $this->_size_lookup[$attr['size']] . ';'; |
|
93 | + if (isset($this->_size_lookup[ $attr[ 'size' ] ])) { |
|
94 | + $prepend_style .= 'font-size:'. |
|
95 | + $this->_size_lookup[ $attr[ 'size' ] ].';'; |
|
96 | 96 | } |
97 | - unset($attr['size']); |
|
97 | + unset($attr[ 'size' ]); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | if ($prepend_style) { |
101 | - $attr['style'] = isset($attr['style']) ? |
|
102 | - $prepend_style . $attr['style'] : |
|
103 | - $prepend_style; |
|
101 | + $attr[ 'style' ] = isset($attr[ 'style' ]) ? |
|
102 | + $prepend_style.$attr[ 'style' ] : $prepend_style; |
|
104 | 103 | } |
105 | 104 | |
106 | 105 | $new_tag = clone $tag; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function get($name) |
40 | 40 | { |
41 | 41 | if ($this->has($name)) { |
42 | - return $this->data[$name]; |
|
42 | + return $this->data[ $name ]; |
|
43 | 43 | } |
44 | 44 | // possible performance bottleneck, convert to iterative if necessary |
45 | 45 | if ($this->parent) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function set($name, $value) |
57 | 57 | { |
58 | - $this->data[$name] = $value; |
|
58 | + $this->data[ $name ] = $value; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($name == null) { |
79 | 79 | $this->data = array(); |
80 | 80 | } else { |
81 | - unset($this->data[$name]); |
|
81 | + unset($this->data[ $name ]); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 |