1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-03 12:47:56 +02:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Edward Z. Yang
d51d3c127b Release 2.1.1.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1366 48356398-32a2-884e-a903-53898d9a118a
2007-08-05 01:20:55 +00:00
Edward Z. Yang
4f92c0377f [2.1.1] Fix syntax error in standalone library
- fix faulty PHP4 test
- remove unnecessary HTMLPurifier_Config::create() call

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1365 48356398-32a2-884e-a903-53898d9a118a
2007-08-05 01:15:23 +00:00
Edward Z. Yang
c3efafb07d [2.1.1] Fix *another* but with addFilter() Jeez!
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1364 48356398-32a2-884e-a903-53898d9a118a
2007-08-04 22:46:17 +00:00
Edward Z. Yang
79c18eb781 [2.1.1] Single test methods can be invoked by prefixing them with __only
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1363 48356398-32a2-884e-a903-53898d9a118a
2007-08-04 14:51:06 +00:00
Edward Z. Yang
7b64bc37e2 [2.1.1] Fix show-stopping bug in URIDefinition.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1361 48356398-32a2-884e-a903-53898d9a118a
2007-08-03 21:17:15 +00:00
Edward Z. Yang
b3aa5fa0dc [2.1.1] Add prefix directory to include path in standalone: this prevents PEAR from clobbering our unit tests
- Add missing include to unit test harness
- Add missing unit test for HTMLPurifier::getInstance

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1358 48356398-32a2-884e-a903-53898d9a118a
2007-08-03 15:11:08 +00:00
11 changed files with 59 additions and 14 deletions

View File

@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = HTML Purifier
PROJECT_NUMBER = 2.1.0
PROJECT_NUMBER = 2.1.1
OUTPUT_DIRECTORY = "C:/Documents and Settings/Edward/My Documents/My Webs/htmlpurifier/docs/doxygen"
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

7
NEWS
View File

@@ -9,6 +9,13 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
. Internal change
==========================
2.1.1, released 2007-08-04
- Fix show-stopper bug in %URI.MakeAbsolute functionality
- Fix PHP4 syntax error in standalone version
. Add prefix directory to include path for standalone, this prevents
other installations from clobbering the standalone's URI schemes
. Single test methods can be invoked by prefixing with __only
2.1.0, released 2007-08-02
# flush-htmldefinition-cache.php superseded in favor of a generic
flush-definition-cache.php script, you can clear a specific cache

View File

@@ -1 +1 @@
2.1.0
2.1.1

View File

@@ -5,4 +5,6 @@ notable features include preservation of emoticons in PHP5 with
transforming relative URIs to absolute URIs, Ruby in XHTML 1.1, a Phorum
mod, and UTF-8 font names. Notable bug-fixes include refinement of
the auto-paragraphing algorithm (no longer experimental), better XHTML
1.1 support and the removal of the contents of <style> elements.
1.1 support and the removal of the contents of <style> elements. Version
2.1.1 amends a few bugs in some of newly introduced features, namely
running the standalone download version in PHP4 and %URI.MakeAbsolute.

View File

