From 5b3c8c55341b1e794c187d112456653fd8a20ee7 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 3 Sep 2007 15:16:33 +0000 Subject: [PATCH] [2.1.2] Implement border-spacing - Fix PH5P testing in PHP4 git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1401 48356398-32a2-884e-a903-53898d9a118a --- TODO | 7 +------ docs/dev-progress.html | 3 ++- library/HTMLPurifier/CSSDefinition.php | 2 ++ maintenance/merge-library.php | 8 ++------ tests/HTMLPurifier/AttrDef/CSSTest.php | 2 ++ tests/index.php | 6 +++--- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/TODO b/TODO index b6d81e6d..6a50b8c2 100644 --- a/TODO +++ b/TODO @@ -11,9 +11,6 @@ If no interest is expressed for a feature that may required a considerable amount of effort to implement, it may get endlessly delayed. Do not be afraid to cast your vote for the next feature to be implemented! -ASAP release [As Soon As Possible] - - Add border-spacing CSS property - 2.2 release [Error'ed] # Error logging for filtering/cleanup procedures - XSS-attempt detection @@ -67,7 +64,6 @@ Ongoing Unknown release (on a scratch-an-itch basis) # CHMOD install script for PEAR installs - ? Semi-lossy dumb alternate character encoding transfor ? Have 'lang' attribute be checked against official lists, achieved by encoding all characters that have string entity equivalents - Abstract ChildDef_BlockQuote to work with all elements that only @@ -78,7 +74,6 @@ Unknown release (on a scratch-an-itch basis) - Implement lenient child validation - Explain how to use HTML Purifier in non-PHP languages / create a simple command line stub (or complicated?) - - Improve __autoload integration, remove directory inclusion - Fixes for Firefox's inability to handle COL alignment props (Bug 915) - Automatically add non-breaking spaces to empty table cells when empty-cells:show is applied to have compatibility with Internet Explorer @@ -88,7 +83,7 @@ Requested Wontfix - Non-lossy smart alternate character encoding transformations (unless patch provided) - - Pretty-printing HTML, users can use Tidy on the output on entire page + - Pretty-printing HTML: users can use Tidy on the output on entire page - Native content compression, whitespace stripping (don't rely on Tidy, make sure we don't remove from
 or related tags): use gzip if this is
    really important
diff --git a/docs/dev-progress.html b/docs/dev-progress.html
index b3109df2..9eef6a09 100644
--- a/docs/dev-progress.html
+++ b/docs/dev-progress.html
@@ -39,7 +39,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
 
-
+
@@ -118,6 +118,7 @@ thead th {text-align:left;padding:0.1em;background-color:#EEE;}
 
+
diff --git a/library/HTMLPurifier/CSSDefinition.php b/library/HTMLPurifier/CSSDefinition.php
index 8bb744fb..2acf7cf8 100644
--- a/library/HTMLPurifier/CSSDefinition.php
+++ b/library/HTMLPurifier/CSSDefinition.php
@@ -219,6 +219,8 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
             new HTMLPurifier_AttrDef_CSS_Percentage()
         ));
         
+        $this->info['border-spacing'] = new HTMLPurifier_AttrDef_CSS_Multiple(new HTMLPurifier_AttrDef_CSS_Length(), 2);
+        
         // partial support
         $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(array('nowrap'));
         
diff --git a/maintenance/merge-library.php b/maintenance/merge-library.php
index 50eedb78..a9299084 100755
--- a/maintenance/merge-library.php
+++ b/maintenance/merge-library.php
@@ -6,15 +6,11 @@ assertCli();
 
 /**
  * Compiles all of HTML Purifier's library files into one big file
- * named HTMLPurifier.standalone.php. Operates recursively, and will
- * barf if there are conditional includes.
- * 
- * Details: also creates blank "include" files in the test/blank directory
- * in order to simulate require_once's inside the test files.
+ * named HTMLPurifier.standalone.php.
  */
 
 /**
- * Global array that tracks already loaded includes
+ * Global hash that tracks already loaded includes
  */
 $GLOBALS['loaded'] = array('HTMLPurifier.php' => true);
 
diff --git a/tests/HTMLPurifier/AttrDef/CSSTest.php b/tests/HTMLPurifier/AttrDef/CSSTest.php
index e38aebc5..994fad12 100644
--- a/tests/HTMLPurifier/AttrDef/CSSTest.php
+++ b/tests/HTMLPurifier/AttrDef/CSSTest.php
@@ -80,6 +80,8 @@ class HTMLPurifier_AttrDef_CSSTest extends HTMLPurifier_AttrDefHarness
         $this->assertDef('background-repeat:repeat-y;');
         $this->assertDef('background-attachment:fixed;');
         $this->assertDef('background-position:left 90%;');
+        $this->assertDef('border-spacing:1em;');
+        $this->assertDef('border-spacing:1em 2em;');
         
         // duplicates
         $this->assertDef('text-align:right;text-align:left;',
diff --git a/tests/index.php b/tests/index.php
index 70ed9f9b..05554666 100755
--- a/tests/index.php
+++ b/tests/index.php
@@ -5,7 +5,7 @@
 
 error_reporting(E_ALL);
 define('HTMLPurifierTest', 1);
-define('HTMLPURIFIER_SCHEMA_STRICT', true);
+define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas
 
 // wishlist: automated calling of this file from multiple PHP versions so we
 // don't have to constantly switch around
@@ -13,10 +13,11 @@ define('HTMLPURIFIER_SCHEMA_STRICT', true);
 // default settings (protect against register_globals)
 $GLOBALS['HTMLPurifierTest'] = array();
 $GLOBALS['HTMLPurifierTest']['PEAR'] = false; // do PEAR tests
+$GLOBALS['HTMLPurifierTest']['PH5P'] = version_compare(PHP_VERSION, "5", ">=") && class_exists('DOMDocument');
 $simpletest_location = 'simpletest/'; // reasonable guess
 
 // load SimpleTest
-@include '../test-settings.php'; // don't mind if it isn't there
+if (file_exists('../test-settings.php')) include '../test-settings.php';
 require_once $simpletest_location . 'unit_tester.php';
 require_once $simpletest_location . 'reporter.php';
 require_once $simpletest_location . 'mock_objects.php';
@@ -79,7 +80,6 @@ if ($test_file = $GLOBALS['HTMLPurifierTest']['File']) {
 } else {
     
     $test = new GroupTest('All Tests');
-
     foreach ($test_files as $test_file) {
         require_once $test_file;
         $test->addTestClass(path2class($test_file));
Implemented
Partially implemented
Will not implement
Not priority to implement
Dangerous attribute/property
Present in CSS1
Feature, requires extra work
Table
border-collapseENUM(collapse, seperate)
border-spaceMULTIPLE
caption-sideENUM(top, bottom)
empty-cellsENUM(show, hide), No IE support makes this useless, possible fix with  ? Unknown release milestone.