4 * Post-transform that performs validation to the name attribute; if
5 * it is present with an equivalent id attribute, it is passed through;
6 * otherwise validation is performed.
8 class HTMLPurifier_AttrTransform_NameSync
extends HTMLPurifier_AttrTransform
11 public function __construct()
13 $this->idDef
= new HTMLPurifier_AttrDef_HTML_ID();
18 * @param HTMLPurifier_Config $config
19 * @param HTMLPurifier_Context $context
22 public function transform($attr, $config, $context)
24 if (!isset($attr['name'])) {
27 $name = $attr['name'];
28 if (isset($attr['id']) && $attr['id'] === $name) {
31 $result = $this->idDef
->validate($name, $config, $context);
32 if ($result === false) {
35 $attr['name'] = $result;