ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

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

Member Function Documentation

◆ transform()

HTMLPurifier_AttrTransform_NameSync::transform (   $attr,
  $config,
  $context 
)
Parameters
array$attr
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
array

Reimplemented from HTMLPurifier_AttrTransform.

Definition at line 22 of file NameSync.php.

23 {
24 if (!isset($attr['name'])) {
25 return $attr;
26 }
27 $name = $attr['name'];
28 if (isset($attr['id']) && $attr['id'] === $name) {
29 return $attr;
30 }
31 $result = $this->idDef->validate($name, $config, $context);
32 if ($result === false) {
33 unset($attr['name']);
34 } else {
35 $attr['name'] = $result;
36 }
37 return $attr;
38 }
$result

References $result.


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