Skip to content
Snippets Groups Projects
Commit 0597e7e9 authored by Olav Morken's avatar Olav Morken
Browse files

SAMLParser: Change processExtensions to use SimpleSAML_Utilities::getDOMChildren.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1975 44740490-163a-0410-bde0-09ae8108e29a
parent ab3e9d79
No related branches found
No related tags found
No related merge requests found
......@@ -927,43 +927,31 @@ class SimpleSAML_Metadata_SAMLParser {
/**
* Parse and process a Extensions element.
*
* @param $element The DOMElement which represents the Organization element.
* @param DOMElement $element The DOMElement which represents the Extensions element.
*/
private function processExtensions($element) {
assert('$element instanceof DOMElement');
for($i = 0; $i < $element->childNodes->length; $i++) {
$child = $element->childNodes->item($i);
private function processExtensions(DOMElement $element) {
/* Skip text nodes. */
if(!$child instanceof DOMElement) continue;
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Scope', '@shibmd')) {
$text = SimpleSAML_Utilities::getDOMText($child);
if (!empty($text)) $this->scopes[] = $text;
foreach (SimpleSAML_Utilities::getDOMChildren($element, 'Scope', '@shibmd') as $scope) {
$scope = SimpleSAML_Utilities::getDOMText($scope);
if (!empty($scope)) {
$this->scopes[] = $scope;
}
if(SimpleSAML_Utilities::isDOMElementOfType($child, 'Attribute', '@saml2')) {
if ($child->getAttribute('Name') === 'tags') {
for($j = 0; $j < $child->childNodes->length; $j++) {
$attributevalue = $child->childNodes->item($j);
if(SimpleSAML_Utilities::isDOMElementOfType($attributevalue, 'AttributeValue', '@saml2')) {
}
$tagname = SimpleSAML_Utilities::getDOMText($attributevalue);
# echo 'attribute tags: ' . $tagname; exit;
if (!empty($tagname)) $this->tags[] = $tagname;
}
foreach (SimpleSAML_Utilities::getDOMChildren($element, 'Attribute', '@saml2') as $attribute) {
$name = $attribute->getAttribute('Name');
$values = array_map(
array('SimpleSAML_Utilities', 'getDOMText'),
SimpleSAML_Utilities::getDOMChildren($attribute, 'AttributeValue', '@saml2')
);
if ($name === 'tags') {
foreach ($values as $tagname) {
if (!empty($tagname)) {
$this->tags[] = $tagname;
}
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment