From 7a3e06d4d0b37531975275216a9eadea2304da37 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 24 May 2007 20:36:50 +0000 Subject: [PATCH] [1.7.0] Lexer is now pre-emptively included, with a conditional include for the PHP5 only version. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1090 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 2 ++ library/HTMLPurifier/Lexer.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6cad4514..c6e16ebf 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier . Add extra protection in AttrDef_URI against phantom Schemes . Doctype object added to HTMLDefinition which describes certain aspects of the operational document type +. Lexer is now pre-emptively included, with a conditional include for the + PHP5 only version. 1.6.1, released 2007-05-05 ! Support for more deprecated attributes via transformations: diff --git a/library/HTMLPurifier/Lexer.php b/library/HTMLPurifier/Lexer.php index e7242e1e..ec113265 100644 --- a/library/HTMLPurifier/Lexer.php +++ b/library/HTMLPurifier/Lexer.php @@ -4,6 +4,14 @@ require_once 'HTMLPurifier/Token.php'; require_once 'HTMLPurifier/Encoder.php'; require_once 'HTMLPurifier/EntityParser.php'; +// implementations +require_once 'HTMLPurifier/Lexer/DirectLex.php'; +if (version_compare(PHP_VERSION, "5", ">=")) { + // You can remove the if statement if you are running PHP 5 only. + // We ought to get the strict version to follow those rules. + require_once 'HTMLPurifier/Lexer/DOMLex.php'; +} + HTMLPurifier_ConfigSchema::define( 'Core', 'AcceptFullDocuments', true, 'bool', 'This parameter determines whether or not the filter should accept full '. @@ -153,10 +161,8 @@ class HTMLPurifier_Lexer if (empty($lexer)) { if (version_compare(PHP_VERSION, "5", ">=") && // check for PHP5 class_exists('DOMDocument')) { // check for DOM support - require_once 'HTMLPurifier/Lexer/DOMLex.php'; $lexer = new HTMLPurifier_Lexer_DOMLex(); } else { - require_once 'HTMLPurifier/Lexer/DirectLex.php'; $lexer = new HTMLPurifier_Lexer_DirectLex(); } }