mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-08 23:26:39 +02:00
[1.6.1] Refactor AttrTransform to reduce duplication.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1016 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -9,21 +9,11 @@ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
|
||||
{
|
||||
|
||||
function transform($attr, $config, &$context) {
|
||||
|
||||
if (!isset($attr['name'])) return $attr;
|
||||
|
||||
$name = $attr['name'];
|
||||
unset($attr['name']);
|
||||
|
||||
if (isset($attr['id'])) {
|
||||
// ID already set, discard name
|
||||
return $attr;
|
||||
}
|
||||
|
||||
$attr['id'] = $name;
|
||||
|
||||
$id = $this->confiscateAttr($attr, 'name');
|
||||
if ( isset($attr['id'])) return $attr;
|
||||
$attr['id'] = $id;
|
||||
return $attr;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user