@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | if (isset($this->_[HDOM_INFO_INNER])) |
400 | 400 | return $this->_[HDOM_INFO_INNER]; |
401 | 401 | switch ($this->nodetype) { |
402 | - case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
403 | - case HDOM_TYPE_COMMENT: return ''; |
|
404 | - case HDOM_TYPE_UNKNOWN: return ''; |
|
402 | + case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
403 | + case HDOM_TYPE_COMMENT: return ''; |
|
404 | + case HDOM_TYPE_UNKNOWN: return ''; |
|
405 | 405 | } |
406 | 406 | if (strcasecmp($this->tag, 'script') === 0) |
407 | 407 | return ''; |
@@ -640,19 +640,19 @@ discard block |
||
640 | 640 | } |
641 | 641 | |
642 | 642 | switch ($exp) { |
643 | - case '=': |
|
644 | - return ($value === $pattern); |
|
645 | - case '!=': |
|
646 | - return ($value !== $pattern); |
|
647 | - case '^=': |
|
648 | - return preg_match("/^" . preg_quote($pattern, '/') . "/", $value); |
|
649 | - case '$=': |
|
650 | - return preg_match("/" . preg_quote($pattern, '/') . "$/", $value); |
|
651 | - case '*=': |
|
652 | - if ($pattern[0] == '/') { |
|
653 | - return preg_match($pattern, $value); |
|
654 | - } |
|
655 | - return preg_match("/" . $pattern . "/i", $value); |
|
643 | + case '=': |
|
644 | + return ($value === $pattern); |
|
645 | + case '!=': |
|
646 | + return ($value !== $pattern); |
|
647 | + case '^=': |
|
648 | + return preg_match("/^" . preg_quote($pattern, '/') . "/", $value); |
|
649 | + case '$=': |
|
650 | + return preg_match("/" . preg_quote($pattern, '/') . "$/", $value); |
|
651 | + case '*=': |
|
652 | + if ($pattern[0] == '/') { |
|
653 | + return preg_match($pattern, $value); |
|
654 | + } |
|
655 | + return preg_match("/" . $pattern . "/i", $value); |
|
656 | 656 | } |
657 | 657 | return false; |
658 | 658 | } |
@@ -736,11 +736,11 @@ discard block |
||
736 | 736 | return $this->convert_text($this->attr[$name]); |
737 | 737 | } |
738 | 738 | switch ($name) { |
739 | - case 'outertext': return $this->outertext(); |
|
740 | - case 'innertext': return $this->innertext(); |
|
741 | - case 'plaintext': return $this->text(); |
|
742 | - case 'xmltext': return $this->xmltext(); |
|
743 | - default: return array_key_exists($name, $this->attr); |
|
739 | + case 'outertext': return $this->outertext(); |
|
740 | + case 'innertext': return $this->innertext(); |
|
741 | + case 'plaintext': return $this->text(); |
|
742 | + case 'xmltext': return $this->xmltext(); |
|
743 | + default: return array_key_exists($name, $this->attr); |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 |
@@ -96,71 +96,71 @@ discard block |
||
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | switch ($node->name) { |
99 | - case 'tbody': |
|
100 | - $tbody_mode = true; |
|
101 | - // fall through |
|
102 | - case 'tr': |
|
103 | - $content[] = $node; |
|
104 | - $ws_accum =& $content; |
|
105 | - break; |
|
106 | - case 'caption': |
|
107 | - // there can only be one caption! |
|
108 | - if ($caption !== false) break; |
|
109 | - $caption = $node; |
|
110 | - $ws_accum =& $after_caption_ws; |
|
111 | - break; |
|
112 | - case 'thead': |
|
113 | - $tbody_mode = true; |
|
114 | - // XXX This breaks rendering properties with |
|
115 | - // Firefox, which never floats a <thead> to |
|
116 | - // the top. Ever. (Our scheme will float the |
|
117 | - // first <thead> to the top.) So maybe |
|
118 | - // <thead>s that are not first should be |
|
119 | - // turned into <tbody>? Very tricky, indeed. |
|
120 | - if ($thead === false) { |
|
121 | - $thead = $node; |
|
122 | - $ws_accum =& $after_thead_ws; |
|
123 | - } else { |
|
124 | - // Oops, there's a second one! What |
|
125 | - // should we do? Current behavior is to |
|
126 | - // transmutate the first and last entries into |
|
127 | - // tbody tags, and then put into content. |
|
128 | - // Maybe a better idea is to *attach |
|
129 | - // it* to the existing thead or tfoot? |
|
130 | - // We don't do this, because Firefox |
|
131 | - // doesn't float an extra tfoot to the |
|
132 | - // bottom like it does for the first one. |
|
133 | - $node->name = 'tbody'; |
|
134 | - $content[] = $node; |
|
135 | - $ws_accum =& $content; |
|
136 | - } |
|
137 | - break; |
|
138 | - case 'tfoot': |
|
139 | - // see above for some aveats |
|
140 | - $tbody_mode = true; |
|
141 | - if ($tfoot === false) { |
|
142 | - $tfoot = $node; |
|
143 | - $ws_accum =& $after_tfoot_ws; |
|
144 | - } else { |
|
145 | - $node->name = 'tbody'; |
|
146 | - $content[] = $node; |
|
147 | - $ws_accum =& $content; |
|
148 | - } |
|
149 | - break; |
|
150 | - case 'colgroup': |
|
151 | - case 'col': |
|
152 | - $cols[] = $node; |
|
153 | - $ws_accum =& $cols; |
|
154 | - break; |
|
155 | - case '#PCDATA': |
|
156 | - // How is whitespace handled? We treat is as sticky to |
|
157 | - // the *end* of the previous element. So all of the |
|
158 | - // nonsense we have worked on is to keep things |
|
159 | - // together. |
|
160 | - if (!empty($node->is_whitespace)) { |
|
161 | - $ws_accum[] = $node; |
|
162 | - } |
|
163 | - break; |
|
99 | + case 'tbody': |
|
100 | + $tbody_mode = true; |
|
101 | + // fall through |
|
102 | + case 'tr': |
|
103 | + $content[] = $node; |
|
104 | + $ws_accum =& $content; |
|
105 | + break; |
|
106 | + case 'caption': |
|
107 | + // there can only be one caption! |
|
108 | + if ($caption !== false) break; |
|
109 | + $caption = $node; |
|
110 | + $ws_accum =& $after_caption_ws; |
|
111 | + break; |
|
112 | + case 'thead': |
|
113 | + $tbody_mode = true; |
|
114 | + // XXX This breaks rendering properties with |
|
115 | + // Firefox, which never floats a <thead> to |
|
116 | + // the top. Ever. (Our scheme will float the |
|
117 | + // first <thead> to the top.) So maybe |
|
118 | + // <thead>s that are not first should be |
|
119 | + // turned into <tbody>? Very tricky, indeed. |
|
120 | + if ($thead === false) { |
|
121 | + $thead = $node; |
|
122 | + $ws_accum =& $after_thead_ws; |
|
123 | + } else { |
|
124 | + // Oops, there's a second one! What |
|
125 | + // should we do? Current behavior is to |
|
126 | + // transmutate the first and last entries into |
|
127 | + // tbody tags, and then put into content. |
|
128 | + // Maybe a better idea is to *attach |
|
129 | + // it* to the existing thead or tfoot? |
|
130 | + // We don't do this, because Firefox |
|
131 | + // doesn't float an extra tfoot to the |
|
132 | + // bottom like it does for the first one. |
|
133 | + $node->name = 'tbody'; |
|
134 | + $content[] = $node; |
|
135 | + $ws_accum =& $content; |
|
136 | + } |
|
137 | + break; |
|
138 | + case 'tfoot': |
|
139 | + // see above for some aveats |
|
140 | + $tbody_mode = true; |
|
141 | + if ($tfoot === false) { |
|
142 | + $tfoot = $node; |
|
143 | + $ws_accum =& $after_tfoot_ws; |
|
144 | + } else { |
|
145 | + $node->name = 'tbody'; |
|
146 | + $content[] = $node; |
|
147 | + $ws_accum =& $content; |
|
148 | + } |
|
149 | + break; |
|
150 | + case 'colgroup': |
|
151 | + case 'col': |
|
152 | + $cols[] = $node; |
|
153 | + $ws_accum =& $cols; |
|
154 | + break; |
|
155 | + case '#PCDATA': |
|
156 | + // How is whitespace handled? We treat is as sticky to |
|
157 | + // the *end* of the previous element. So all of the |
|
158 | + // nonsense we have worked on is to keep things |
|
159 | + // together. |
|
160 | + if (!empty($node->is_whitespace)) { |
|
161 | + $ws_accum[] = $node; |
|
162 | + } |
|
163 | + break; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -191,25 +191,25 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach($content as $node) { |
193 | 193 | switch ($node->name) { |
194 | - case 'tbody': |
|
195 | - $current_tr_tbody = null; |
|
196 | - $ret[] = $node; |
|
197 | - break; |
|
198 | - case 'tr': |
|
199 | - if ($current_tr_tbody === null) { |
|
200 | - $current_tr_tbody = new HTMLPurifier_Node_Element('tbody'); |
|
201 | - $ret[] = $current_tr_tbody; |
|
202 | - } |
|
203 | - $current_tr_tbody->children[] = $node; |
|
204 | - break; |
|
205 | - case '#PCDATA': |
|
206 | - assert($node->is_whitespace); |
|
207 | - if ($current_tr_tbody === null) { |
|
208 | - $ret[] = $node; |
|
209 | - } else { |
|
210 | - $current_tr_tbody->children[] = $node; |
|
211 | - } |
|
212 | - break; |
|
194 | + case 'tbody': |
|
195 | + $current_tr_tbody = null; |
|
196 | + $ret[] = $node; |
|
197 | + break; |
|
198 | + case 'tr': |
|
199 | + if ($current_tr_tbody === null) { |
|
200 | + $current_tr_tbody = new HTMLPurifier_Node_Element('tbody'); |
|
201 | + $ret[] = $current_tr_tbody; |
|
202 | + } |
|
203 | + $current_tr_tbody->children[] = $node; |
|
204 | + break; |
|
205 | + case '#PCDATA': |
|
206 | + assert($node->is_whitespace); |
|
207 | + if ($current_tr_tbody === null) { |
|
208 | + $ret[] = $node; |
|
209 | + } else { |
|
210 | + $current_tr_tbody->children[] = $node; |
|
211 | + } |
|
212 | + break; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } else { |
@@ -339,15 +339,15 @@ |
||
339 | 339 | } |
340 | 340 | if ($this->options['autooptimize']) { |
341 | 341 | switch($this->db->phptype) { |
342 | - case 'mysql': |
|
343 | - $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | - break; |
|
345 | - case 'pgsql': |
|
346 | - $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | - break; |
|
348 | - default: |
|
349 | - $query = null; |
|
350 | - break; |
|
342 | + case 'mysql': |
|
343 | + $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | + break; |
|
345 | + case 'pgsql': |
|
346 | + $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | + break; |
|
348 | + default: |
|
349 | + $query = null; |
|
350 | + break; |
|
351 | 351 | } |
352 | 352 | if (isset($query)) { |
353 | 353 | $result = $this->db->query($query); |
@@ -339,15 +339,15 @@ |
||
339 | 339 | } |
340 | 340 | if ($this->options['autooptimize']) { |
341 | 341 | switch($this->db->phptype) { |
342 | - case 'mysql': |
|
343 | - $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | - break; |
|
345 | - case 'pgsql': |
|
346 | - $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | - break; |
|
348 | - default: |
|
349 | - $query = null; |
|
350 | - break; |
|
342 | + case 'mysql': |
|
343 | + $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | + break; |
|
345 | + case 'pgsql': |
|
346 | + $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | + break; |
|
348 | + default: |
|
349 | + $query = null; |
|
350 | + break; |
|
351 | 351 | } |
352 | 352 | if (isset($query)) { |
353 | 353 | $result = $this->db->query($query); |
@@ -339,15 +339,15 @@ |
||
339 | 339 | } |
340 | 340 | if ($this->options['autooptimize']) { |
341 | 341 | switch($this->db->phptype) { |
342 | - case 'mysql': |
|
343 | - $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | - break; |
|
345 | - case 'pgsql': |
|
346 | - $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | - break; |
|
348 | - default: |
|
349 | - $query = null; |
|
350 | - break; |
|
342 | + case 'mysql': |
|
343 | + $query = sprintf("OPTIMIZE TABLE %s", $this->options['table']); |
|
344 | + break; |
|
345 | + case 'pgsql': |
|
346 | + $query = sprintf("VACUUM %s", $this->options['table']); |
|
347 | + break; |
|
348 | + default: |
|
349 | + $query = null; |
|
350 | + break; |
|
351 | 351 | } |
352 | 352 | if (isset($query)) { |
353 | 353 | $result = $this->db->query($query); |