@@ -22,7 +22,7 @@
*/
/*
HTML Purifier 2.1.0 - Standards Compliant HTML Filtering
HTML Purifier 2.1.1 - Standards Compliant HTML Filtering
Copyright (C) 2006 Edward Z. Yang
This library is free software; you can redistribute it and/or
@@ -77,7 +77,7 @@ This directive has been available since 2.0.0.
class HTMLPurifier
{
var $version = '2.1.0';
var $version = '2.1.1';
var $config;
var $filters;
@@ -205,7 +205,7 @@ class HTMLPurifier
if (is_a($prototype, 'HTMLPurifier')) {
$htmlpurifier = $prototype;
} elseif ($prototype) {
$htmlpurifier = new HTMLPurifier(HTMLPurifier_Config::create($prototype));
$htmlpurifier = new HTMLPurifier($prototype);
} else {
$htmlpurifier = new HTMLPurifier();
}

View File

@@ -42,7 +42,7 @@ class HTMLPurifier_Config
/**
* HTML Purifier's version
*/
var $version = '2.1.0';
var $version = '2.1.1';
/**
* Two-level associative array of configuration directives

View File

@@ -103,23 +103,22 @@ class HTMLPurifier_URIDefinition extends HTMLPurifier_Definition
}
function addFilter($filter, $config) {
$filter->setup($config);
$this->filter[$filter->name] = $filter;
$filter->prepare($config);
$this->filters[$filter->name] = $filter;
}
function doSetup($config) {
$this->setupFilters($config);
$this->setupMemberVariables($config);
$this->setupFilters($config);
}
function setupFilters($config) {
foreach ($this->registeredFilters as $name => $filter) {
$conf = $config->get('URI', $name);
if ($conf !== false && $conf !== null) {
$this->filters[$name] = $filter;
$this->addFilter($filter, $config);
}
}
foreach ($this->filters as $n => $x) $this->filters[$n]->prepare($config);
unset($this->registeredFilters);
}

View File

@@ -167,6 +167,10 @@ function make_file_standalone($file) {
*/
function replace_includes_callback($matches) {
$file = $matches[1];
// PHP 5 only file
if ($file == 'HTMLPurifier/Lexer/DOMLex.php') {
return $matches[0];
}
if (isset($GLOBALS['loaded'][$file])) return '';
$GLOBALS['loaded'][$file] = true;
create_blank($file);
@@ -180,7 +184,8 @@ echo 'Creating full file...';
$contents = replace_includes(file_get_contents('HTMLPurifier.php'));
$contents = str_replace(
"define('HTMLPURIFIER_PREFIX', dirname(__FILE__));",
"define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone');",
"define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone');
set_include_path(HTMLPURIFIER_PREFIX . PATH_SEPARATOR . get_include_path());",
$contents
);
file_put_contents('HTMLPurifier.standalone.php', $contents);
@@ -194,5 +199,9 @@ make_dir_standalone('HTMLPurifier/Language');
make_file_standalone('HTMLPurifier/Printer/ConfigForm.js');
make_file_standalone('HTMLPurifier/Printer/ConfigForm.css');
make_dir_standalone('HTMLPurifier/URIScheme');
// PHP 5 only file
mkdir_deep('standalone/HTMLPurifier/Lexer');
make_file_standalone('HTMLPurifier/Lexer/DOMLex.php');
make_file_standalone('HTMLPurifier/TokenFactory.php');
echo ' done!' . PHP_EOL;

View File

@@ -55,5 +55,15 @@ class HTMLPurifier_Harness extends UnitTestCase
}
}
function getTests() {
// __onlytest makes only one test get triggered
foreach (get_class_methods(get_class($this)) as $method) {
if (strtolower(substr($method, 0, 10)) == '__onlytest') {
return array($method);
}
}
return parent::getTests();
}
}

View File

@@ -1,6 +1,7 @@
<?php
require_once 'HTMLPurifier/URI.php';
require_once 'HTMLPurifier/URIHarness.php';
require_once 'HTMLPurifier/URIScheme.php';
require_once 'HTMLPurifier/URISchemeRegistry.php';

View File

@@ -4,7 +4,7 @@ require_once 'HTMLPurifier.php';
// integration test
class HTMLPurifierTest extends UnitTestCase
class HTMLPurifierTest extends HTMLPurifier_Harness
{
var $purifier;
@@ -132,5 +132,22 @@ alert("<This is compatible with XHTML>");
);
}
function testGetInstance() {
$purifier =& HTMLPurifier::getInstance();
$purifier2 =& HTMLPurifier::getInstance();
$this->assertReference($purifier, $purifier2);
}
function testMakeAbsolute() {
$this->assertPurification(
'<a href="foo.txt">Foobar</a>',
'<a href="http://example.com/bar/foo.txt">Foobar</a>',
array(
'URI.Base' => 'http://example.com/bar/baz.php',
'URI.MakeAbsolute' => true
)
);
}
}