ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HTMLPurifier_AttrDef_Switch Class Reference

Decorator that, depending on a token, switches between two definitions. More...

+ Collaboration diagram for HTMLPurifier_AttrDef_Switch:

Public Member Functions

 __construct ($tag, $with_tag, $without_tag)
 
 validate ($string, $config, $context)
 

Protected Attributes

 $tag
 string More...
 
 $withTag
 HTMLPurifier_AttrDef More...
 
 $withoutTag
 HTMLPurifier_AttrDef More...
 

Detailed Description

Decorator that, depending on a token, switches between two definitions.

Definition at line 6 of file Switch.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrDef_Switch::__construct (   $tag,
  $with_tag,
  $without_tag 
)
Parameters
string$tagTag name to switch upon
HTMLPurifier_AttrDef$with_tagCall if token matches tag
HTMLPurifier_AttrDef$without_tagCall if token doesn't match, or there is no token

Definition at line 29 of file Switch.php.

References $tag.

30  {
31  $this->tag = $tag;
32  $this->withTag = $with_tag;
33  $this->withoutTag = $without_tag;
34  }

Member Function Documentation

◆ validate()

HTMLPurifier_AttrDef_Switch::validate (   $string,
  $config,
  $context 
)
Parameters
string$string
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool|string

Definition at line 42 of file Switch.php.

43  {
44  $token = $context->get('CurrentToken', true);
45  if (!$token || $token->name !== $this->tag) {
46  return $this->withoutTag->validate($string, $config, $context);
47  } else {
48  return $this->withTag->validate($string, $config, $context);
49  }
50  }

Field Documentation

◆ $tag

HTMLPurifier_AttrDef_Switch::$tag
protected

string

Definition at line 12 of file Switch.php.

Referenced by __construct().

◆ $withoutTag

HTMLPurifier_AttrDef_Switch::$withoutTag
protected

HTMLPurifier_AttrDef

Definition at line 22 of file Switch.php.

◆ $withTag

HTMLPurifier_AttrDef_Switch::$withTag
protected

HTMLPurifier_AttrDef

Definition at line 17 of file Switch.php.


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