0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 00:41:52 +00:00

Setup include web. Unit tests should now be able to be run independently.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@75 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-07-22 00:13:08 +00:00
parent 1d8bfebb3a
commit cafa24482d
11 changed files with 28 additions and 14 deletions

View File

@ -1,5 +1,10 @@
<?php <?php
require_once 'HTMLPurifier/AttrDef.php';
require_once 'HTMLPurifier/ChildDef.php';
require_once 'HTMLPurifier/Generator.php';
require_once 'HTMLPurifier/Token.php';
class HTMLPurifier_Definition class HTMLPurifier_Definition
{ {

View File

@ -1,5 +1,9 @@
<?php <?php
require_once 'HTMLPurifier/Lexer.php';
require_once 'HTMLPurifier/Definition.php';
require_once 'HTMLPurifier/Generator.php';
class HTMLPurifier class HTMLPurifier
{ {
@ -14,11 +18,9 @@ class HTMLPurifier
} }
function purify($html) { function purify($html) {
$tokens = $this->lexer->tokenizeHTML($html); $tokens = $this->lexer->tokenizeHTML($html);
$tokens = $this->definition->purifyTokens($tokens); $tokens = $this->definition->purifyTokens($tokens);
return $this->generator->generateFromTokens($tokens); return $this->generator->generateFromTokens($tokens);
} }
} }

View File

@ -12,6 +12,8 @@ TODO:
*/ */
require_once 'HTMLPurifier/Token.php';
class HTMLPurifier_Lexer class HTMLPurifier_Lexer
{ {

View File

@ -6,7 +6,6 @@ Primary:
Secondary: Secondary:
- Build an automated release system that will create minimal versions too - Build an automated release system that will create minimal versions too
- Build system that will in-line includes - Build system that will in-line includes
- Set up the file includes
- Migrate all unit tests to use the lexer and generator - Migrate all unit tests to use the lexer and generator
- Build the entity lookup table - Build the entity lookup table

View File

@ -4,13 +4,15 @@
set_time_limit(5); set_time_limit(5);
// emulates inserting a dir called HTMLPurifier into your class dir
set_include_path(get_include_path() . PATH_SEPARATOR . '../../');
// PEAR // PEAR
require_once 'Benchmark/Timer.php'; require_once 'Benchmark/Timer.php';
require_once 'XML/HTMLSax3.php'; require_once 'XML/HTMLSax3.php';
require_once 'Text/Password.php'; require_once 'Text/Password.php';
require_once '../Token.php'; require_once 'HTMLPurifier/Lexer.php';
require_once '../Lexer.php';
class TinyTimer extends Benchmark_Timer class TinyTimer extends Benchmark_Timer
{ {

View File

@ -1,5 +1,9 @@
<?php <?php
require_once 'HTMLPurifier/ChildDef.php';
require_once 'HTMLPurifier/Lexer.php';
require_once 'HTMLPurifier/Generator.php';
class Test_HTMLPurifier_ChildDef extends UnitTestCase class Test_HTMLPurifier_ChildDef extends UnitTestCase
{ {

View File

@ -1,5 +1,8 @@
<?php <?php
require_once 'HTMLPurifier/Definition.php';
require_once 'HTMLPurifier/Lexer.php';
class Test_HTMLPurifier_Definition extends UnitTestCase class Test_HTMLPurifier_Definition extends UnitTestCase
{ {

View File

@ -1,5 +1,7 @@
<?php <?php
require_once 'HTMLPurifier/Generator.php';
class Test_HTMLPurifier_Generator extends UnitTestCase class Test_HTMLPurifier_Generator extends UnitTestCase
{ {

View File

@ -1,5 +1,7 @@
<?php <?php
require_once 'HTMLPurifier/HTMLPurifier.php';
class Test_HTMLPurifier extends UnitTestCase class Test_HTMLPurifier extends UnitTestCase
{ {

View File

@ -4,6 +4,8 @@
* Benchmark the SAX parser with my homemade one * Benchmark the SAX parser with my homemade one
*/ */
require_once 'HTMLPurifier/Lexer.php';
class Test_HTMLPurifier_Lexer extends UnitTestCase class Test_HTMLPurifier_Lexer extends UnitTestCase
{ {

View File

@ -7,15 +7,6 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../../');
require_once 'XML/HTMLSax3.php'; // optional PEAR class require_once 'XML/HTMLSax3.php'; // optional PEAR class
// enforce proper namespacing
require_once 'HTMLPurifier/HTMLPurifier.php';
require_once 'HTMLPurifier/Lexer.php';
require_once 'HTMLPurifier/Token.php';
require_once 'HTMLPurifier/Definition.php';
require_once 'HTMLPurifier/AttrDef.php';
require_once 'HTMLPurifier/ChildDef.php';
require_once 'HTMLPurifier/Generator.php';
$test = new GroupTest('HTMLPurifier'); $test = new GroupTest('HTMLPurifier');
$test->addTestFile('HTMLPurifier.php'); $test->addTestFile('HTMLPurifier.php');