123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- class HTMLPurifier_AttrDef_Switch
- {
-
- protected $tag;
-
- protected $withTag;
-
- protected $withoutTag;
-
- public function __construct($tag, $with_tag, $without_tag)
- {
- $this->tag = $tag;
- $this->withTag = $with_tag;
- $this->withoutTag = $without_tag;
- }
-
- public function validate($string, $config, $context)
- {
- $token = $context->get('CurrentToken', true);
- if (!$token || $token->name !== $this->tag) {
- return $this->withoutTag->validate($string, $config, $context);
- } else {
- return $this->withTag->validate($string, $config, $context);
- }
- }
- }
|