From 9c5f01a0cf3b7db3b18b4419f1d915f7b4169b96 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Tue, 29 May 2007 02:12:08 +0000 Subject: [PATCH] [1.7.0] Fix bug in Bool class - Genericize allElements into basic smoketest, add beginnings of legacy smoketest too. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1113 48356398-32a2-884e-a903-53898d9a118a --- library/HTMLPurifier/AttrDef/HTML/Bool.php | 2 +- smoketests/allElements.php | 28 ------ smoketests/basic.php | 70 ++++++++++++++ smoketests/{ => basic}/allElements.css | 0 smoketests/{ => basic}/allElements.html | 6 +- smoketests/basic/legacy.css | 32 +++++++ smoketests/basic/legacy.html | 101 +++++++++++++++++++++ 7 files changed, 207 insertions(+), 32 deletions(-) delete mode 100644 smoketests/allElements.php create mode 100644 smoketests/basic.php rename smoketests/{ => basic}/allElements.css (100%) rename smoketests/{ => basic}/allElements.html (91%) create mode 100644 smoketests/basic/legacy.css create mode 100644 smoketests/basic/legacy.html diff --git a/library/HTMLPurifier/AttrDef/HTML/Bool.php b/library/HTMLPurifier/AttrDef/HTML/Bool.php index 24bd1de6..7ba3f130 100644 --- a/library/HTMLPurifier/AttrDef/HTML/Bool.php +++ b/library/HTMLPurifier/AttrDef/HTML/Bool.php @@ -15,7 +15,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef function validate($string, $config, &$context) { if (empty($string)) return false; - return $name; + return $this->name; } /** diff --git a/smoketests/allElements.php b/smoketests/allElements.php deleted file mode 100644 index faa600da..00000000 --- a/smoketests/allElements.php +++ /dev/null @@ -1,28 +0,0 @@ -'; -?> - - - HTML Purifier UTF-8 Smoketest - - - - -set('Attr', 'EnableID', true); - -$purifier = new HTMLPurifier($config); -echo $purifier->purify(file_get_contents('allElements.html')); - -?> - - \ No newline at end of file diff --git a/smoketests/basic.php b/smoketests/basic.php new file mode 100644 index 00000000..7c791be5 --- /dev/null +++ b/smoketests/basic.php @@ -0,0 +1,70 @@ + true, + 'legacy' => true +); + +$page = isset($_GET['p']) ? $_GET['p'] : false; +if (!isset($allowed[$page])) $page = false; + +$strict = isset($_GET['d']) ? (bool) $_GET['d'] : false; + +echo ''; +?> + + + + + + + + HTML Purifier Basic Smoketest + + + + + +
: +Swap
+Valid XHTML 1.0 Transitional +
+set('Attr', 'EnableID', true); + $config->set('HTML', 'Strict', $strict); + $purifier = new HTMLPurifier($config); + echo $purifier->purify(file_get_contents("basic/$page.html")); +} else { + ?> +

HTML Purifier Basic Smoketest Index

+ + + \ No newline at end of file diff --git a/smoketests/allElements.css b/smoketests/basic/allElements.css similarity index 100% rename from smoketests/allElements.css rename to smoketests/basic/allElements.css diff --git a/smoketests/allElements.html b/smoketests/basic/allElements.html similarity index 91% rename from smoketests/allElements.html rename to smoketests/basic/allElements.html index b476f813..a3fa408a 100644 --- a/smoketests/allElements.html +++ b/smoketests/basic/allElements.html @@ -4,15 +4,15 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd"> - HTML Purifier All Elements Smoketest Test Data + HTML Purifier All Elements Smoketest -

HTML Purifier All Elements Smoketest Test Data

+

HTML Purifier All Elements Smoketest

-

This file includes all the test data for the all elements smoke +

This is the all elements smoke test. It is divided by XHTML 1.1 style modules. Make sure div, span and id are allowed, otherwise there will be problems.

diff --git a/smoketests/basic/legacy.css b/smoketests/basic/legacy.css new file mode 100644 index 00000000..34fbeff7 --- /dev/null +++ b/smoketests/basic/legacy.css @@ -0,0 +1,32 @@ + +center, +dir[compact='compact'], +isindex[prompt='Foo'], +menu[compact='compact'], +s, +u, +strike, + +caption[align='bottom'], +div[align='center'], +dl[compact='compact'], + +h1[align='right'], +h2[align='right'], +h3[align='right'], +h4[align='right'], +h5[align='right'], +h6[align='right'], + +hr[align='right'], +hr[noshade='noshade'], +hr[width='50'], +hr[size='50'], + +.insert-declarations-above + {background:#008000; color:#FFF; font-weight:bold;} + +font {background:#BFB;} +u {border:1px solid #000;} +hr {height:1em;} +hr[size='50'] {height:50px;} \ No newline at end of file diff --git a/smoketests/basic/legacy.html b/smoketests/basic/legacy.html new file mode 100644 index 00000000..a34aabeb --- /dev/null +++ b/smoketests/basic/legacy.html @@ -0,0 +1,101 @@ + + + + + HTML Purifier Legacy Smoketest Test Data + + + + + +

HTML Purifier Legacy Smoketest Test Data

+ +

This is the legacy smoketest.

+ +

Elements

+ +
+
+ + basefont: Green, Arial, size 6 text (IE-only) +
+ +
center
+ + +
  • dir
  • +
    + +font: Green, Arial, size 6 text + +isindex: + + + +
  • menu
  • +
    + +s strike u +
    + +

    Attributes

    + +
    + + +
    *
    +
    +

    br@clear (asterisk is up)

    + + + + +
    caption@align
    Cell
    + +
    div@center
    + +
    +
    dl@compact
    +
    + +

    h1

    +

    h2

    +

    h3

    +

    h4

    +
    h5
    +
    h6
    + +hr@align +
    +hr@noshade +
    +hr@width +
    +hr@size +
    + + +
    + + + + + \ No newline at end of file