|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00006 class HTMLPurifier_AttrDef_Switch 00007 { 00008 00009 protected $tag; 00010 protected $withTag, $withoutTag; 00011 00017 public function __construct($tag, $with_tag, $without_tag) { 00018 $this->tag = $tag; 00019 $this->withTag = $with_tag; 00020 $this->withoutTag = $without_tag; 00021 } 00022 00023 public function validate($string, $config, $context) { 00024 $token = $context->get('CurrentToken', true); 00025 if (!$token || $token->name !== $this->tag) { 00026 return $this->withoutTag->validate($string, $config, $context); 00027 } else { 00028 return $this->withTag->validate($string, $config, $context); 00029 } 00030 } 00031 00032 } 00033 00034 // vim: et sw=4 sts=4