use Friendica\Database\DBM;
use Friendica\Network\Probe;
use Friendica\Util\Lock;
-use Friendica\Util\Xml;
+use Friendica\Util\XML;
require_once 'include/Contact.php';
require_once 'include/threads.php';
$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::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));
$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);
+ XML::add_element($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::add_element($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::add_element($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::add_element($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::add_element($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::add_element($doc, $root, "link", "", $attributes);
return $root;
}
public static function hublinks($doc, $root, $nick)
{
$h = System::baseUrl() . '/pubsubhubbub/'.$nick;
- Xml::add_element($doc, $root, "link", "", array("href" => $h, "rel" => "hub"));
+ XML::add_element($doc, $root, "link", "", array("href" => $h, "rel" => "hub"));
}
/**
"href" => $siteinfo["image"],
"type" => $imgdata["mime"],
"length" => intval($imgdata["size"]));
- Xml::add_element($doc, $root, "link", "", $attributes);
+ XML::add_element($doc, $root, "link", "", $attributes);
break;
case 'video':
$attributes = array("rel" => "enclosure",
"type" => "text/html; charset=UTF-8",
"length" => "",
"title" => $siteinfo["title"]);
- Xml::add_element($doc, $root, "link", "", $attributes);
+ XML::add_element($doc, $root, "link", "", $attributes);
break;
default:
break;
"type" => $imgdata["mime"],
"length" => intval($imgdata["size"]));
- Xml::add_element($doc, $root, "link", "", $attributes);
+ XML::add_element($doc, $root, "link", "", $attributes);
}
$arr = explode('[/attach],', $item['attach']);
if (trim($matches[4]) != "") {
$attributes["title"] = trim($matches[4]);
}
- Xml::add_element($doc, $root, "link", "", $attributes);
+ XML::add_element($doc, $root, "link", "", $attributes);
}
}
}
$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::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));
$attributes = array("rel" => "alternate", "type" => "text/html", "href" => $owner["url"]);
- Xml::add_element($doc, $author, "link", "", $attributes);
+ XML::add_element($doc, $author, "link", "", $attributes);
$attributes = array(
"rel" => "avatar",
"media:width" => 175,
"media:height" => 175,
"href" => $owner["photo"]);
- Xml::add_element($doc, $author, "link", "", $attributes);
+ XML::add_element($doc, $author, "link", "", $attributes);
if (isset($owner["thumb"])) {
$attributes = array(
"media:width" => 80,
"media:height" => 80,
"href" => $owner["thumb"]);
- Xml::add_element($doc, $author, "link", "", $attributes);
+ XML::add_element($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::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));
if (trim($owner["location"]) != "") {
$element = $doc->createElement("poco:address");
- Xml::add_element($doc, $element, "poco:formatted", $owner["location"]);
+ XML::add_element($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::add_element($doc, $urls, "poco:type", "homepage");
+ XML::add_element($doc, $urls, "poco:value", $profile["homepage"]);
+ XML::add_element($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::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"]));
}
if ($profile["publish"]) {
- Xml::add_element($doc, $author, "mastodon:scope", "public");
+ XML::add_element($doc, $author, "mastodon:scope", "public");
}
return $author;
}
private static function source_entry($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::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));
return $source;
}
$as_object = $doc->createElement("activity:object");
- Xml::add_element($doc, $as_object, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA."activity");
+ XML::add_element($doc, $as_object, "activity:object-type", NAMESPACE_ACTIVITY_SCHEMA."activity");
self::entry_content($doc, $as_object, $repeated_item, $owner, "", "", false);
$as_object2 = $doc->createElement("activity:object");
- Xml::add_element($doc, $as_object2, "activity:object-type", self::construct_objecttype($repeated_item));
+ XML::add_element($doc, $as_object2, "activity:object-type", self::construct_objecttype($repeated_item));
$title = sprintf("New comment by %s", $contact["nick"]);
);
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
- Xml::add_element($doc, $as_object, "activity:object-type", self::construct_objecttype($parent[0]));
+ XML::add_element($doc, $as_object, "activity:object-type", self::construct_objecttype($parent[0]));
self::entry_content($doc, $as_object, $parent[0], $owner, "New entry");
private static function add_person_object($doc, $owner, $contact)
{
$object = $doc->createElement("activity:object");
- Xml::add_element($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON);
+ XML::add_element($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON);
if ($contact['network'] == NETWORK_PHANTOM) {
- Xml::add_element($doc, $object, "id", $contact['url']);
+ XML::add_element($doc, $object, "id", $contact['url']);
return $object;
}
- Xml::add_element($doc, $object, "id", $contact["alias"]);
- Xml::add_element($doc, $object, "title", $contact["nick"]);
+ XML::add_element($doc, $object, "id", $contact["alias"]);
+ XML::add_element($doc, $object, "title", $contact["nick"]);
$attributes = array("rel" => "alternate", "type" => "text/html", "href" => $contact["url"]);
- Xml::add_element($doc, $object, "link", "", $attributes);
+ XML::add_element($doc, $object, "link", "", $attributes);
$attributes = array(
"rel" => "avatar",
"media:width" => 175,
"media:height" => 175,
"href" => $contact["photo"]);
- Xml::add_element($doc, $object, "link", "", $attributes);
+ XML::add_element($doc, $object, "link", "", $attributes);
- Xml::add_element($doc, $object, "poco:preferredUsername", $contact["nick"]);
- Xml::add_element($doc, $object, "poco:displayName", $contact["name"]);
+ XML::add_element($doc, $object, "poco:preferredUsername", $contact["nick"]);
+ XML::add_element($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::add_element($doc, $element, "poco:formatted", $contact["location"]);
$object->appendChild($element);
}
$title = self::entry_header($doc, $entry, $owner, $toplevel);
- Xml::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE);
+ XML::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE);
self::entry_content($doc, $entry, $item, $owner, $title);
$verb = self::construct_verb($item);
}
- Xml::add_element($doc, $entry, "id", $item["uri"]);
- Xml::add_element($doc, $entry, "title", $title);
+ XML::add_element($doc, $entry, "id", $item["uri"]);
+ XML::add_element($doc, $entry, "title", $title);
$body = self::format_picture_post($item['body']);
$body = bbcode($body, false, false, 7);
- Xml::add_element($doc, $entry, "content", $body, array("type" => "html"));
+ XML::add_element($doc, $entry, "content", $body, array("type" => "html"));
- Xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
+ XML::add_element($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::add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"]));
}
- Xml::add_element($doc, $entry, "activity:verb", $verb);
+ XML::add_element($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::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));
}
/**
$attributes = array(
"ref" => $parent_item,
"href" => $parent_plink);
- Xml::add_element($doc, $entry, "thr:in-reply-to", "", $attributes);
+ XML::add_element($doc, $entry, "thr:in-reply-to", "", $attributes);
$attributes = array(
"rel" => "related",
"href" => $parent_plink);
- Xml::add_element($doc, $entry, "link", "", $attributes);
+ XML::add_element($doc, $entry, "link", "", $attributes);
}
if (intval($item["parent"]) > 0) {
}
}
- Xml::add_element($doc, $entry, "link", "", array("rel" => "ostatus:conversation", "href" => $conversation_href));
+ XML::add_element($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::add_element($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);
}
$tags = item_getfeedtags($item);
dbesc(normalise_link($mention))
);
if ($r[0]["forum"] || $r[0]["prv"]) {
- Xml::add_element($doc, $entry, "link", "",
+ XML::add_element($doc, $entry, "link", "",
array(
"rel" => "mentioned",
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
"href" => $mention)
);
} else {
- Xml::add_element($doc, $entry, "link", "",
+ XML::add_element($doc, $entry, "link", "",
array(
"rel" => "mentioned",
"ostatus:object-type" => ACTIVITY_OBJ_PERSON,
}
if (!$item["private"]) {
- Xml::add_element($doc, $entry, "link", "", array("rel" => "ostatus:attention",
+ XML::add_element($doc, $entry, "link", "", array("rel" => "ostatus:attention",
"href" => "http://activityschema.org/collection/public"));
- Xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
+ XML::add_element($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::add_element($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::add_element($doc, $entry, "category", "", array("term" => $t[2]));
}
}
}
}
if ($item["coord"] != "") {
- Xml::add_element($doc, $entry, "georss:point", $item["coord"]);
+ XML::add_element($doc, $entry, "georss:point", $item["coord"]);
}
- Xml::add_element($doc, $entry, "statusnet:notice_info", "", $attributes);
+ XML::add_element($doc, $entry, "statusnet:notice_info", "", $attributes);
}
}