mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-03 12:47:56 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d51d3c127b | ||
|
4f92c0377f | ||
|
c3efafb07d | ||
|
79c18eb781 | ||
|
7b64bc37e2 | ||
|
b3aa5fa0dc |
2
Doxyfile
2
Doxyfile
@@ -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
7
NEWS
@@ -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
|
||||
|
4
WHATSNEW
4
WHATSNEW
@@ -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.
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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';
|
||||
|
@@ -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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user