1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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);
- }
- }
- }
-
|