Skip to content

Commit 164b420

Browse files
authored
Merge pull request #168 from mauri870/class-attr-def
Automatically instantiate attributes using php class names
2 parents a7fbdc9 + c6c5dd3 commit 164b420

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Purifier.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ private function addCustomAttributes(array $attributes, HTMLPurifier_HTMLDefinit
143143
}
144144

145145
continue;
146-
}
146+
}
147+
148+
if (class_exists($validValues)) {
149+
$validValues = new $validValues();
150+
}
147151

148152
$definition->addAttribute($onElement, $attrName, $validValues);
149153
}

0 commit comments

Comments
 (0)