4 * Component of HTMLPurifier_AttrContext that accumulates IDs to prevent dupes
5 * @note In Slashdot-speak, dupe means duplicate.
6 * @note This class does not accept $config or $context, thus, it is the
7 * burden of the callee to register the appropriate errors or
10 class HTMLPurifier_IDAccumulator
14 * Lookup table of IDs we've accumulated.
20 * Add an ID to the lookup table.
21 * @param $id ID to be added.
22 * @return Bool status, true if success, false if there's a dupe
25 if (isset($this->ids
[$id])) return false;
26 return $this->ids
[$id] = true;
30 * Load a list of IDs into the lookup table
31 * @param $array_of_ids Array of IDs to load
32 * @note This function doesn't care about duplicates
34 function load($array_of_ids) {
35 foreach ($array_of_ids as $id) {
36 $this->ids
[$id] = true;