File indexing completed on 2024-05-12 06:02:04

0001 <?php
0002 
0003 /**
0004  * Dummy AttrDef that mimics another AttrDef, BUT it generates clones
0005  * with make.
0006  */
0007 class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
0008 {
0009     /**
0010      * What we're cloning.
0011      * @type HTMLPurifier_AttrDef
0012      */
0013     protected $clone;
0014 
0015     /**
0016      * @param HTMLPurifier_AttrDef $clone
0017      */
0018     public function __construct($clone)
0019     {
0020         $this->clone = $clone;
0021     }
0022 
0023     /**
0024      * @param string $v
0025      * @param HTMLPurifier_Config $config
0026      * @param HTMLPurifier_Context $context
0027      * @return bool|string
0028      */
0029     public function validate($v, $config, $context)
0030     {
0031         return $this->clone->validate($v, $config, $context);
0032     }
0033 
0034     /**
0035      * @param string $string
0036      * @return HTMLPurifier_AttrDef
0037      */
0038     public function make($string)
0039     {
0040         return clone $this->clone;
0041     }
0042 }
0043 
0044 // vim: et sw=4 sts=4