1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-03 20:58:11 +02:00

Compare commits

..

43 Commits

Author SHA1 Message Date
Edward Z. Yang
2d49299621 Release 1.4.0.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@680 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 17:24:18 +00:00
Edward Z. Yang
ab5c782c77 Actually fix it.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@679 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 17:12:45 +00:00
Edward Z. Yang
8893b87e04 Fix call-time pass-by-reference.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@678 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 17:10:24 +00:00
Edward Z. Yang
aeef746060 Add 1000 passes image.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@677 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 16:45:01 +00:00
Edward Z. Yang
da13c6ac87 Further update TODO.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@676 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 16:17:34 +00:00
Edward Z. Yang
ccae73c25a Update TODO, remove caching: it won't help our memory usage or speed.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@674 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 15:23:42 +00:00
Edward Z. Yang
8d6bfa4037 [1.4.0] YouTube preservation code added to the core by adding HTMLPurifier_Filter hierarchy.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@673 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 15:09:07 +00:00
Edward Z. Yang
712d81ebea [1.4.0] Config object can now be instantiated from ini files. Also updated TODO.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@672 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 14:29:46 +00:00
Edward Z. Yang
f7f6fed86a [1.4.0] Revamp ConfigTest.php. Factor out tallyErrors() to its own function.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@671 48356398-32a2-884e-a903-53898d9a118a
2007-01-21 04:37:02 +00:00
Edward Z. Yang
2293c67eec [1.4.0] Revamp ConfigSchema tests, add more error checking.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@670 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 22:59:20 +00:00
Edward Z. Yang
108df87824 Migrate from assertError to expectError, removed all assertNoErrors()
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@669 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 19:22:55 +00:00
Edward Z. Yang
5e366b25f8 [1.4.0] Support for configuration directive aliases added.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@668 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 18:43:58 +00:00
Edward Z. Yang
2e16c4a968 Replaced version check with functionality check for DOM
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@667 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 15:07:48 +00:00
Edward Z. Yang
a8db22dfff Update docs, esp in context of soon to be added tag transforms.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@666 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 03:59:07 +00:00
Edward Z. Yang
fbe2c25f8a Update progress doc with more info. Fix some comments.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@665 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 03:48:39 +00:00
Edward Z. Yang
158be61def Update TODO.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@664 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 02:28:51 +00:00
Edward Z. Yang
d693c4ea09 [1.4.0] Implement 'background' shorthand CSS property.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@663 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 02:21:43 +00:00
Edward Z. Yang
c24916e1d6 Update progress doc.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@662 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 01:46:37 +00:00
Edward Z. Yang
a68b6afda1 [1.4.0] CSS property background-position implemented. Also:
- Fixed some misinformation in Percentage
- Add support for lowercase CSS length units

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@661 48356398-32a2-884e-a903-53898d9a118a
2007-01-20 01:40:56 +00:00
Edward Z. Yang
78cf7db82e Refactor index.php test runner, it was getting too big.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@660 48356398-32a2-884e-a903-53898d9a118a
2007-01-19 23:26:15 +00:00
Edward Z. Yang
9b375fdfb8 [1.4.0] Added convenient single test selector form on test runner
- Also fixed includes in test files
- Updated TODO with CSS plans

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@659 48356398-32a2-884e-a903-53898d9a118a
2007-01-19 23:02:28 +00:00
Edward Z. Yang
0dd866cc15 [1.4.0]
- Added %Core.EscapeNonASCIICharacters to workaround %Core.Encoding misbehavior
- Add "All Tests" to test runner title and reorder subfile names
- Specific file is now called with ?f=
- Link to UTF-8 docs, even though they're not done
- 1000th unit test passed! W00t! (that's a third as many as SimpleTest has for itself.)

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@658 48356398-32a2-884e-a903-53898d9a118a
2007-01-19 03:54:55 +00:00
Edward Z. Yang
ad1169c711 [1.4.0] Make all functions in Encoder static. Affects branches/strict
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@656 48356398-32a2-884e-a903-53898d9a118a
2007-01-18 22:55:44 +00:00
Edward Z. Yang
2816ae535f Link docs back to HTML Purifier home page.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@655 48356398-32a2-884e-a903-53898d9a118a
2007-01-18 22:38:40 +00:00
Edward Z. Yang
462d3ab72f [1.4.0] Add some nicer styling to the configuration documentation. Also update NEWS.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@654 48356398-32a2-884e-a903-53898d9a118a
2007-01-18 02:52:20 +00:00
Edward Z. Yang
cf1d868782 [1.4.0] Add some docs to printDefinition smoketest.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@653 48356398-32a2-884e-a903-53898d9a118a
2007-01-18 02:05:39 +00:00
Edward Z. Yang
c705e17a58 + Well Supported
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@652 48356398-32a2-884e-a903-53898d9a118a
2007-01-17 03:07:51 +00:00
Edward Z. Yang
1cce367950 [1.4.0] Add all smoketest file using iframes.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@651 48356398-32a2-884e-a903-53898d9a118a
2007-01-16 22:29:11 +00:00
Edward Z. Yang
61f852d429 Merge in PHP5 strict changes that are applicable to PHP4.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@650 48356398-32a2-884e-a903-53898d9a118a
2007-01-16 22:22:08 +00:00
Edward Z. Yang
3a73c2cf04 Fix some XHTML 1.0 conformance issues.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@646 48356398-32a2-884e-a903-53898d9a118a
2007-01-15 20:06:35 +00:00
Edward Z. Yang
e75b676656 Done up to Forms.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@645 48356398-32a2-884e-a903-53898d9a118a
2007-01-15 19:18:17 +00:00
Edward Z. Yang
b53370efbf Update progress doc.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@644 48356398-32a2-884e-a903-53898d9a118a
2007-01-15 01:16:25 +00:00
Edward Z. Yang
d60f345cab [1.4.0] Implemented background-image, background-repeat and background-attachment CSS properties. background shorthand property HAS NOT been extended to allow these, and background-position IS NOT implemented yet.
- Also: fixed up some flaky behavior in list-style shorthand, introduced uri_or_none

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@643 48356398-32a2-884e-a903-53898d9a118a
2007-01-15 01:14:24 +00:00
Edward Z. Yang
aefda60696 [1.4.0] Refactored ListStyle, since list-style-image was sort of tacked on and didn't really conform with the standard. Implementation is still a little flaky but conforms with W3C's validation service.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@642 48356398-32a2-884e-a903-53898d9a118a
2007-01-15 00:48:54 +00:00
Edward Z. Yang
2ffa5d3135 Update progress doc.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@641 48356398-32a2-884e-a903-53898d9a118a
2007-01-14 16:26:47 +00:00
Edward Z. Yang
23d3490d49 [1.4.0] Implemented list-style-image, URIs now allowed in list-style
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@640 48356398-32a2-884e-a903-53898d9a118a
2007-01-14 16:24:02 +00:00
Edward Z. Yang
582ffc4143 [1.4.0] Implemented AttrDef_CSSURI for url(http://google.com) style declarations
- 1.3.3 release downgraded to "not likely"

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@639 48356398-32a2-884e-a903-53898d9a118a
2007-01-14 15:54:05 +00:00
Edward Z. Yang
d52189a19d Complete info on fixing embedded encodings. Will discuss UTF-8 next.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@638 48356398-32a2-884e-a903-53898d9a118a
2007-01-14 02:31:54 +00:00
Edward Z. Yang
02006d6e64 Commit initial draft of UTF-8 document. Incomplete.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@637 48356398-32a2-884e-a903-53898d9a118a
2007-01-13 03:58:02 +00:00
Edward Z. Yang
dcaa374dae [1.3.3] Random miscellaneous housekeeping
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@636 48356398-32a2-884e-a903-53898d9a118a
2007-01-11 22:37:54 +00:00
Edward Z. Yang
e2cc37724b [1.3.3]
- Move SLOW to docs/enduser-slow.html and add code examples
- Update README and WYSIWYG
- Add warning to HTMLPurifier.func.php about naming similarities

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@635 48356398-32a2-884e-a903-53898d9a118a
2007-01-11 22:28:44 +00:00
Edward Z. Yang
3ad6239dc3 Remove useless $init assignment.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@634 48356398-32a2-884e-a903-53898d9a118a
2007-01-07 23:55:55 +00:00
Edward Z. Yang
663fb4e1b2 Add TODO item to INSTALL for new array syntax for configuration.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@627 48356398-32a2-884e-a903-53898d9a118a
2006-12-26 17:40:05 +00:00
12 changed files with 30 additions and 29 deletions

View File

@@ -53,8 +53,8 @@ class HTMLPurifier_Config
* or a string filename of an ini file.
* @return Configured HTMLPurifier_Config object
*/
static function create($config) {
if ($config instanceof HTMLPurifier_Config) return $config;
function create($config) {
if (is_a($config, 'HTMLPurifier_Config')) return $config;
$ret = HTMLPurifier_Config::createDefault();
if (is_string($config)) $ret->loadIni($config);
elseif (is_array($config)) $ret->loadArray($config);
@@ -66,7 +66,7 @@ class HTMLPurifier_Config
* @static
* @return Default HTMLPurifier_Config object.
*/
static function createDefault() {
function createDefault() {
$definition =& HTMLPurifier_ConfigSchema::instance();
$config = new HTMLPurifier_Config($definition);
return $config;

View File

@@ -69,7 +69,7 @@ class HTMLPurifier_ConfigSchema {
* Retrieves an instance of the application-wide configuration definition.
* @static
*/
static function &instance($prototype = null) {
function &instance($prototype = null) {
static $instance;
if ($prototype !== null) {
$instance = $prototype;
@@ -91,7 +91,7 @@ class HTMLPurifier_ConfigSchema {
* HTMLPurifier_DirectiveDef::$type for allowed values
* @param $description Description of directive for documentation
*/
static function define(
function define(
$namespace, $name, $default, $type,
$description
) {
@@ -155,7 +155,7 @@ class HTMLPurifier_ConfigSchema {
* @param $namespace Namespace's name
* @param $description Description of the namespace
*/
static function defineNamespace($namespace, $description) {
function defineNamespace($namespace, $description) {
$def =& HTMLPurifier_ConfigSchema::instance();
if (isset($def->info[$namespace])) {
trigger_error('Cannot redefine namespace', E_USER_ERROR);
@@ -188,7 +188,7 @@ class HTMLPurifier_ConfigSchema {
* @param $alias Name of aliased value
* @param $real Value aliased value will be converted into
*/
static function defineValueAliases($namespace, $name, $aliases) {
function defineValueAliases($namespace, $name, $aliases) {
$def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace][$name])) {
trigger_error('Cannot set value alias for non-existant directive',
@@ -219,7 +219,7 @@ class HTMLPurifier_ConfigSchema {
* @param $name Name of directive
* @param $allowed_values Arraylist of allowed values
*/
static function defineAllowedValues($namespace, $name, $allowed_values) {
function defineAllowedValues($namespace, $name, $allowed_values) {
$def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace][$name])) {
trigger_error('Cannot define allowed values for undefined directive',
@@ -256,7 +256,7 @@ class HTMLPurifier_ConfigSchema {
* @param $new_namespace
* @param $new_name Directive that the alias will be to
*/
static function defineAlias($namespace, $name, $new_namespace, $new_name) {
function defineAlias($namespace, $name, $new_namespace, $new_name) {
$def =& HTMLPurifier_ConfigSchema::instance();
if (!isset($def->info[$namespace])) {
trigger_error('Cannot define directive alias in undefined namespace',
@@ -374,7 +374,7 @@ class HTMLPurifier_ConfigSchema {
*/
function isError($var) {
if (!is_object($var)) return false;
if (!($var instanceof HTMLPurifier_Error)) return false;
if (!is_a($var, 'HTMLPurifier_Error')) return false;
return true;
}
}

View File

@@ -90,7 +90,7 @@ class HTMLPurifier_Encoder
* would need that, and I'm probably not going to implement them.
* Once again, PHP 6 should solve all our problems.
*/
static function cleanUTF8($str, $force_php = false) {
function cleanUTF8($str, $force_php = false) {
static $non_sgml_chars = array();
if (empty($non_sgml_chars)) {
@@ -273,7 +273,7 @@ class HTMLPurifier_Encoder
// | 00000000 | 00010000 | 11111111 | 11111111 | Defined upper limit of legal scalar codes
// +----------+----------+----------+----------+
static function unichr($code) {
function unichr($code) {
if($code > 1114111 or $code < 0 or
($code >= 55296 and $code <= 57343) ) {
// bits are set outside the "valid" range as defined
@@ -314,7 +314,7 @@ class HTMLPurifier_Encoder
* Converts a string to UTF-8 based on configuration.
* @static
*/
static function convertToUTF8($str, $config, &$context) {
function convertToUTF8($str, $config, &$context) {
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
$encoding = $config->get('Core', 'Encoding');
@@ -333,7 +333,7 @@ class HTMLPurifier_Encoder
* @note Currently, this is a lossy conversion, with unexpressable
* characters being omitted.
*/
static function convertFromUTF8($str, $config, &$context) {
function convertFromUTF8($str, $config, &$context) {
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
$encoding = $config->get('Core', 'Encoding');
@@ -366,7 +366,7 @@ class HTMLPurifier_Encoder
* @note Sort of with cleanUTF8() but it assumes that $str is
* well-formed UTF-8
*/
static function convertToASCIIDumbLossless($str) {
function convertToASCIIDumbLossless($str) {
$bytesleft = 0;
$result = '';
$working = 0;

View File

@@ -29,7 +29,7 @@ class HTMLPurifier_EntityLookup {
* @static
* @param Optional prototype of custom lookup table to overload with.
*/
static function instance($prototype = false) {
function instance($prototype = false) {
// no references, since PHP doesn't copy unless modified
static $instance = null;
if ($prototype) {

View File

@@ -536,7 +536,7 @@ class HTMLPurifier_HTMLDefinition
// protect against stdclasses floating around
foreach ($this->info as $key => $obj) {
if ($obj instanceof stdClass) {
if (is_a($obj, 'stdclass')) {
unset($this->info[$key]);
}
}

View File

@@ -144,7 +144,7 @@ class HTMLPurifier_Lexer
* @param $prototype Optional prototype lexer.
* @return Concrete lexer.
*/
static function create($prototype = null) {
function create($prototype = null) {
// we don't really care if it's a reference or a copy
static $lexer = null;
if ($prototype) {
@@ -170,7 +170,7 @@ class HTMLPurifier_Lexer
* @param $string HTML string to process.
* @returns HTML with CDATA sections escaped.
*/
static function escapeCDATA($string) {
function escapeCDATA($string) {
return preg_replace_callback(
'/<!\[CDATA\[(.+?)\]\]>/',
array('HTMLPurifier_Lexer', 'CDATACallback'),
@@ -188,7 +188,7 @@ class HTMLPurifier_Lexer
* and 1 the inside of the CDATA section.
* @returns Escaped internals of the CDATA section.
*/
static function CDATACallback($matches) {
function CDATACallback($matches) {
// not exactly sure why the character set is needed, but whatever
return htmlspecialchars($matches[1], ENT_COMPAT, 'UTF-8');
}

View File

@@ -38,7 +38,7 @@ class HTMLPurifier_URISchemeRegistry
* @note Pass a registry object $prototype with a compatible interface and
* the function will copy it and return it all further times.
*/
static function &instance($prototype = null) {
function &instance($prototype = null) {
static $instance = null;
if ($prototype !== null) {
$instance = $prototype;

View File

@@ -3,7 +3,7 @@
header('Content-type: text/html; charset=UTF-8');
require_once '../library/HTMLPurifier.auto.php';
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
function escapeHTML($string) {
$string = HTMLPurifier_Encoder::cleanUTF8($string);
@@ -11,4 +11,4 @@ function escapeHTML($string) {
return $string;
}
?>
?>

View File

@@ -73,7 +73,7 @@ class Debugger
/**
* @static
*/
static function &instance() {
function &instance() {
static $soleInstance = false;
if (!$soleInstance) $soleInstance = new Debugger();
return $soleInstance;
@@ -145,4 +145,4 @@ class Debugger
}
?>
?>

View File

@@ -16,8 +16,9 @@ class HTMLPurifier_LexerTest extends UnitTestCase
$this->DirectLex = new HTMLPurifier_Lexer_DirectLex();
// E_STRICT = 2048, int used for PHP4 compat
if ( $GLOBALS['HTMLPurifierTest']['PEAR'] &&
((error_reporting() & E_STRICT) != E_STRICT)
((error_reporting() & 2048) != 2048)
) {
$this->_has_pear = true;
require_once 'HTMLPurifier/Lexer/PEARSax3.php';
@@ -326,4 +327,4 @@ class HTMLPurifier_LexerTest extends UnitTestCase
}
?>
?>

View File

@@ -3,7 +3,7 @@
// call one file using /?f=FileTest.php , see $test_files array for
// valid values
error_reporting(E_ALL | E_STRICT);
error_reporting(E_ALL);
define('HTMLPurifierTest', 1);
// wishlist: automated calling of this file from multiple PHP versions so we

View File

@@ -8,7 +8,7 @@ function tally_errors() {
foreach ($queue->_expectation_queue as $e) {
if (count($e) != 2) return; // fut-compat
if (!isset($e[0])) return; // fut-compat
$e[0]->_dumper = new SimpleDumper();
$e[0]->_dumper = &new SimpleDumper();
$this->fail('Error expectation not fulfilled: ' .
$e[0]->testMessage(null));
}