]> git.mxchange.org Git - friendica.git/blobdiff - include/xml.php
regenerated master messages.po for new strings in the admin panel
[friendica.git] / include / xml.php
index d2a0f7655bf2af66d7fc2e86297868e0df3aad8d..f45d6cade0cdcf3272ae949ae4bf78ef75f115d9 100644 (file)
@@ -51,8 +51,13 @@ class xml {
                                $element = $xml;
 
                        if (is_integer($key)) {
-                               if (isset($element))
-                                       $element[0] = $value;
+                               if (isset($element)) {
+                                       if (is_scalar($value)) {
+                                               $element[0] = $value;
+                                       } else {
+                                               /// @todo: handle nested array values
+                                       }
+                               }
                                continue;
                        }
 
@@ -64,8 +69,6 @@ class xml {
                                        $element_parts = explode(":", $attr_key);
                                        if ((count($element_parts) > 1) AND isset($namespaces[$element_parts[0]]))
                                                $namespace = $namespaces[$element_parts[0]];
-                                       elseif (isset($namespaces[""]))
-                                               $namespace = $namespaces[""];
                                        else
                                                $namespace = NULL;
 
@@ -147,11 +150,11 @@ class xml {
        /**
         * @brief Convert an XML document to a normalised, case-corrected array
         *   used by webfinger
-        * 
+        *
         * @param object $xml_element The XML document
-        * @param integer $recursion_depth recursion counter for internal use - default 0 
+        * @param integer $recursion_depth recursion counter for internal use - default 0
         *    internal use, recursion counter
-        * 
+        *
         * @return array | sring The array from the xml element or the string
         */
        public static function element_to_array($xml_element, &$recursion_depth=0) {
@@ -197,23 +200,23 @@ class xml {
 
        /**
         * @brief Convert the given XML text to an array in the XML structure.
-        * 
+        *
         * xml::to_array() will convert the given XML text to an array in the XML structure.
         * Link: http://www.bin-co.com/php/scripts/xml2array/
         * Portions significantly re-written by mike@macgirvin.com for Friendica
         * (namespaces, lowercase tags, get_attribute default changed, more...)
-        * 
+        *
         * Examples: $array =  xml::to_array(file_get_contents('feed.xml'));
         *              $array =  xml::to_array(file_get_contents('feed.xml', true, 1, 'attribute'));
-        * 
+        *
         * @param object $contents The XML text
         * @param boolean $namespaces True or false include namespace information
         *      in the returned array as array elements.
-        * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values - 
+        * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values -
         *      this results in a different array structure in the return value.
         * @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting
         *       array sturcture. For 'tag', the tags are given more importance.
-        * 
+        *
         * @return array The parsed XML in an array form. Use print_r() to see the resulting array structure.
         */
        public static function to_array($contents, $namespaces = true, $get_attributes=1, $priority = 'attribute') {