Clone.php 534 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Dummy AttrDef that mimics another AttrDef, BUT it generates clones
  4. * with make.
  5. */
  6. class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
  7. {
  8. /**
  9. * What we're cloning
  10. */
  11. protected $clone;
  12. public function __construct($clone) {
  13. $this->clone = $clone;
  14. }
  15. public function validate($v, $config, $context) {
  16. return $this->clone->validate($v, $config, $context);
  17. }
  18. public function make($string) {
  19. return clone $this->clone;
  20. }
  21. }
  22. // vim: et sw=4 sts=4