mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-31 20:01:52 +00:00
Comment on why it's a non-greedy match.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
This commit is contained in:
parent
5886326cd0
commit
66bbae73a9
@ -95,6 +95,9 @@ class HTMLPurifier_Filter_ExtractStyleBlocks extends HTMLPurifier_Filter
|
|||||||
if ($tidy !== null) {
|
if ($tidy !== null) {
|
||||||
$this->_tidy = $tidy;
|
$this->_tidy = $tidy;
|
||||||
}
|
}
|
||||||
|
// NB: this must be NON-greedy because if we have
|
||||||
|
// <style>foo</style> <style>bar</style>
|
||||||
|
// we must not grab foo</style> <style>bar
|
||||||
$html = preg_replace_callback('#<style(?:\s.*)?>(.*)<\/style>#isU', array($this, 'styleCallback'), $html);
|
$html = preg_replace_callback('#<style(?:\s.*)?>(.*)<\/style>#isU', array($this, 'styleCallback'), $html);
|
||||||
$style_blocks = $this->_styleMatches;
|
$style_blocks = $this->_styleMatches;
|
||||||
$this->_styleMatches = array(); // reset
|
$this->_styleMatches = array(); // reset
|
||||||
|
Loading…
Reference in New Issue
Block a user