Revision: 2199
Author: olavmrk
Date: Fri Mar  5 07:12:00 2010
Log: SAML2_Utils: Add the new extractStrings()-function.
http://code.google.com/p/simplesamlphp/source/detail?r=2199

Modified:
 /trunk/lib/SAML2/Assertion.php
 /trunk/lib/SAML2/Utils.php

=======================================
--- /trunk/lib/SAML2/Assertion.php      Tue Jan 26 02:07:17 2010
+++ /trunk/lib/SAML2/Assertion.php      Fri Mar  5 07:12:00 2010
@@ -338,10 +338,7 @@
                        }
                        switch ($node->localName) {
                        case 'AudienceRestriction':
-                               $audiences = SAML2_Utils::xpQuery($node, 
'./saml_assertion:Audience');
-                               foreach ($audiences as &$audience) {
-                                       $audience = 
trim($audience->textContent);
-                               }
+ $audiences = SAML2_Utils::extractStrings($node, './saml_assertion:Audience');
                                if ($this->validAudiences === NULL) {
                                        /* The first (and probably last) 
AudienceRestriction element. */
                                        $this->validAudiences = $audiences;
=======================================
--- /trunk/lib/SAML2/Utils.php  Fri Mar  5 07:11:43 2010
+++ /trunk/lib/SAML2/Utils.php  Fri Mar  5 07:12:00 2010
@@ -344,6 +344,25 @@
                        }
                        $ret[$language] = trim($node->textContent);
                }
+
+               return $ret;
+       }
+
+
+       /**
+        * Extract strings from a set of nodes.
+        *
+ * @param DOMElement $parent The element we should rund the XPath query on. + * @param string $query The XPath query we should use to retrieve the nodes.
+        * @return array  The string values of the various nodes.
+        */
+       public static function extractStrings(DOMElement $parent, $query) {
+               assert('is_string($query)');
+
+               $ret = array();
+               foreach (self::xpQuery($parent, $query) as $node) {
+                       $ret[] = trim($node->textContent);
+               }

                return $ret;
        }

--
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.

Reply via email to