+ /**
+ * @brief Adds the header elements to the XML document
+ *
+ * @param object $doc XML document
+ * @param array $owner Contact data of the poster
+ *
+ * @return object header root element
+ */
+ private function add_header($doc, $owner) {
+
+ $a = get_app();
+
+ $root = $doc->createElementNS(NAMESPACE_ATOM1, 'feed');
+ $doc->appendChild($root);
+
+ $root->setAttribute("xmlns:thr", NAMESPACE_THREAD);
+ $root->setAttribute("xmlns:georss", NAMESPACE_GEORSS);
+ $root->setAttribute("xmlns:activity", NAMESPACE_ACTIVITY);
+ $root->setAttribute("xmlns:media", NAMESPACE_MEDIA);
+ $root->setAttribute("xmlns:poco", NAMESPACE_POCO);
+ $root->setAttribute("xmlns:ostatus", NAMESPACE_OSTATUS);
+ $root->setAttribute("xmlns:statusnet", NAMESPACE_STATUSNET);
+
+ $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", App::get_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));
+
+ $author = self::add_author($doc, $owner);
+ $root->appendChild($author);
+
+ $attributes = array("href" => $owner["url"], "rel" => "alternate", "type" => "text/html");
+ xml::add_element($doc, $root, "link", "", $attributes);
+
+ /// @TODO We have to find out what this is
+ /// $attributes = array("href" => App::get_baseurl()."/sup",
+ /// "rel" => "http://api.friendfeed.com/2008/03#sup",
+ /// "type" => "application/json");
+ /// xml::add_element($doc, $root, "link", "", $attributes);
+
+ self::hublinks($doc, $root);
+
+ $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "salmon");
+ xml::add_element($doc, $root, "link", "", $attributes);
+
+ $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies");
+ xml::add_element($doc, $root, "link", "", $attributes);
+
+ $attributes = array("href" => App::get_baseurl()."/salmon/".$owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention");
+ xml::add_element($doc, $root, "link", "", $attributes);
+
+ $attributes = array("href" => App::get_baseurl()."/api/statuses/user_timeline/".$owner["nick"].".atom",
+ "rel" => "self", "type" => "application/atom+xml");
+ xml::add_element($doc, $root, "link", "", $attributes);
+
+ return $root;
+ }