@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | public function validateToken($token, $config, $context) |
19 | 19 | { |
20 | 20 | $definition = $config->getHTMLDefinition(); |
21 | - $e =& $context->get('ErrorCollector', true); |
|
21 | + $e = & $context->get('ErrorCollector', true); |
|
22 | 22 | |
23 | 23 | // initialize IDAccumulator if necessary |
24 | - $ok =& $context->get('IDAccumulator', true); |
|
24 | + $ok = & $context->get('IDAccumulator', true); |
|
25 | 25 | if (!$ok) { |
26 | 26 | $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context); |
27 | 27 | $context->register('IDAccumulator', $id_accumulator); |
28 | 28 | } |
29 | 29 | |
30 | 30 | // initialize CurrentToken if necessary |
31 | - $current_token =& $context->get('CurrentToken', true); |
|
31 | + $current_token = & $context->get('CurrentToken', true); |
|
32 | 32 | if (!$current_token) { |
33 | 33 | $context->register('CurrentToken', $token); |
34 | 34 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | // do local transformations only applicable to this element (pre) |
61 | 61 | // ex. <p align="right"> to <p style="text-align:right;"> |
62 | - foreach ($definition->info[$token->name]->attr_transform_pre as $transform) { |
|
62 | + foreach ($definition->info[ $token->name ]->attr_transform_pre as $transform) { |
|
63 | 63 | $attr = $transform->transform($o = $attr, $config, $context); |
64 | 64 | if ($e) { |
65 | 65 | if ($attr != $o) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // create alias to this element's attribute definition array, see |
72 | 72 | // also $d_defs (global attribute definition array) |
73 | 73 | // DEFINITION CALL |
74 | - $defs = $definition->info[$token->name]->attr; |
|
74 | + $defs = $definition->info[ $token->name ]->attr; |
|
75 | 75 | |
76 | 76 | $attr_key = false; |
77 | 77 | $context->register('CurrentAttr', $attr_key); |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | foreach ($attr as $attr_key => $value) { |
82 | 82 | |
83 | 83 | // call the definition |
84 | - if (isset($defs[$attr_key])) { |
|
84 | + if (isset($defs[ $attr_key ])) { |
|
85 | 85 | // there is a local definition defined |
86 | - if ($defs[$attr_key] === false) { |
|
86 | + if ($defs[ $attr_key ] === false) { |
|
87 | 87 | // We've explicitly been told not to allow this element. |
88 | 88 | // This is usually when there's a global definition |
89 | 89 | // that must be overridden. |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | $result = false; |
93 | 93 | } else { |
94 | 94 | // validate according to the element's definition |
95 | - $result = $defs[$attr_key]->validate( |
|
95 | + $result = $defs[ $attr_key ]->validate( |
|
96 | 96 | $value, |
97 | 97 | $config, |
98 | 98 | $context |
99 | 99 | ); |
100 | 100 | } |
101 | - } elseif (isset($d_defs[$attr_key])) { |
|
101 | + } elseif (isset($d_defs[ $attr_key ])) { |
|
102 | 102 | // there is a global definition defined, validate according |
103 | 103 | // to the global definition |
104 | - $result = $d_defs[$attr_key]->validate( |
|
104 | + $result = $d_defs[ $attr_key ]->validate( |
|
105 | 105 | $value, |
106 | 106 | $config, |
107 | 107 | $context |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | // remove the attribute |
123 | - unset($attr[$attr_key]); |
|
123 | + unset($attr[ $attr_key ]); |
|
124 | 124 | } elseif (is_string($result)) { |
125 | 125 | // generally, if a substitution is happening, there |
126 | 126 | // was some sort of implicit correction going on. We'll |
127 | 127 | // delegate it to the attribute classes to say exactly what. |
128 | 128 | |
129 | 129 | // simple substitution |
130 | - $attr[$attr_key] = $result; |
|
130 | + $attr[ $attr_key ] = $result; |
|
131 | 131 | } else { |
132 | 132 | // nothing happens |
133 | 133 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | // local (error reporting untested) |
157 | - foreach ($definition->info[$token->name]->attr_transform_post as $transform) { |
|
157 | + foreach ($definition->info[ $token->name ]->attr_transform_post as $transform) { |
|
158 | 158 | $attr = $transform->transform($o = $attr, $config, $context); |
159 | 159 | if ($e) { |
160 | 160 | if ($attr != $o) { |
@@ -25,23 +25,23 @@ discard block |
||
25 | 25 | { |
26 | 26 | // unreserved letters, ought to const-ify |
27 | 27 | for ($i = 48; $i <= 57; $i++) { // digits |
28 | - $this->preserve[$i] = true; |
|
28 | + $this->preserve[ $i ] = true; |
|
29 | 29 | } |
30 | 30 | for ($i = 65; $i <= 90; $i++) { // upper-case |
31 | - $this->preserve[$i] = true; |
|
31 | + $this->preserve[ $i ] = true; |
|
32 | 32 | } |
33 | 33 | for ($i = 97; $i <= 122; $i++) { // lower-case |
34 | - $this->preserve[$i] = true; |
|
34 | + $this->preserve[ $i ] = true; |
|
35 | 35 | } |
36 | - $this->preserve[45] = true; // Dash - |
|
37 | - $this->preserve[46] = true; // Period . |
|
38 | - $this->preserve[95] = true; // Underscore _ |
|
39 | - $this->preserve[126]= true; // Tilde ~ |
|
36 | + $this->preserve[ 45 ] = true; // Dash - |
|
37 | + $this->preserve[ 46 ] = true; // Period . |
|
38 | + $this->preserve[ 95 ] = true; // Underscore _ |
|
39 | + $this->preserve[ 126 ] = true; // Tilde ~ |
|
40 | 40 | |
41 | 41 | // extra letters not to escape |
42 | 42 | if ($preserve !== false) { |
43 | 43 | for ($i = 0, $c = strlen($preserve); $i < $c; $i++) { |
44 | - $this->preserve[ord($preserve[$i])] = true; |
|
44 | + $this->preserve[ ord($preserve[ $i ]) ] = true; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | { |
61 | 61 | $ret = ''; |
62 | 62 | for ($i = 0, $c = strlen($string); $i < $c; $i++) { |
63 | - if ($string[$i] !== '%' && !isset($this->preserve[$int = ord($string[$i])])) { |
|
64 | - $ret .= '%' . sprintf('%02X', $int); |
|
63 | + if ($string[ $i ] !== '%' && !isset($this->preserve[ $int = ord($string[ $i ]) ])) { |
|
64 | + $ret .= '%'.sprintf('%02X', $int); |
|
65 | 65 | } else { |
66 | - $ret .= $string[$i]; |
|
66 | + $ret .= $string[ $i ]; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return $ret; |
@@ -87,22 +87,22 @@ discard block |
||
87 | 87 | foreach ($parts as $part) { |
88 | 88 | $length = strlen($part); |
89 | 89 | if ($length < 2) { |
90 | - $ret .= '%25' . $part; |
|
90 | + $ret .= '%25'.$part; |
|
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | $encoding = substr($part, 0, 2); |
94 | 94 | $text = substr($part, 2); |
95 | 95 | if (!ctype_xdigit($encoding)) { |
96 | - $ret .= '%25' . $part; |
|
96 | + $ret .= '%25'.$part; |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | $int = hexdec($encoding); |
100 | - if (isset($this->preserve[$int])) { |
|
101 | - $ret .= chr($int) . $text; |
|
100 | + if (isset($this->preserve[ $int ])) { |
|
101 | + $ret .= chr($int).$text; |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | $encoding = strtoupper($encoding); |
105 | - $ret .= '%' . $encoding . $text; |
|
105 | + $ret .= '%'.$encoding.$text; |
|
106 | 106 | } |
107 | 107 | return $ret; |
108 | 108 | } |
@@ -41,12 +41,12 @@ |
||
41 | 41 | list($key, $typecode) = explode('=', $type, 2); |
42 | 42 | if ($key !== 'type') { |
43 | 43 | // invalid key, tack it back on encoded |
44 | - $uri->path .= '%3B' . $type; |
|
44 | + $uri->path .= '%3B'.$type; |
|
45 | 45 | } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') { |
46 | 46 | $type_ret = ";type=$typecode"; |
47 | 47 | } |
48 | 48 | } else { |
49 | - $uri->path .= '%3B' . $type; |
|
49 | + $uri->path .= '%3B'.$type; |
|
50 | 50 | } |
51 | 51 | $uri->path = str_replace(';', '%3B', $uri->path); |
52 | 52 | $uri->path .= $type_ret; |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | } else { |
67 | - $data = $result[0]; |
|
67 | + $data = $result[ 0 ]; |
|
68 | 68 | } |
69 | - if ($content_type !== null && empty($this->allowed_types[$content_type])) { |
|
69 | + if ($content_type !== null && empty($this->allowed_types[ $content_type ])) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | if ($charset !== null) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if ($info == false) { |
95 | 95 | return false; |
96 | 96 | } |
97 | - $image_code = $info[2]; |
|
97 | + $image_code = $info[ 2 ]; |
|
98 | 98 | } else { |
99 | 99 | trigger_error("could not find exif_imagetype or getimagesize functions", E_USER_ERROR); |
100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if ($real_content_type != $content_type) { |
103 | 103 | // we're nice guys; if the content type is something else we |
104 | 104 | // support, change it over |
105 | - if (empty($this->allowed_types[$real_content_type])) { |
|
105 | + if (empty($this->allowed_types[ $real_content_type ])) { |
|
106 | 106 | return false; |
107 | 107 | } |
108 | 108 | $content_type = $real_content_type; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $uri->port = null; |
114 | 114 | $uri->fragment = null; |
115 | 115 | $uri->query = null; |
116 | - $uri->path = "$content_type;base64," . base64_encode($raw_data); |
|
116 | + $uri->path = "$content_type;base64,".base64_encode($raw_data); |
|
117 | 117 | return true; |
118 | 118 | } |
119 | 119 |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getChild($type, $id) |
56 | 56 | { |
57 | - if (!isset($this->children[$type][$id])) { |
|
58 | - $this->children[$type][$id] = new HTMLPurifier_ErrorStruct(); |
|
59 | - $this->children[$type][$id]->type = $type; |
|
57 | + if (!isset($this->children[ $type ][ $id ])) { |
|
58 | + $this->children[ $type ][ $id ] = new HTMLPurifier_ErrorStruct(); |
|
59 | + $this->children[ $type ][ $id ]->type = $type; |
|
60 | 60 | } |
61 | - return $this->children[$type][$id]; |
|
61 | + return $this->children[ $type ][ $id ]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function addError($severity, $message) |
69 | 69 | { |
70 | - $this->errors[] = array($severity, $message); |
|
70 | + $this->errors[ ] = array($severity, $message); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | $tidy->parseString( |
107 | 107 | $html, |
108 | 108 | array( |
109 | - 'indent'=> true, |
|
110 | - 'output-xhtml' => $this->_xhtml, |
|
111 | - 'show-body-only' => true, |
|
112 | - 'indent-spaces' => 2, |
|
113 | - 'wrap' => 68, |
|
109 | + 'indent'=> true, |
|
110 | + 'output-xhtml' => $this->_xhtml, |
|
111 | + 'show-body-only' => true, |
|
112 | + 'indent-spaces' => 2, |
|
113 | + 'wrap' => 68, |
|
114 | 114 | ), |
115 | 115 | 'utf8' |
116 | 116 | ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name']] = $token->attr['value']; |
169 | 169 | } |
170 | 170 | $attr = $this->generateAttributes($token->attr, $token->name); |
171 | - return '<' . $token->name . ($attr ? ' ' : '') . $attr . |
|
171 | + return '<' . $token->name . ($attr ? ' ' : '') . $attr . |
|
172 | 172 | ( $this->_xhtml ? ' /': '' ) // <br /> v. <br> |
173 | 173 | . '>'; |
174 | 174 |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | // Basic algorithm |
90 | 90 | $html = ''; |
91 | 91 | for ($i = 0, $size = count($tokens); $i < $size; $i++) { |
92 | - if ($this->_scriptFix && $tokens[$i]->name === 'script' |
|
93 | - && $i + 2 < $size && $tokens[$i+2] instanceof HTMLPurifier_Token_End) { |
|
92 | + if ($this->_scriptFix && $tokens[ $i ]->name === 'script' |
|
93 | + && $i + 2 < $size && $tokens[ $i + 2 ] instanceof HTMLPurifier_Token_End) { |
|
94 | 94 | // script special case |
95 | 95 | // the contents of the script block must be ONE token |
96 | 96 | // for this to work. |
97 | - $html .= $this->generateFromToken($tokens[$i++]); |
|
98 | - $html .= $this->generateScriptFromToken($tokens[$i++]); |
|
97 | + $html .= $this->generateFromToken($tokens[ $i++ ]); |
|
98 | + $html .= $this->generateScriptFromToken($tokens[ $i++ ]); |
|
99 | 99 | } |
100 | - $html .= $this->generateFromToken($tokens[$i]); |
|
100 | + $html .= $this->generateFromToken($tokens[ $i ]); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | // Tidy cleanup |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | $flash = new stdclass(); |
150 | 150 | $flash->attr = $token->attr; |
151 | 151 | $flash->param = array(); |
152 | - $this->_flashStack[] = $flash; |
|
152 | + $this->_flashStack[ ] = $flash; |
|
153 | 153 | } |
154 | 154 | } |
155 | - return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>'; |
|
155 | + return '<'.$token->name.($attr ? ' ' : '').$attr.'>'; |
|
156 | 156 | |
157 | 157 | } elseif ($token instanceof HTMLPurifier_Token_End) { |
158 | 158 | $_extra = ''; |
@@ -161,22 +161,22 @@ discard block |
||
161 | 161 | // doesn't do anything for now |
162 | 162 | } |
163 | 163 | } |
164 | - return $_extra . '</' . $token->name . '>'; |
|
164 | + return $_extra.'</'.$token->name.'>'; |
|
165 | 165 | |
166 | 166 | } elseif ($token instanceof HTMLPurifier_Token_Empty) { |
167 | 167 | if ($this->_flashCompat && $token->name == "param" && !empty($this->_flashStack)) { |
168 | - $this->_flashStack[count($this->_flashStack)-1]->param[$token->attr['name']] = $token->attr['value']; |
|
168 | + $this->_flashStack[ count($this->_flashStack) - 1 ]->param[ $token->attr[ 'name' ] ] = $token->attr[ 'value' ]; |
|
169 | 169 | } |
170 | 170 | $attr = $this->generateAttributes($token->attr, $token->name); |
171 | - return '<' . $token->name . ($attr ? ' ' : '') . $attr . |
|
172 | - ( $this->_xhtml ? ' /': '' ) // <br /> v. <br> |
|
171 | + return '<'.$token->name.($attr ? ' ' : '').$attr. |
|
172 | + ($this->_xhtml ? ' /' : '') // <br /> v. <br> |
|
173 | 173 | . '>'; |
174 | 174 | |
175 | 175 | } elseif ($token instanceof HTMLPurifier_Token_Text) { |
176 | 176 | return $this->escape($token->data, ENT_NOQUOTES); |
177 | 177 | |
178 | 178 | } elseif ($token instanceof HTMLPurifier_Token_Comment) { |
179 | - return '<!--' . $token->data . '-->'; |
|
179 | + return '<!--'.$token->data.'-->'; |
|
180 | 180 | } else { |
181 | 181 | return ''; |
182 | 182 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | // Thanks <http://lachy.id.au/log/2005/05/script-comments> |
199 | 199 | $data = preg_replace('#//\s*$#', '', $token->data); |
200 | - return '<!--//--><![CDATA[//><!--' . "\n" . trim($data) . "\n" . '//--><!]]>'; |
|
200 | + return '<!--//--><![CDATA[//><!--'."\n".trim($data)."\n".'//--><!]]>'; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | continue; |
222 | 222 | } |
223 | 223 | // Check if we should minimize the attribute: val="val" -> val |
224 | - if ($element && !empty($this->_def->info[$element]->attr[$key]->minimized)) { |
|
225 | - $html .= $key . ' '; |
|
224 | + if ($element && !empty($this->_def->info[ $element ]->attr[ $key ]->minimized)) { |
|
225 | + $html .= $key.' '; |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $next = false; |
61 | 61 | $deleted = 1; // the current tag |
62 | 62 | for ($i = count($this->inputZipper->back) - 1; $i >= 0; $i--, $deleted++) { |
63 | - $next = $this->inputZipper->back[$i]; |
|
63 | + $next = $this->inputZipper->back[ $i ]; |
|
64 | 64 | if ($next instanceof HTMLPurifier_Token_Text) { |
65 | 65 | if ($next->is_whitespace) { |
66 | 66 | continue; |
67 | 67 | } |
68 | - if ($this->removeNbsp && !isset($this->removeNbspExceptions[$token->name])) { |
|
68 | + if ($this->removeNbsp && !isset($this->removeNbspExceptions[ $token->name ])) { |
|
69 | 69 | $plain = str_replace("\xC2\xA0", "", $next->data); |
70 | 70 | $isWsOrNbsp = $plain === '' || ctype_space($plain); |
71 | 71 | if ($isWsOrNbsp) { |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | } |
78 | 78 | if (!$next || ($next instanceof HTMLPurifier_Token_End && $next->name == $token->name)) { |
79 | 79 | $this->attrValidator->validateToken($token, $this->config, $this->context); |
80 | - $token->armor['ValidateAttributes'] = true; |
|
81 | - if (isset($this->exclude[$token->name])) { |
|
80 | + $token->armor[ 'ValidateAttributes' ] = true; |
|
81 | + if (isset($this->exclude[ $token->name ])) { |
|
82 | 82 | $r = true; |
83 | - foreach ($this->exclude[$token->name] as $elem) { |
|
84 | - if (!isset($token->attr[$elem])) $r = false; |
|
83 | + foreach ($this->exclude[ $token->name ] as $elem) { |
|
84 | + if (!isset($token->attr[ $elem ])) $r = false; |
|
85 | 85 | } |
86 | 86 | if ($r) return; |
87 | 87 | } |
88 | - if (isset($token->attr['id']) || isset($token->attr['name'])) { |
|
88 | + if (isset($token->attr[ 'id' ]) || isset($token->attr[ 'name' ])) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | $token = $deleted + 1; |
92 | 92 | for ($b = 0, $c = count($this->inputZipper->front); $b < $c; $b++) { |
93 | - $prev = $this->inputZipper->front[$b]; |
|
93 | + $prev = $this->inputZipper->front[ $b ]; |
|
94 | 94 | if ($prev instanceof HTMLPurifier_Token_Text && $prev->is_whitespace) { |
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | // This is safe because we removed the token that triggered this. |
100 | - $this->rewindOffset($b+$deleted); |
|
100 | + $this->rewindOffset($b + $deleted); |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | } |
@@ -81,9 +81,13 @@ |
||
81 | 81 | if (isset($this->exclude[$token->name])) { |
82 | 82 | $r = true; |
83 | 83 | foreach ($this->exclude[$token->name] as $elem) { |
84 | - if (!isset($token->attr[$elem])) $r = false; |
|
84 | + if (!isset($token->attr[$elem])) { |
|
85 | + $r = false; |
|
86 | + } |
|
87 | + } |
|
88 | + if ($r) { |
|
89 | + return; |
|
85 | 90 | } |
86 | - if ($r) return; |
|
87 | 91 | } |
88 | 92 | if (isset($token->attr['id']) || isset($token->attr['name'])) { |
89 | 93 | return; |
@@ -62,38 +62,38 @@ |
||
62 | 62 | public function handleElement(&$token) |
63 | 63 | { |
64 | 64 | if ($token->name == 'object') { |
65 | - $this->objectStack[] = $token; |
|
66 | - $this->paramStack[] = array(); |
|
65 | + $this->objectStack[ ] = $token; |
|
66 | + $this->paramStack[ ] = array(); |
|
67 | 67 | $new = array($token); |
68 | 68 | foreach ($this->addParam as $name => $value) { |
69 | - $new[] = new HTMLPurifier_Token_Empty('param', array('name' => $name, 'value' => $value)); |
|
69 | + $new[ ] = new HTMLPurifier_Token_Empty('param', array('name' => $name, 'value' => $value)); |
|
70 | 70 | } |
71 | 71 | $token = $new; |
72 | 72 | } elseif ($token->name == 'param') { |
73 | 73 | $nest = count($this->currentNesting) - 1; |
74 | - if ($nest >= 0 && $this->currentNesting[$nest]->name === 'object') { |
|
74 | + if ($nest >= 0 && $this->currentNesting[ $nest ]->name === 'object') { |
|
75 | 75 | $i = count($this->objectStack) - 1; |
76 | - if (!isset($token->attr['name'])) { |
|
76 | + if (!isset($token->attr[ 'name' ])) { |
|
77 | 77 | $token = false; |
78 | 78 | return; |
79 | 79 | } |
80 | - $n = $token->attr['name']; |
|
80 | + $n = $token->attr[ 'name' ]; |
|
81 | 81 | // We need this fix because YouTube doesn't supply a data |
82 | 82 | // attribute, which we need if a type is specified. This is |
83 | 83 | // *very* Flash specific. |
84 | - if (!isset($this->objectStack[$i]->attr['data']) && |
|
85 | - ($token->attr['name'] == 'movie' || $token->attr['name'] == 'src') |
|
84 | + if (!isset($this->objectStack[ $i ]->attr[ 'data' ]) && |
|
85 | + ($token->attr[ 'name' ] == 'movie' || $token->attr[ 'name' ] == 'src') |
|
86 | 86 | ) { |
87 | - $this->objectStack[$i]->attr['data'] = $token->attr['value']; |
|
87 | + $this->objectStack[ $i ]->attr[ 'data' ] = $token->attr[ 'value' ]; |
|
88 | 88 | } |
89 | 89 | // Check if the parameter is the correct value but has not |
90 | 90 | // already been added |
91 | - if (!isset($this->paramStack[$i][$n]) && |
|
92 | - isset($this->addParam[$n]) && |
|
93 | - $token->attr['name'] === $this->addParam[$n]) { |
|
91 | + if (!isset($this->paramStack[ $i ][ $n ]) && |
|
92 | + isset($this->addParam[ $n ]) && |
|
93 | + $token->attr[ 'name' ] === $this->addParam[ $n ]) { |
|
94 | 94 | // keep token, and add to param stack |
95 | - $this->paramStack[$i][$n] = true; |
|
96 | - } elseif (isset($this->allowedParam[$n])) { |
|
95 | + $this->paramStack[ $i ][ $n ] = true; |
|
96 | + } elseif (isset($this->allowedParam[ $n ])) { |
|
97 | 97 | // keep token, don't do anything to it |
98 | 98 | // (could possibly check for duplicates here) |
99 | 99 | } else { |
@@ -43,14 +43,14 @@ |
||
43 | 43 | // $l = is link |
44 | 44 | for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) { |
45 | 45 | if (!$l) { |
46 | - if ($bits[$i] === '') { |
|
46 | + if ($bits[ $i ] === '') { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | - $token[] = new HTMLPurifier_Token_Text($bits[$i]); |
|
49 | + $token[ ] = new HTMLPurifier_Token_Text($bits[ $i ]); |
|
50 | 50 | } else { |
51 | - $token[] = new HTMLPurifier_Token_Start('a', array('href' => $bits[$i])); |
|
52 | - $token[] = new HTMLPurifier_Token_Text($bits[$i]); |
|
53 | - $token[] = new HTMLPurifier_Token_End('a'); |
|
51 | + $token[ ] = new HTMLPurifier_Token_Start('a', array('href' => $bits[ $i ])); |
|
52 | + $token[ ] = new HTMLPurifier_Token_Text($bits[ $i ]); |
|
53 | + $token[ ] = new HTMLPurifier_Token_End('a'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |