1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-30 19:00:10 +02:00

- Restore substr_count compatibility method; it's not just PHP 4

- Update missing includes
- Fix generate-standalone.php fatal error
- Make LexerTest resilient against variant versions of libxml

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1573 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-02-20 01:28:19 +00:00
parent b5f1c76ee8
commit cb793cd9b9
4 changed files with 49 additions and 20 deletions

View File

@@ -510,6 +510,26 @@ class HTMLPurifier_LexerTest extends HTMLPurifier_Harness
}
function test_tokenizeHTML_() {
$extra = array(
// PH5P doesn't seem to like style tags
'PH5P' => false,
// DirectLex defers to RemoveForeignElements for textification
'DirectLex' => array(
new HTMLPurifier_Token_Start('style', array('type' => 'text/css')),
new HTMLPurifier_Token_Comment("\ndiv {}\n"),
new HTMLPurifier_Token_End('style'),
),
);
if (!defined('LIBXML_VERSION') || LIBXML_VERSION < 20628) {
// libxml's behavior is wrong prior to this version, so make
// appropriate accomodations
// :NOTE: LIBXML_VERSION is missing in early versions of PHP
// prior to 1.30 of php-src/ext/libxml/libxml.c (version-wise,
// this translates to 5.0.x. In such cases, we assume that an old
// version of libxml is being used, although that *might* not
// be the case (it's very unlikely though)
$extra['DOMLex'] = $extra['DirectLex'];
}
$this->assertTokenization(
'<style type="text/css"><!--
div {}
@@ -519,16 +539,7 @@ div {}
new HTMLPurifier_Token_Text("\ndiv {}\n"),
new HTMLPurifier_Token_End('style'),
),
array(
// PH5P doesn't seem to like style tags
'PH5P' => false,
// DirectLex defers to RemoveForeignElements for textification
'DirectLex' => array(
new HTMLPurifier_Token_Start('style', array('type' => 'text/css')),
new HTMLPurifier_Token_Comment("\ndiv {}\n"),
new HTMLPurifier_Token_End('style'),
),
)
$extra
);
}