aboutsummaryrefslogtreecommitdiffstats
path: root/library/HTMLPurifier/AttrCollections.php
diff options
context:
space:
mode:
authorChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:22:59 +0100
committerChristian Vogeley <christian.vogeley@hotmail.de>2015-01-11 16:22:59 +0100
commitf0c7612bcd49d32e408e67ac1829ee891c677f7e (patch)
treed4cff4aa2d728524b631776ffffee71f42056421 /library/HTMLPurifier/AttrCollections.php
parent43f143a211c75138d09ceb89acc48ea7d5c31ca9 (diff)
parent10102ac2ac4d5b02012a9794e23656717ab05556 (diff)
downloadvolse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.tar.gz
volse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.tar.bz2
volse-hubzilla-f0c7612bcd49d32e408e67ac1829ee891c677f7e.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: doc/html/classRedmatrix_1_1Import_1_1Import-members.html doc/html/classRedmatrix_1_1Import_1_1Import.js
Diffstat (limited to 'library/HTMLPurifier/AttrCollections.php')
-rw-r--r--library/HTMLPurifier/AttrCollections.php53
1 files changed, 34 insertions, 19 deletions
diff --git a/library/HTMLPurifier/AttrCollections.php b/library/HTMLPurifier/AttrCollections.php
index 555b86d04..4f6c2e39a 100644
--- a/library/HTMLPurifier/AttrCollections.php
+++ b/library/HTMLPurifier/AttrCollections.php
@@ -8,7 +8,8 @@ class HTMLPurifier_AttrCollections
{
/**
- * Associative array of attribute collections, indexed by name
+ * Associative array of attribute collections, indexed by name.
+ * @type array
*/
public $info = array();
@@ -16,10 +17,11 @@ class HTMLPurifier_AttrCollections
* Performs all expansions on internal data for use by other inclusions
* It also collects all attribute collection extensions from
* modules
- * @param $attr_types HTMLPurifier_AttrTypes instance
- * @param $modules Hash array of HTMLPurifier_HTMLModule members
+ * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
+ * @param HTMLPurifier_HTMLModule[] $modules Hash array of HTMLPurifier_HTMLModule members
*/
- public function __construct($attr_types, $modules) {
+ public function __construct($attr_types, $modules)
+ {
// load extensions from the modules
foreach ($modules as $module) {
foreach ($module->attr_collections as $coll_i => $coll) {
@@ -30,7 +32,9 @@ class HTMLPurifier_AttrCollections
if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
// merge in includes
$this->info[$coll_i][$attr_i] = array_merge(
- $this->info[$coll_i][$attr_i], $attr);
+ $this->info[$coll_i][$attr_i],
+ $attr
+ );
continue;
}
$this->info[$coll_i][$attr_i] = $attr;
@@ -49,20 +53,29 @@ class HTMLPurifier_AttrCollections
/**
* Takes a reference to an attribute associative array and performs
* all inclusions specified by the zero index.
- * @param &$attr Reference to attribute array
+ * @param array &$attr Reference to attribute array
*/
- public function performInclusions(&$attr) {
- if (!isset($attr[0])) return;
+ public function performInclusions(&$attr)
+ {
+ if (!isset($attr[0])) {
+ return;
+ }
$merge = $attr[0];
$seen = array(); // recursion guard
// loop through all the inclusions
for ($i = 0; isset($merge[$i]); $i++) {
- if (isset($seen[$merge[$i]])) continue;
+ 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;
+ 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($attr[$key])) {
+ continue;
+ } // also catches more inclusions
$attr[$key] = $value;
}
if (isset($this->info[$merge[$i]][0])) {
@@ -76,20 +89,24 @@ class HTMLPurifier_AttrCollections
/**
* 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
+ * @param array &$attr Reference to attribute array
+ * @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
*/
- public function expandIdentifiers(&$attr, $attr_types) {
-
+ public function expandIdentifiers(&$attr, $attr_types)
+ {
// because foreach will process new elements we add, make sure we
// skip duplicates
$processed = array();
foreach ($attr as $def_i => $def) {
// skip inclusions
- if ($def_i === 0) continue;
+ if ($def_i === 0) {
+ continue;
+ }
- if (isset($processed[$def_i])) continue;
+ if (isset($processed[$def_i])) {
+ continue;
+ }
// determine whether or not attribute is required
if ($required = (strpos($def_i, '*') !== false)) {
@@ -120,9 +137,7 @@ class HTMLPurifier_AttrCollections
unset($attr[$def_i]);
}
}
-
}
-
}
// vim: et sw=4 sts=4