diff options
author | Christian Schneider | 2022-09-08 14:23:47 +0200 |
---|---|---|
committer | Christian Schneider | 2022-09-08 14:23:47 +0200 |
commit | 0954d7dfc7d3a776bb3e7a5039c85015b8837c90 (patch) | |
tree | 01ac8348a9a3cf3a3c246842acbd3d798aa64e74 | |
parent | da836732e343cc9e093939fdf2215b10e21c0966 (diff) | |
download | itools-0954d7dfc7d3a776bb3e7a5039c85015b8837c90.tar.gz itools-0954d7dfc7d3a776bb3e7a5039c85015b8837c90.tar.bz2 itools-0954d7dfc7d3a776bb3e7a5039c85015b8837c90.zip |
Fix it_html::sanitize with nested tags
-rw-r--r-- | it_html.class | 2 | ||||
-rwxr-xr-x | test/it_html.t | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 913d018..5a2fb68 100644 --- a/it_html.class +++ b/it_html.class @@ -409,7 +409,7 @@ static function sanitize($html) $html = it::replace(array('[\0\s]+' => " "), $html); # \s also matches \r and \n $urlpattern = 'https?://[^">]+'; - if ($tag = it::match("(.*)<(div|p|i|b|strong|h[1-6])\b[^>]*>(.*?)</\\2>(.*)", $html)) + if ($tag = it::match("(.*?)<(div|p|i|b|strong|h[1-6])\b[^>]*>(.*?)</\\2>(.*)", $html)) { # Simple tags with content, no attributes kept list($head, $tagname, $content, $tail) = $tag; diff --git a/test/it_html.t b/test/it_html.t index aa734c0..ae11ad1 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -225,7 +225,7 @@ is( <P><a href="javascript:window.close()" title="Wolken"><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" width="240" height="180" alt="Wolken" style="border: 1px solid #ddd;" /></a></p> '), - ' <a href="http://www.flickr.com/people/swisspics%25/">swisspics</a> posted < < ä & yesterday a <i>photo</i> <i>tag missmatch</i>:<br /><br /> <p><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" alt="" /></p> ', + ' <p><a href="http://www.flickr.com/people/swisspics%25/">swisspics</a> posted < < ä & yesterday <b>a <i>photo</i></b> <b>tag missmatch</b>:</p><br /><br /> <p><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" alt="" /></p> ', 'it_html::sanitize tag soup' ); |