ILIAS  release_4-4 Revision
HTMLPurifier_AttrTransform_NameSync Class Reference

Post-transform that performs validation to the name attribute; if it is present with an equivalent id attribute, it is passed through; otherwise validation is performed. More...

+ Inheritance diagram for HTMLPurifier_AttrTransform_NameSync:
+ Collaboration diagram for HTMLPurifier_AttrTransform_NameSync:

Public Member Functions

 __construct ()
 
 transform ($attr, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_AttrTransform
 transform ($attr, $config, $context)
 Abstract: makes changes to the attributes dependent on multiple values. More...
 
 prependCSS (&$attr, $css)
 Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist. More...
 
 confiscateAttr (&$attr, $key)
 Retrieves and removes an attribute. More...
 

Detailed Description

Post-transform that performs validation to the name attribute; if it is present with an equivalent id attribute, it is passed through; otherwise validation is performed.

Definition at line 8 of file NameSync.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrTransform_NameSync::__construct ( )

Definition at line 11 of file NameSync.php.

11  {
12  $this->idDef = new HTMLPurifier_AttrDef_HTML_ID();
13  }
Validates the HTML attribute ID.
Definition: ID.php:12

Member Function Documentation

◆ transform()

HTMLPurifier_AttrTransform_NameSync::transform (   $attr,
  $config,
  $context 
)

Definition at line 15 of file NameSync.php.

References $result.

15  {
16  if (!isset($attr['name'])) return $attr;
17  $name = $attr['name'];
18  if (isset($attr['id']) && $attr['id'] === $name) return $attr;
19  $result = $this->idDef->validate($name, $config, $context);
20  if ($result === false) unset($attr['name']);
21  else $attr['name'] = $result;
22  return $attr;
23  }
$result

The documentation for this class was generated from the following file: