Revision: 1975
Author: olavmrk
Date: Fri Nov 6 01:02:35 2009
Log: SAMLParser: Change processExtensions to use
SimpleSAML_Utilities::getDOMChildren.
http://code.google.com/p/simplesamlphp/source/detail?r=1975
Modified:
/trunk/lib/SimpleSAML/Metadata/SAMLParser.php
=======================================
--- /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Fri Nov 6 01:02:25 2009
+++ /trunk/lib/SimpleSAML/Metadata/SAMLParser.php Fri Nov 6 01:02:35 2009
@@ -927,43 +927,31 @@
/**
* 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);
-
- /* 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;
- }
-
-
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;
- }
- }
-
- }
-
- }
-
-
+ private function processExtensions(DOMElement $element) {
+
+ foreach
(SimpleSAML_Utilities::getDOMChildren($element, 'Scope', '@shibmd') as
$scope) {
+ $scope = SimpleSAML_Utilities::getDOMText($scope);
+ if (!empty($scope)) {
+ $this->scopes[] = $scope;
+ }
+ }
+
+ 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;
+ }
+ }
+ }
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simplesamlphp-commits?hl=en
-~----------~----~----~----~------~----~------~--~---