@@ -30,7 +30,7 @@ |
||
| 30 | 30 | ); |
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | - $this->_storage[$name] =& $ref; |
|
| 33 | + $this->_storage[$name] = & $ref; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -164,34 +164,34 @@ |
||
| 164 | 164 | $generator = $this->context->get('Generator'); |
| 165 | 165 | } |
| 166 | 166 | if (isset($value->name)) { |
| 167 | - $subst['$'.$i.'.Name'] = $value->name; |
|
| 167 | + $subst['$' . $i . '.Name'] = $value->name; |
|
| 168 | 168 | } |
| 169 | 169 | if (isset($value->data)) { |
| 170 | - $subst['$'.$i.'.Data'] = $value->data; |
|
| 170 | + $subst['$' . $i . '.Data'] = $value->data; |
|
| 171 | 171 | } |
| 172 | - $subst['$'.$i.'.Compact'] = |
|
| 173 | - $subst['$'.$i.'.Serialized'] = $generator->generateFromToken($value); |
|
| 172 | + $subst['$' . $i . '.Compact'] = |
|
| 173 | + $subst['$' . $i . '.Serialized'] = $generator->generateFromToken($value); |
|
| 174 | 174 | // a more complex algorithm for compact representation |
| 175 | 175 | // could be introduced for all types of tokens. This |
| 176 | 176 | // may need to be factored out into a dedicated class |
| 177 | 177 | if (!empty($value->attr)) { |
| 178 | 178 | $stripped_token = clone $value; |
| 179 | 179 | $stripped_token->attr = array(); |
| 180 | - $subst['$'.$i.'.Compact'] = $generator->generateFromToken($stripped_token); |
|
| 180 | + $subst['$' . $i . '.Compact'] = $generator->generateFromToken($stripped_token); |
|
| 181 | 181 | } |
| 182 | - $subst['$'.$i.'.Line'] = $value->line ? $value->line : 'unknown'; |
|
| 182 | + $subst['$' . $i . '.Line'] = $value->line ? $value->line : 'unknown'; |
|
| 183 | 183 | } |
| 184 | 184 | continue; |
| 185 | 185 | } elseif (is_array($value)) { |
| 186 | 186 | $keys = array_keys($value); |
| 187 | 187 | if (array_keys($keys) === $keys) { |
| 188 | 188 | // list |
| 189 | - $subst['$'.$i] = $this->listify($value); |
|
| 189 | + $subst['$' . $i] = $this->listify($value); |
|
| 190 | 190 | } else { |
| 191 | 191 | // associative array |
| 192 | 192 | // no $i implementation yet, sorry |
| 193 | - $subst['$'.$i.'.Keys'] = $this->listify($keys); |
|
| 194 | - $subst['$'.$i.'.Values'] = $this->listify(array_values($value)); |
|
| 193 | + $subst['$' . $i . '.Keys'] = $this->listify($keys); |
|
| 194 | + $subst['$' . $i . '.Values'] = $this->listify(array_values($value)); |
|
| 195 | 195 | } |
| 196 | 196 | continue; |
| 197 | 197 | } |
@@ -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 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $html = ''; |
| 91 | 91 | for ($i = 0, $size = count($tokens); $i < $size; $i++) { |
| 92 | 92 | if ($this->_scriptFix && $tokens[$i]->name === 'script' |
| 93 | - && $i + 2 < $size && $tokens[$i+2] instanceof HTMLPurifier_Token_End) { |
|
| 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. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | 'utf8' |
| 116 | 116 | ); |
| 117 | 117 | $tidy->cleanRepair(); |
| 118 | - $html = (string) $tidy; // explicit cast necessary |
|
| 118 | + $html = (string)$tidy; // explicit cast necessary |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Normalize newlines to system defined value |
@@ -165,11 +165,11 @@ discard block |
||
| 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 | 171 | return '<' . $token->name . ($attr ? ' ' : '') . $attr . |
| 172 | - ( $this->_xhtml ? ' /': '' ) // <br /> v. <br> |
|
| 172 | + ($this->_xhtml ? ' /' : '') // <br /> v. <br> |
|
| 173 | 173 | . '>'; |
| 174 | 174 | |
| 175 | 175 | } elseif ($token instanceof HTMLPurifier_Token_Text) { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | - $html .= $key.'="'.$this->escape($value).'" '; |
|
| 260 | + $html .= $key . '="' . $this->escape($value) . '" '; |
|
| 261 | 261 | } |
| 262 | 262 | return rtrim($html); |
| 263 | 263 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function toArray($t = NULL) { |
| 48 | 48 | $a = $this->front; |
| 49 | 49 | if ($t !== NULL) $a[] = $t; |
| 50 | - for ($i = count($this->back)-1; $i >= 0; $i--) { |
|
| 50 | + for ($i = count($this->back) - 1; $i >= 0; $i--) { |
|
| 51 | 51 | $a[] = $this->back[$i]; |
| 52 | 52 | } |
| 53 | 53 | return $a; |
@@ -148,7 +148,7 @@ discard block |
||
| 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 | 153 | $r = $replacement[$i]; |
| 154 | 154 | } |
@@ -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 | /** |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | } |
| 149 | 149 | // PHP does some weird parsing when I do |
| 150 | 150 | // $e->$type[$attr], so I have to assign a ref. |
| 151 | - $f =& $e->$type; |
|
| 151 | + $f = & $e->$type; |
|
| 152 | 152 | $f[$attr] = $fix; |
| 153 | 153 | break; |
| 154 | 154 | case 'tag_transform': |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function render($config) |
| 16 | 16 | { |
| 17 | 17 | $ret = ''; |
| 18 | - $this->config =& $config; |
|
| 18 | + $this->config = & $config; |
|
| 19 | 19 | |
| 20 | 20 | $this->def = $config->getHTMLDefinition(); |
| 21 | 21 | |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $line = trim($line); |
| 119 | 119 | } else { |
| 120 | 120 | // Use default declaration |
| 121 | - $state = $this->default; |
|
| 121 | + $state = $this->default; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | if ($single) { |
@@ -324,7 +324,7 @@ |
||
| 324 | 324 | if ($config->get('Core.ConvertDocumentToFragment')) { |
| 325 | 325 | $e = false; |
| 326 | 326 | if ($config->get('Core.CollectErrors')) { |
| 327 | - $e =& $context->get('ErrorCollector'); |
|
| 327 | + $e = & $context->get('ErrorCollector'); |
|
| 328 | 328 | } |
| 329 | 329 | $new_html = $this->extractBody($html); |
| 330 | 330 | if ($e && $new_html != $html) { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | continue; |
| 28 | 28 | } |
| 29 | 29 | $node = $token->toNode(); |
| 30 | - $stack[count($stack)-1]->children[] = $node; |
|
| 30 | + $stack[count($stack) - 1]->children[] = $node; |
|
| 31 | 31 | if ($token instanceof HTMLPurifier_Token_Start) { |
| 32 | 32 | $stack[] = $node; |
| 33 | 33 | } |