Source for file AttrCollections.php
Documentation is available at AttrCollections.php
* Defines common attribute collections that modules reference
* Associative array of attribute collections, indexed by name
* Performs all expansions on internal data for use by other inclusions
* It also collects all attribute collection extensions from
* @param $attr_types HTMLPurifier_AttrTypes instance
* @param $modules Hash array of HTMLPurifier_HTMLModule members
// load extensions from the modules
foreach ($modules as $module) {
foreach ($module->attr_collections as $coll_i =>
$coll) {
if (!isset
($this->info[$coll_i])) {
$this->info[$coll_i] =
array();
foreach ($coll as $attr_i =>
$attr) {
if ($attr_i ===
0 && isset
($this->info[$coll_i][$attr_i])) {
$this->info[$coll_i][$attr_i], $attr);
$this->info[$coll_i][$attr_i] =
$attr;
// perform internal expansions and inclusions
foreach ($this->info as $name =>
$attr) {
// merge attribute collections that include others
// replace string identifiers with actual attribute objects
* Takes a reference to an attribute associative array and performs
* all inclusions specified by the zero index.
* @param &$attr Reference to attribute array
if (!isset
($attr[0])) return;
$seen =
array(); // recursion guard
// loop through all the inclusions
for ($i =
0; isset
($merge[$i]); $i++
) {
if (isset
($seen[$merge[$i]])) continue;
$seen[$merge[$i]] =
true;
// foreach attribute of the inclusion, copy it over
if (!isset
($this->info[$merge[$i]])) continue;
foreach ($this->info[$merge[$i]] as $key =>
$value) {
if (isset
($attr[$key])) continue; // also catches more inclusions
if (isset
($this->info[$merge[$i]][0])) {
* Expands all string identifiers in an attribute array by replacing
* them with the appropriate values inside HTMLPurifier_AttrTypes
* @param &$attr Reference to attribute array
* @param $attr_types HTMLPurifier_AttrTypes instance
// because foreach will process new elements we add, make sure we
foreach ($attr as $def_i =>
$def) {
if ($def_i ===
0) continue;
if (isset
($processed[$def_i])) continue;
// determine whether or not attribute is required
if ($required =
(strpos($def_i, '*') !==
false)) {
$def_i =
trim($def_i, '*');
$processed[$def_i] =
true;
// if we've already got a literal object, move on
// preserve previous required
$attr[$def_i]->required =
($required ||
$attr[$def_i]->required);
if ($t =
$attr_types->get($def)) {
$attr[$def_i]->required =
$required;
Documentation generated on Thu, 19 Jun 2008 18:48:49 -0400 by phpDocumentor 1.4.2