aboutsummaryrefslogtreecommitdiffstats
path: root/lib/htmlpurifier/library/HTMLPurifier/AttrDef/Clone.php
blob: ce68dbd546916a04a61ba6450fb988556d93468e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

/**
 * Dummy AttrDef that mimics another AttrDef, BUT it generates clones
 * with make.
 */
class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
{
    /**
     * What we're cloning
     */
    protected $clone;

    public function __construct($clone) {
        $this->clone = $clone;
    }

    public function validate($v, $config, $context) {
        return $this->clone->validate($v, $config, $context);
    }

    public function make($string) {
        return clone $this->clone;
    }

}

// vim: et sw=4 sts=4