From: Adam Magness Date: Mon, 20 Nov 2017 17:56:31 +0000 (-0500) Subject: XML class standards X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ddacbf2c136c05a8ecf0aa65f8afdbce6134b95c;p=friendica.git XML class standards updated the xml class for PSR-2 --- diff --git a/include/api.php b/include/api.php index 2cfdcf0241..9f91139d1f 100644 --- a/include/api.php +++ b/include/api.php @@ -902,7 +902,7 @@ function api_create_xml($data, $root_element) $data3 = array($root_element => $data2); - $ret = XML::from_array($data3, $xml, false, $namespaces); + $ret = XML::fromArray($data3, $xml, false, $namespaces); return $ret; } diff --git a/include/network.php b/include/network.php index e9cfe86035..c11cdb2c6c 100644 --- a/include/network.php +++ b/include/network.php @@ -414,7 +414,7 @@ function xml_status($st, $message = '') $xmldata = array("result" => $result); - echo XML::from_array($xmldata, $xml); + echo XML::fromArray($xmldata, $xml); killme(); } diff --git a/include/salmon.php b/include/salmon.php index 9a1ef72e5b..264b92e801 100644 --- a/include/salmon.php +++ b/include/salmon.php @@ -112,7 +112,7 @@ function slapper($owner, $url, $slap) $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); - $salmon = XML::from_array($xmldata, $xml, false, $namespaces); + $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them post_url($url, $salmon, array( @@ -138,7 +138,7 @@ function slapper($owner, $url, $slap) $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); - $salmon = XML::from_array($xmldata, $xml, false, $namespaces); + $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them post_url($url, $salmon, array( @@ -161,7 +161,7 @@ function slapper($owner, $url, $slap) $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); - $salmon = XML::from_array($xmldata, $xml, false, $namespaces); + $salmon = XML::fromArray($xmldata, $xml, false, $namespaces); // slap them post_url($url, $salmon, array( diff --git a/mod/ping.php b/mod/ping.php index 39882d5e39..3ab316d45c 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -115,7 +115,7 @@ function ping_init(App $a) } } else { header("Content-type: text/xml"); - echo XML::from_array($data, $xml); + echo XML::fromArray($data, $xml); } killme(); } @@ -412,7 +412,7 @@ function ping_init(App $a) $data = ping_format_xml_data($data, $sysnotify_count, $notifications, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen); header("Content-type: text/xml"); - echo XML::from_array(array("result" => $data), $xml); + echo XML::fromArray(array("result" => $data), $xml); } killme(); diff --git a/src/Network/Probe.php b/src/Network/Probe.php index cb5fcd8b27..6001489ec7 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -127,7 +127,7 @@ class Probe return array(); } - $links = XML::element_to_array($xrd); + $links = XML::elementToArray($xrd); if (!isset($links["xrd"]["link"])) { logger("No xrd data found for ".$host, LOGGER_DEBUG); return array(); @@ -712,7 +712,7 @@ class Probe return false; } - $xrd_arr = XML::element_to_array($xrd); + $xrd_arr = XML::elementToArray($xrd); if (!isset($xrd_arr["xrd"]["link"])) { logger("No XML webfinger links for ".$url, LOGGER_DEBUG); return false; diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 592bca83c4..9a378d874c 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -403,17 +403,17 @@ class DFRN $mail = $doc->createElement("dfrn:mail"); $sender = $doc->createElement("dfrn:sender"); - XML::add_element($doc, $sender, "dfrn:name", $owner['name']); - XML::add_element($doc, $sender, "dfrn:uri", $owner['url']); - XML::add_element($doc, $sender, "dfrn:avatar", $owner['thumb']); + XML::addElement($doc, $sender, "dfrn:name", $owner['name']); + XML::addElement($doc, $sender, "dfrn:uri", $owner['url']); + XML::addElement($doc, $sender, "dfrn:avatar", $owner['thumb']); $mail->appendChild($sender); - XML::add_element($doc, $mail, "dfrn:id", $item['uri']); - XML::add_element($doc, $mail, "dfrn:in-reply-to", $item['parent-uri']); - XML::add_element($doc, $mail, "dfrn:sentdate", datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)); - XML::add_element($doc, $mail, "dfrn:subject", $item['title']); - XML::add_element($doc, $mail, "dfrn:content", $item['body']); + XML::addElement($doc, $mail, "dfrn:id", $item['uri']); + XML::addElement($doc, $mail, "dfrn:in-reply-to", $item['parent-uri']); + XML::addElement($doc, $mail, "dfrn:sentdate", datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)); + XML::addElement($doc, $mail, "dfrn:subject", $item['title']); + XML::addElement($doc, $mail, "dfrn:content", $item['body']); $root->appendChild($mail); @@ -438,11 +438,11 @@ class DFRN $suggest = $doc->createElement("dfrn:suggest"); - XML::add_element($doc, $suggest, "dfrn:url", $item['url']); - XML::add_element($doc, $suggest, "dfrn:name", $item['name']); - XML::add_element($doc, $suggest, "dfrn:photo", $item['photo']); - XML::add_element($doc, $suggest, "dfrn:request", $item['request']); - XML::add_element($doc, $suggest, "dfrn:note", $item['note']); + XML::addElement($doc, $suggest, "dfrn:url", $item['url']); + XML::addElement($doc, $suggest, "dfrn:name", $item['name']); + XML::addElement($doc, $suggest, "dfrn:photo", $item['photo']); + XML::addElement($doc, $suggest, "dfrn:request", $item['request']); + XML::addElement($doc, $suggest, "dfrn:note", $item['note']); $root->appendChild($suggest); @@ -490,18 +490,18 @@ class DFRN $relocate = $doc->createElement("dfrn:relocate"); - XML::add_element($doc, $relocate, "dfrn:url", $owner['url']); - XML::add_element($doc, $relocate, "dfrn:name", $owner['name']); - XML::add_element($doc, $relocate, "dfrn:addr", $owner['addr']); - XML::add_element($doc, $relocate, "dfrn:avatar", $owner['avatar']); - XML::add_element($doc, $relocate, "dfrn:photo", $photos[4]); - XML::add_element($doc, $relocate, "dfrn:thumb", $photos[5]); - XML::add_element($doc, $relocate, "dfrn:micro", $photos[6]); - XML::add_element($doc, $relocate, "dfrn:request", $owner['request']); - XML::add_element($doc, $relocate, "dfrn:confirm", $owner['confirm']); - XML::add_element($doc, $relocate, "dfrn:notify", $owner['notify']); - XML::add_element($doc, $relocate, "dfrn:poll", $owner['poll']); - XML::add_element($doc, $relocate, "dfrn:sitepubkey", Config::get('system','site_pubkey')); + XML::addElement($doc, $relocate, "dfrn:url", $owner['url']); + XML::addElement($doc, $relocate, "dfrn:name", $owner['name']); + XML::addElement($doc, $relocate, "dfrn:addr", $owner['addr']); + XML::addElement($doc, $relocate, "dfrn:avatar", $owner['avatar']); + XML::addElement($doc, $relocate, "dfrn:photo", $photos[4]); + XML::addElement($doc, $relocate, "dfrn:thumb", $photos[5]); + XML::addElement($doc, $relocate, "dfrn:micro", $photos[6]); + XML::addElement($doc, $relocate, "dfrn:request", $owner['request']); + XML::addElement($doc, $relocate, "dfrn:confirm", $owner['confirm']); + XML::addElement($doc, $relocate, "dfrn:notify", $owner['notify']); + XML::addElement($doc, $relocate, "dfrn:poll", $owner['poll']); + XML::addElement($doc, $relocate, "dfrn:sitepubkey", Config::get('system','site_pubkey')); $root->appendChild($relocate); @@ -540,17 +540,17 @@ class DFRN $root->setAttribute("xmlns:ostatus", NAMESPACE_OSTATUS); $root->setAttribute("xmlns:statusnet", NAMESPACE_STATUSNET); - XML::add_element($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); - XML::add_element($doc, $root, "title", $owner["name"]); + XML::addElement($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); + XML::addElement($doc, $root, "title", $owner["name"]); $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION); - XML::add_element($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); + XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); $attributes = array("rel" => "license", "href" => "http://creativecommons.org/licenses/by/3.0/"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $alternatelink); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); if ($public) { @@ -558,26 +558,26 @@ class DFRN OStatus::hublinks($doc, $root, $owner["nick"]); $attributes = array("rel" => "salmon", "href" => System::baseUrl()."/salmon/".$owner["nick"]); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => System::baseUrl()."/salmon/".$owner["nick"]); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => System::baseUrl()."/salmon/".$owner["nick"]); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); } // For backward compatibility we keep this element if ($owner['page-flags'] == PAGE_COMMUNITY) { - XML::add_element($doc, $root, "dfrn:community", 1); + XML::addElement($doc, $root, "dfrn:community", 1); } // The former element is replaced by this one - XML::add_element($doc, $root, "dfrn:account_type", $owner["account-type"]); + XML::addElement($doc, $root, "dfrn:account_type", $owner["account-type"]); /// @todo We need a way to transmit the different page flags like "PAGE_PRVGROUP" - XML::add_element($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME)); + XML::addElement($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME)); $author = self::add_author($doc, $owner, $authorelement, $public); $root->appendChild($author); @@ -621,9 +621,9 @@ class DFRN $attributes = array("dfrn:updated" => $namdate); } - XML::add_element($doc, $author, "name", $owner["name"], $attributes); - XML::add_element($doc, $author, "uri", System::baseUrl().'/profile/'.$owner["nickname"], $attributes); - XML::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes); + XML::addElement($doc, $author, "name", $owner["name"], $attributes); + XML::addElement($doc, $author, "uri", System::baseUrl().'/profile/'.$owner["nickname"], $attributes); + XML::addElement($doc, $author, "dfrn:handle", $owner["addr"], $attributes); $attributes = array("rel" => "photo", "type" => "image/jpeg", "media:width" => 175, "media:height" => 175, "href" => $owner['photo']); @@ -632,13 +632,13 @@ class DFRN $attributes["dfrn:updated"] = $picdate; } - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); $attributes["rel"] = "avatar"; - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); if ($hidewall) { - XML::add_element($doc, $author, "dfrn:hide", "true"); + XML::addElement($doc, $author, "dfrn:hide", "true"); } // The following fields will only be generated if the data isn't meant for a public feed @@ -649,7 +649,7 @@ class DFRN $birthday = feed_birthday($owner['uid'], $owner['timezone']); if ($birthday) { - XML::add_element($doc, $author, "dfrn:birthday", $birthday); + XML::addElement($doc, $author, "dfrn:birthday", $birthday); } // Only show contact details when we are allowed to @@ -665,26 +665,26 @@ class DFRN if (DBM::is_result($r)) { $profile = $r[0]; - XML::add_element($doc, $author, "poco:displayName", $profile["name"]); - XML::add_element($doc, $author, "poco:updated", $namdate); + XML::addElement($doc, $author, "poco:displayName", $profile["name"]); + XML::addElement($doc, $author, "poco:updated", $namdate); if (trim($profile["dob"]) > '0001-01-01') { - XML::add_element($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"]))); + XML::addElement($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"]))); } - XML::add_element($doc, $author, "poco:note", $profile["about"]); - XML::add_element($doc, $author, "poco:preferredUsername", $profile["nickname"]); + XML::addElement($doc, $author, "poco:note", $profile["about"]); + XML::addElement($doc, $author, "poco:preferredUsername", $profile["nickname"]); $savetz = date_default_timezone_get(); date_default_timezone_set($profile["timezone"]); - XML::add_element($doc, $author, "poco:utcOffset", date("P")); + XML::addElement($doc, $author, "poco:utcOffset", date("P")); date_default_timezone_set($savetz); if (trim($profile["homepage"]) != "") { $urls = $doc->createElement("poco:urls"); - XML::add_element($doc, $urls, "poco:type", "homepage"); - XML::add_element($doc, $urls, "poco:value", $profile["homepage"]); - XML::add_element($doc, $urls, "poco:primary", "true"); + XML::addElement($doc, $urls, "poco:type", "homepage"); + XML::addElement($doc, $urls, "poco:value", $profile["homepage"]); + XML::addElement($doc, $urls, "poco:primary", "true"); $author->appendChild($urls); } @@ -692,33 +692,33 @@ class DFRN $keywords = explode(",", $profile["pub_keywords"]); foreach ($keywords as $keyword) { - XML::add_element($doc, $author, "poco:tags", trim($keyword)); + XML::addElement($doc, $author, "poco:tags", trim($keyword)); } } if (trim($profile["xmpp"]) != "") { $ims = $doc->createElement("poco:ims"); - XML::add_element($doc, $ims, "poco:type", "xmpp"); - XML::add_element($doc, $ims, "poco:value", $profile["xmpp"]); - XML::add_element($doc, $ims, "poco:primary", "true"); + XML::addElement($doc, $ims, "poco:type", "xmpp"); + XML::addElement($doc, $ims, "poco:value", $profile["xmpp"]); + XML::addElement($doc, $ims, "poco:primary", "true"); $author->appendChild($ims); } if (trim($profile["locality"].$profile["region"].$profile["country-name"]) != "") { $element = $doc->createElement("poco:address"); - XML::add_element($doc, $element, "poco:formatted", Profile::formatLocation($profile)); + XML::addElement($doc, $element, "poco:formatted", Profile::formatLocation($profile)); if (trim($profile["locality"]) != "") { - XML::add_element($doc, $element, "poco:locality", $profile["locality"]); + XML::addElement($doc, $element, "poco:locality", $profile["locality"]); } if (trim($profile["region"]) != "") { - XML::add_element($doc, $element, "poco:region", $profile["region"]); + XML::addElement($doc, $element, "poco:region", $profile["region"]); } if (trim($profile["country-name"]) != "") { - XML::add_element($doc, $element, "poco:country", $profile["country-name"]); + XML::addElement($doc, $element, "poco:country", $profile["country-name"]); } $author->appendChild($element); @@ -744,9 +744,9 @@ class DFRN $contact = Contact::getDetailsByURL($contact_url, $item["uid"]); $author = $doc->createElement($element); - XML::add_element($doc, $author, "name", $contact["name"]); - XML::add_element($doc, $author, "uri", $contact["url"]); - XML::add_element($doc, $author, "dfrn:handle", $contact["addr"]); + XML::addElement($doc, $author, "name", $contact["name"]); + XML::addElement($doc, $author, "uri", $contact["url"]); + XML::addElement($doc, $author, "dfrn:handle", $contact["addr"]); /// @Todo /// - Check real image type and image size @@ -757,7 +757,7 @@ class DFRN "media:width" => 80, "media:height" => 80, "href" => $contact["photo"]); - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); $attributes = array( "rel" => "avatar", @@ -765,7 +765,7 @@ class DFRN "media:width" => 80, "media:height" => 80, "href" => $contact["photo"]); - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); return $author; } @@ -790,13 +790,13 @@ class DFRN return false; } if ($r->type) { - XML::add_element($doc, $entry, "activity:object-type", $r->type); + XML::addElement($doc, $entry, "activity:object-type", $r->type); } if ($r->id) { - XML::add_element($doc, $entry, "id", $r->id); + XML::addElement($doc, $entry, "id", $r->id); } if ($r->title) { - XML::add_element($doc, $entry, "title", $r->title); + XML::addElement($doc, $entry, "title", $r->title); } if ($r->link) { @@ -815,16 +815,16 @@ class DFRN foreach ($link->attributes() as $parameter => $value) { $attributes[$parameter] = $value; } - XML::add_element($doc, $entry, "link", "", $attributes); + XML::addElement($doc, $entry, "link", "", $attributes); } } } else { $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $r->link); - XML::add_element($doc, $entry, "link", "", $attributes); + XML::addElement($doc, $entry, "link", "", $attributes); } } if ($r->content) { - XML::add_element($doc, $entry, "content", bbcode($r->content), array("type" => "html")); + XML::addElement($doc, $entry, "content", bbcode($r->content), array("type" => "html")); } return $entry; @@ -863,7 +863,7 @@ class DFRN $attributes["title"] = trim($matches[4]); } - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); } } } @@ -893,7 +893,7 @@ class DFRN if ($item['deleted']) { $attributes = array("ref" => $item['uri'], "when" => datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00', ATOM_TIME)); - return XML::create_element($doc, "at:deleted-entry", "", $attributes); + return XML::createElement($doc, "at:deleted-entry", "", $attributes); } if (!$single) { @@ -944,7 +944,7 @@ class DFRN $attributes = array("ref" => $parent_item, "type" => "text/html", "href" => $parent[0]['plink'], "dfrn:diaspora_guid" => $parent[0]['guid']); - XML::add_element($doc, $entry, "thr:in-reply-to", "", $attributes); + XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes); } // Add conversation data. This is used for OStatus @@ -967,23 +967,23 @@ class DFRN "href" => $conversation_href, "ref" => $conversation_uri); - XML::add_element($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes); + XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes); - XML::add_element($doc, $entry, "id", $item["uri"]); - XML::add_element($doc, $entry, "title", $item["title"]); + XML::addElement($doc, $entry, "id", $item["uri"]); + XML::addElement($doc, $entry, "title", $item["title"]); - XML::add_element($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"] . "+00:00", ATOM_TIME)); - XML::add_element($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"] . "+00:00", ATOM_TIME)); + XML::addElement($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"] . "+00:00", ATOM_TIME)); + XML::addElement($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"] . "+00:00", ATOM_TIME)); // "dfrn:env" is used to read the content - XML::add_element($doc, $entry, "dfrn:env", base64url_encode($body, true)); + XML::addElement($doc, $entry, "dfrn:env", base64url_encode($body, true)); // The "content" field is not read by the receiver. We could remove it when the type is "text" // We keep it at the moment, maybe there is some old version that doesn't read "dfrn:env" - XML::add_element($doc, $entry, "content", (($type == 'html') ? $htmlbody : $body), array("type" => $type)); + XML::addElement($doc, $entry, "content", (($type == 'html') ? $htmlbody : $body), array("type" => $type)); // We save this value in "plink". Maybe we should read it from there as well? - XML::add_element( + XML::addElement( $doc, $entry, "link", @@ -995,50 +995,50 @@ class DFRN // "comment-allow" is some old fashioned stuff for old Friendica versions. // It is included in the rewritten code for completeness if ($comment) { - XML::add_element($doc, $entry, "dfrn:comment-allow", intval($item['last-child'])); + XML::addElement($doc, $entry, "dfrn:comment-allow", intval($item['last-child'])); } if ($item['location']) { - XML::add_element($doc, $entry, "dfrn:location", $item['location']); + XML::addElement($doc, $entry, "dfrn:location", $item['location']); } if ($item['coord']) { - XML::add_element($doc, $entry, "georss:point", $item['coord']); + XML::addElement($doc, $entry, "georss:point", $item['coord']); } if (($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) { - XML::add_element($doc, $entry, "dfrn:private", (($item['private']) ? $item['private'] : 1)); + XML::addElement($doc, $entry, "dfrn:private", (($item['private']) ? $item['private'] : 1)); } if ($item['extid']) { - XML::add_element($doc, $entry, "dfrn:extid", $item['extid']); + XML::addElement($doc, $entry, "dfrn:extid", $item['extid']); } if ($item['bookmark']) { - XML::add_element($doc, $entry, "dfrn:bookmark", "true"); + XML::addElement($doc, $entry, "dfrn:bookmark", "true"); } if ($item['app']) { - XML::add_element($doc, $entry, "statusnet:notice_info", "", array("local_id" => $item['id'], "source" => $item['app'])); + XML::addElement($doc, $entry, "statusnet:notice_info", "", array("local_id" => $item['id'], "source" => $item['app'])); } - XML::add_element($doc, $entry, "dfrn:diaspora_guid", $item["guid"]); + XML::addElement($doc, $entry, "dfrn:diaspora_guid", $item["guid"]); // The signed text contains the content in Markdown, the sender handle and the signatur for the content // It is needed for relayed comments to Diaspora. if ($item['signed_text']) { $sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer']))); - XML::add_element($doc, $entry, "dfrn:diaspora_signature", $sign); + XML::addElement($doc, $entry, "dfrn:diaspora_signature", $sign); } - XML::add_element($doc, $entry, "activity:verb", construct_verb($item)); + XML::addElement($doc, $entry, "activity:verb", construct_verb($item)); if ($item['object-type'] != "") { - XML::add_element($doc, $entry, "activity:object-type", $item['object-type']); + XML::addElement($doc, $entry, "activity:object-type", $item['object-type']); } elseif ($item['id'] == $item['parent']) { - XML::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE); + XML::addElement($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE); } else { - XML::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_COMMENT); + XML::addElement($doc, $entry, "activity:object-type", ACTIVITY_OBJ_COMMENT); } $actobj = self::create_activity($doc, "activity:object", $item['object']); @@ -1056,7 +1056,7 @@ class DFRN if (count($tags)) { foreach ($tags as $t) { if (($type != 'html') || ($t[0] != "@")) { - XML::add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2])); + XML::addElement($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2])); } } } @@ -1077,7 +1077,7 @@ class DFRN ); if (DBM::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) { - XML::add_element( + XML::addElement( $doc, $entry, "link", @@ -1087,7 +1087,7 @@ class DFRN "href" => $mention) ); } else { - XML::add_element( + XML::addElement( $doc, $entry, "link", @@ -1704,7 +1704,7 @@ class DFRN $obj_element = $obj_doc->createElementNS(NAMESPACE_ATOM1, $element); $activity_type = $xpath->query("activity:object-type/text()", $activity)->item(0)->nodeValue; - XML::add_element($obj_doc, $obj_element, "type", $activity_type); + XML::addElement($obj_doc, $obj_element, "type", $activity_type); $id = $xpath->query("atom:id", $activity)->item(0); if (is_object($id)) { diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index ccd1ec594b..1a320d14e2 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1913,7 +1913,7 @@ class Diaspora "title" => "", "content" => $parent_body)); - return XML::from_array($xmldata, $xml, true); + return XML::fromArray($xmldata, $xml, true); } /** @@ -2345,7 +2345,7 @@ class Diaspora "id" => $contact["url"]."/".$contact["name"], "link" => $link)); - return XML::from_array($xmldata, $xml, true); + return XML::fromArray($xmldata, $xml, true); } /** @@ -3040,7 +3040,7 @@ class Diaspora $namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env"); - return XML::from_array($xmldata, $xml, false, $namespaces); + return XML::fromArray($xmldata, $xml, false, $namespaces); } /** @@ -3173,7 +3173,7 @@ class Diaspora { $data = array($type => $message); - return XML::from_array($data, $xml); + return XML::fromArray($data, $xml); } /** diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index dfdc75498d..5d765bf6f8 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1250,39 +1250,39 @@ class OStatus $root->setAttribute("xmlns:mastodon", NAMESPACE_MASTODON); $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION); - XML::add_element($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); - XML::add_element($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); - XML::add_element($doc, $root, "title", sprintf("%s timeline", $owner["name"])); - XML::add_element($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], $a->config["sitename"])); - XML::add_element($doc, $root, "logo", $owner["photo"]); - XML::add_element($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME)); + XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); + XML::addElement($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); + XML::addElement($doc, $root, "title", sprintf("%s timeline", $owner["name"])); + XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], $a->config["sitename"])); + XML::addElement($doc, $root, "logo", $owner["photo"]); + XML::addElement($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME)); $author = self::addAuthor($doc, $owner); $root->appendChild($author); $attributes = array("href" => $owner["url"], "rel" => "alternate", "type" => "text/html"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); /// @TODO We have to find out what this is /// $attributes = array("href" => System::baseUrl()."/sup", /// "rel" => "http://api.friendfeed.com/2008/03#sup", /// "type" => "application/json"); - /// XML::add_element($doc, $root, "link", "", $attributes); + /// XML::addElement($doc, $root, "link", "", $attributes); self::hublinks($doc, $root, $owner["nick"]); $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "salmon"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("href" => System::baseUrl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); $attributes = array("href" => System::baseUrl()."/api/statuses/user_timeline/".$owner["nick"].".atom", "rel" => "self", "type" => "application/atom+xml"); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); return $root; } @@ -1297,7 +1297,7 @@ class OStatus public static function hublinks($doc, $root, $nick) { $h = System::baseUrl() . '/pubsubhubbub/'.$nick; - XML::add_element($doc, $root, "link", "", array("href" => $h, "rel" => "hub")); + XML::addElement($doc, $root, "link", "", array("href" => $h, "rel" => "hub")); } /** @@ -1319,7 +1319,7 @@ class OStatus "href" => $siteinfo["image"], "type" => $imgdata["mime"], "length" => intval($imgdata["size"])); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); break; case 'video': $attributes = array("rel" => "enclosure", @@ -1327,7 +1327,7 @@ class OStatus "type" => "text/html; charset=UTF-8", "length" => "", "title" => $siteinfo["title"]); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); break; default: break; @@ -1340,7 +1340,7 @@ class OStatus "type" => $imgdata["mime"], "length" => intval($imgdata["size"])); - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); } $arr = explode('[/attach],', $item['attach']); @@ -1359,7 +1359,7 @@ class OStatus if (trim($matches[4]) != "") { $attributes["title"] = trim($matches[4]); } - XML::add_element($doc, $root, "link", "", $attributes); + XML::addElement($doc, $root, "link", "", $attributes); } } } @@ -1380,15 +1380,15 @@ class OStatus $profile = $r[0]; } $author = $doc->createElement("author"); - XML::add_element($doc, $author, "id", $owner["url"]); - XML::add_element($doc, $author, "activity:object-type", ACTIVITY_OBJ_PERSON); - XML::add_element($doc, $author, "uri", $owner["url"]); - XML::add_element($doc, $author, "name", $owner["nick"]); - XML::add_element($doc, $author, "email", $owner["addr"]); - XML::add_element($doc, $author, "summary", bbcode($owner["about"], false, false, 7)); + XML::addElement($doc, $author, "id", $owner["url"]); + XML::addElement($doc, $author, "activity:object-type", ACTIVITY_OBJ_PERSON); + XML::addElement($doc, $author, "uri", $owner["url"]); + XML::addElement($doc, $author, "name", $owner["nick"]); + XML::addElement($doc, $author, "email", $owner["addr"]); + XML::addElement($doc, $author, "summary", bbcode($owner["about"], false, false, 7)); $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $owner["url"]); - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); $attributes = array( "rel" => "avatar", @@ -1396,7 +1396,7 @@ class OStatus "media:width" => 175, "media:height" => 175, "href" => $owner["photo"]); - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); if (isset($owner["thumb"])) { $attributes = array( @@ -1405,34 +1405,34 @@ class OStatus "media:width" => 80, "media:height" => 80, "href" => $owner["thumb"]); - XML::add_element($doc, $author, "link", "", $attributes); + XML::addElement($doc, $author, "link", "", $attributes); } - XML::add_element($doc, $author, "poco:preferredUsername", $owner["nick"]); - XML::add_element($doc, $author, "poco:displayName", $owner["name"]); - XML::add_element($doc, $author, "poco:note", bbcode($owner["about"], false, false, 7)); + XML::addElement($doc, $author, "poco:preferredUsername", $owner["nick"]); + XML::addElement($doc, $author, "poco:displayName", $owner["name"]); + XML::addElement($doc, $author, "poco:note", bbcode($owner["about"], false, false, 7)); if (trim($owner["location"]) != "") { $element = $doc->createElement("poco:address"); - XML::add_element($doc, $element, "poco:formatted", $owner["location"]); + XML::addElement($doc, $element, "poco:formatted", $owner["location"]); $author->appendChild($element); } if (trim($profile["homepage"]) != "") { $urls = $doc->createElement("poco:urls"); - XML::add_element($doc, $urls, "poco:type", "homepage"); - XML::add_element($doc, $urls, "poco:value", $profile["homepage"]); - XML::add_element($doc, $urls, "poco:primary", "true"); + XML::addElement($doc, $urls, "poco:type", "homepage"); + XML::addElement($doc, $urls, "poco:value", $profile["homepage"]); + XML::addElement($doc, $urls, "poco:primary", "true"); $author->appendChild($urls); } if (count($profile)) { - XML::add_element($doc, $author, "followers", "", array("url" => System::baseUrl()."/viewcontacts/".$owner["nick"])); - XML::add_element($doc, $author, "statusnet:profile_info", "", array("local_id" => $owner["uid"])); + XML::addElement($doc, $author, "followers", "", array("url" => System::baseUrl()."/viewcontacts/".$owner["nick"])); + XML::addElement($doc, $author, "statusnet:profile_info", "", array("local_id" => $owner["uid"])); } if ($profile["publish"]) { - XML::add_element($doc, $author, "mastodon:scope", "public"); + XML::addElement($doc, $author, "mastodon:scope", "public"); } return $author; } @@ -1514,12 +1514,12 @@ class OStatus private static function sourceEntry($doc, $contact) { $source = $doc->createElement("source"); - XML::add_element($doc, $source, "id", $contact["poll"]); - XML::add_element($doc, $source, "title", $contact["name"]); - XML::add_element($doc, $source, "link", "", array("rel" => "alternate", "type" => "text/html", "href" => $contact["alias"])); - XML::add_element($doc, $source, "link", "", array("rel" => "self", "type" => "application/atom+xml", "href" => $contact["poll"])); - XML::add_element($doc, $source, "icon", $contact["photo"]); - XML::add_element($doc, $source, "updated", datetime_convert("UTC", "UTC", $contact["success_update"]."+00:00", ATOM_TIME)); + XML::addElement($doc, $source, "id", $contact["poll"]); + XML::addElement($doc, $source, "title", $contact["name"]); + XML::addElement($doc, $source, "link", "", array("rel" => "alternate", "type" => "text/html", "href" => $contact["alias"])); + XML::addElement($doc, $source, "link", "", array("rel" => "self", "type" => "application/atom+xml", "href" => $contact["poll"])); + XML::addElement($doc, $source, "icon", $contact["photo"]); + XML::addElement($doc, $source, "updated", datetime_convert("UTC", "UTC", $contact["success_update"]."+00:00", ATOM_TIME)); return $source; } @@ -1618,7 +1618,7 @@ class OStatus $as_object = $doc->createElement("activity:object"); - XML::add_element($doc, $as_object, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA."activity"); + XML::addElement($doc, $as_object, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA."activity"); self::entryContent($doc, $as_object, $repeated_item, $owner, "", "", false); @@ -1627,7 +1627,7 @@ class OStatus $as_object2 = $doc->createElement("activity:object"); - XML::add_element($doc, $as_object2, "activity:object-type", self::constructObjecttype($repeated_item)); + XML::addElement($doc, $as_object2, "activity:object-type", self::constructObjecttype($repeated_item)); $title = sprintf("New comment by %s", $contact["nick"]); @@ -1678,7 +1678,7 @@ class OStatus ); $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']); - XML::add_element($doc, $as_object, "activity:object-type", self::constructObjecttype($parent[0])); + XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent[0])); self::entryContent($doc, $as_object, $parent[0], $owner, "New entry"); @@ -1701,18 +1701,18 @@ class OStatus private static function addPersonObject($doc, $owner, $contact) { $object = $doc->createElement("activity:object"); - XML::add_element($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON); + XML::addElement($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON); if ($contact['network'] == NETWORK_PHANTOM) { - XML::add_element($doc, $object, "id", $contact['url']); + XML::addElement($doc, $object, "id", $contact['url']); return $object; } - XML::add_element($doc, $object, "id", $contact["alias"]); - XML::add_element($doc, $object, "title", $contact["nick"]); + XML::addElement($doc, $object, "id", $contact["alias"]); + XML::addElement($doc, $object, "title", $contact["nick"]); $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $contact["url"]); - XML::add_element($doc, $object, "link", "", $attributes); + XML::addElement($doc, $object, "link", "", $attributes); $attributes = array( "rel" => "avatar", @@ -1720,14 +1720,14 @@ class OStatus "media:width" => 175, "media:height" => 175, "href" => $contact["photo"]); - XML::add_element($doc, $object, "link", "", $attributes); + XML::addElement($doc, $object, "link", "", $attributes); - XML::add_element($doc, $object, "poco:preferredUsername", $contact["nick"]); - XML::add_element($doc, $object, "poco:displayName", $contact["name"]); + XML::addElement($doc, $object, "poco:preferredUsername", $contact["nick"]); + XML::addElement($doc, $object, "poco:displayName", $contact["name"]); if (trim($contact["location"]) != "") { $element = $doc->createElement("poco:address"); - XML::add_element($doc, $element, "poco:formatted", $contact["location"]); + XML::addElement($doc, $element, "poco:formatted", $contact["location"]); $object->appendChild($element); } @@ -1817,7 +1817,7 @@ class OStatus $title = self::entryHeader($doc, $entry, $owner, $toplevel); - XML::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE); + XML::addElement($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE); self::entryContent($doc, $entry, $item, $owner, $title); @@ -1879,8 +1879,8 @@ class OStatus $verb = self::constructVerb($item); } - XML::add_element($doc, $entry, "id", $item["uri"]); - XML::add_element($doc, $entry, "title", $title); + XML::addElement($doc, $entry, "id", $item["uri"]); + XML::addElement($doc, $entry, "title", $title); $body = self::formatPicturePost($item['body']); @@ -1890,20 +1890,25 @@ class OStatus $body = bbcode($body, false, false, 7); - XML::add_element($doc, $entry, "content", $body, array("type" => "html")); + XML::addElement($doc, $entry, "content", $body, array("type" => "html")); - XML::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html", + XML::addElement( + $doc, + $entry, + "link", + "", + array("rel" => "alternate", "type" => "text/html", "href" => System::baseUrl()."/display/".$item["guid"]) ); if ($complete && ($item["id"] > 0)) { - XML::add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"])); + XML::addElement($doc, $entry, "status_net", "", array("notice_id" => $item["id"])); } - XML::add_element($doc, $entry, "activity:verb", $verb); + XML::addElement($doc, $entry, "activity:verb", $verb); - XML::add_element($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"]."+00:00", ATOM_TIME)); - XML::add_element($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"]."+00:00", ATOM_TIME)); + XML::addElement($doc, $entry, "published", datetime_convert("UTC", "UTC", $item["created"]."+00:00", ATOM_TIME)); + XML::addElement($doc, $entry, "updated", datetime_convert("UTC", "UTC", $item["edited"]."+00:00", ATOM_TIME)); } /** @@ -1941,12 +1946,12 @@ class OStatus $attributes = array( "ref" => $parent_item, "href" => $parent_plink); - XML::add_element($doc, $entry, "thr:in-reply-to", "", $attributes); + XML::addElement($doc, $entry, "thr:in-reply-to", "", $attributes); $attributes = array( "rel" => "related", "href" => $parent_plink); - XML::add_element($doc, $entry, "link", "", $attributes); + XML::addElement($doc, $entry, "link", "", $attributes); } if (intval($item["parent"]) > 0) { @@ -1965,14 +1970,14 @@ class OStatus } } - XML::add_element($doc, $entry, "link", "", array("rel" => "ostatus:conversation", "href" => $conversation_href)); + XML::addElement($doc, $entry, "link", "", array("rel" => "ostatus:conversation", "href" => $conversation_href)); $attributes = array( "href" => $conversation_href, "local_id" => $item["parent"], "ref" => $conversation_uri); - XML::add_element($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes); + XML::addElement($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes); } $tags = item_getfeedtags($item); @@ -2000,14 +2005,14 @@ class OStatus dbesc(normalise_link($mention)) ); if ($r[0]["forum"] || $r[0]["prv"]) { - XML::add_element($doc, $entry, "link", "", + XML::addElement($doc, $entry, "link", "", array( "rel" => "mentioned", "ostatus:object-type" => ACTIVITY_OBJ_GROUP, "href" => $mention) ); } else { - XML::add_element($doc, $entry, "link", "", + XML::addElement($doc, $entry, "link", "", array( "rel" => "mentioned", "ostatus:object-type" => ACTIVITY_OBJ_PERSON, @@ -2017,18 +2022,18 @@ class OStatus } if (!$item["private"]) { - XML::add_element($doc, $entry, "link", "", array("rel" => "ostatus:attention", + XML::addElement($doc, $entry, "link", "", array("rel" => "ostatus:attention", "href" => "http://activityschema.org/collection/public")); - XML::add_element($doc, $entry, "link", "", array("rel" => "mentioned", + XML::addElement($doc, $entry, "link", "", array("rel" => "mentioned", "ostatus:object-type" => "http://activitystrea.ms/schema/1.0/collection", "href" => "http://activityschema.org/collection/public")); - XML::add_element($doc, $entry, "mastodon:scope", "public"); + XML::addElement($doc, $entry, "mastodon:scope", "public"); } if (count($tags)) { foreach ($tags as $t) { if ($t[0] != "@") { - XML::add_element($doc, $entry, "category", "", array("term" => $t[2])); + XML::addElement($doc, $entry, "category", "", array("term" => $t[2])); } } } @@ -2048,10 +2053,10 @@ class OStatus } if ($item["coord"] != "") { - XML::add_element($doc, $entry, "georss:point", $item["coord"]); + XML::addElement($doc, $entry, "georss:point", $item["coord"]); } - XML::add_element($doc, $entry, "statusnet:notice_info", "", $attributes); + XML::addElement($doc, $entry, "statusnet:notice_info", "", $attributes); } } diff --git a/src/Util/XML.php b/src/Util/XML.php index 7ecf85acd0..a3cf758da5 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -1,5 +1,4 @@ $value) { @@ -34,7 +33,7 @@ class XML if (is_array($value)) { $root = new SimpleXMLElement("<".$key."/>"); - self::from_array($value, $root, $remove_header, $namespaces, false); + self::fromArray($value, $root, $remove_header, $namespaces, false); } else { $root = new SimpleXMLElement("<".$key.">".xmlify($value).""); } @@ -106,7 +105,7 @@ class XML $element = $xml->addChild($key, xmlify($value), $namespace); } elseif (is_array($value)) { $element = $xml->addChild($key, null, $namespace); - self::from_array($value, $element, $remove_header, $namespaces, false); + self::fromArray($value, $element, $remove_header, $namespaces, false); } } } @@ -117,6 +116,7 @@ class XML * @param object $source The XML source * @param object $target The XML target * @param string $elementname Name of the XML element of the target + * @return void */ public static function copy(&$source, &$target, $elementname) { @@ -140,7 +140,7 @@ class XML * * @return object XML element object */ - public static function create_element($doc, $element, $value = "", $attributes = array()) + public static function createElement($doc, $element, $value = "", $attributes = array()) { $element = $doc->createElement($element, xmlify($value)); @@ -160,10 +160,11 @@ class XML * @param string $element XML element name * @param string $value XML value * @param array $attributes array containing the attributes + * @return void */ - public static function add_element($doc, $parent, $element, $value = "", $attributes = array()) + public static function addElement($doc, $parent, $element, $value = "", $attributes = array()) { - $element = self::create_element($doc, $element, $value, $attributes); + $element = self::createElement($doc, $element, $value, $attributes); $parent->appendChild($element); } @@ -177,7 +178,7 @@ class XML * * @return array | sring The array from the xml element or the string */ - public static function element_to_array($xml_element, &$recursion_depth=0) + public static function elementToArray($xml_element, &$recursion_depth = 0) { // If we're getting too deep, bail out if ($recursion_depth > 512) { @@ -200,7 +201,7 @@ class XML foreach ($xml_element as $key => $value) { $recursion_depth++; - $result_array[strtolower($key)] = self::element_to_array($value, $recursion_depth); + $result_array[strtolower($key)] = self::elementToArray($value, $recursion_depth); $recursion_depth--; } @@ -220,13 +221,13 @@ 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. + * Xml::toArray() 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')); + * Examples: $array = Xml::toArray(file_get_contents('feed.xml')); + * $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute')); * * @param object $contents The XML text * @param boolean $namespaces True or false include namespace information @@ -238,14 +239,14 @@ class XML * * @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') + public static function toArray($contents, $namespaces = true, $get_attributes = 1, $priority = 'attribute') { if (!$contents) { return array(); } if (!function_exists('xml_parser_create')) { - logger('Xml::to_array: parser function missing'); + logger('Xml::toArray: parser function missing'); return array(); } @@ -260,7 +261,7 @@ class XML } if (! $parser) { - logger('Xml::to_array: xml_parser_create: no resource'); + logger('Xml::toArray: xml_parser_create: no resource'); return array(); } @@ -272,7 +273,7 @@ class XML @xml_parser_free($parser); if (! $xml_values) { - logger('Xml::to_array: libxml: parse error: ' . $contents, LOGGER_DATA); + logger('Xml::toArray: libxml: parse error: ' . $contents, LOGGER_DATA); foreach (libxml_get_errors() as $err) { logger('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, LOGGER_DATA); } @@ -402,6 +403,7 @@ class XML * * @param object $doc XML document * @param string $node Node name + * @return void */ public static function deleteNode(&$doc, $node) {