1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-09 07:36:40 +02:00

[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
This commit is contained in:
Edward Z. Yang
2007-01-14 16:24:02 +00:00
parent 582ffc4143
commit 23d3490d49
4 changed files with 18 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ class HTMLPurifier_AttrDef_ListStyle extends HTMLPurifier_AttrDef
$def = $config->getCSSDefinition();
$this->info['list-style-type'] = $def->info['list-style-type'];
$this->info['list-style-position'] = $def->info['list-style-position'];
$this->info['list-style-image'] = $def->info['list-style-image'];
}
function validate($string, $config, &$context) {
@@ -32,13 +33,14 @@ class HTMLPurifier_AttrDef_ListStyle extends HTMLPurifier_AttrDef
$caught_type = false;
$caught_position = false;
$caught_image = false;
$caught_none = false; // as in keyword none, which is in all of them
$ret = '';
foreach ($bits as $bit) {
if ($caught_none && ($caught_type || $caught_position)) break;
if ($caught_type && $caught_position) break;
if ($caught_none && ($caught_type || $caught_position || $caught_image)) break;
if ($caught_type && $caught_position && $caught_image) break;
if ($bit === '') continue;
@@ -66,6 +68,14 @@ class HTMLPurifier_AttrDef_ListStyle extends HTMLPurifier_AttrDef
$ret .= $r . ' ';
continue;
}
$r = $this->info['list-style-image']->validate($bit, $config, $context);
if ($r !== false) {
if ($caught_image) continue;
$caught_image = true;
$ret .= $r . ' ';
continue;
}
}
$ret = rtrim($ret);