Exemple #1
0
 function testData_Text_HTMLParser()
 {
     $content = "<a href='#'>Go Daddy</a><attr name='attr'>ATTR</attr>\r\n\t\t\t\t\t\t<p align=\"center\"><a href=\"http://www.myspace.com/declareyourself\" target=\"_blank\">\r\n\t\t\t\t\t\t<img src=\"http://creative.myspace.com/groups/_jc/declareyourself/dy_badge.jpg\" border=\"0\" />\r\n\t\t\t\t\t\t</a></p>";
     $res = HTMLParser::StripTags($content);
     $this->assertEqual($res, strip_tags($content), "Error while stripping all tags");
     $res = HTMLParser::StripTags($content, 'attr');
     $this->assertFalse(stristr($res, '<attr'), "Error while stripping [attr] tag");
     $nolinks = HTMLParser::StripTags($content, 'a');
     $this->assertFalse(stristr($nolinks, 'href'), "Error while stripping [a] tag");
     $nolinks = HTMLParser::StripLinks($content);
     $this->assertFalse(stristr($nolinks, 'href'), "Error while stripping links");
     $res = HTMLParser::StripScripts($content);
     $this->assertEqual($res, $content, "Error while stripping scripts");
     $res = HTMLParser::StripTags($content, 'img');
     $this->assertFalse(stristr($res, 'img'), "Error while stripping [img] tag");
 }