Capitalized XML
Acronym classes should be capitalized
This commit is contained in:
parent
b8d9509563
commit
bc49fc974c
|
@ -13,7 +13,7 @@ use Friendica\Core\NotificationsManager;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/HTTPExceptions.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -901,7 +901,7 @@ function api_create_xml($data, $root_element)
|
|||
|
||||
$data3 = array($root_element => $data2);
|
||||
|
||||
$ret = Xml::from_array($data3, $xml, false, $namespaces);
|
||||
$ret = XML::from_array($data3, $xml, false, $namespaces);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
* https://github.com/annando/Syncom
|
||||
*/
|
||||
|
||||
use Friendica\Util\Xml;
|
||||
|
||||
use Friendica\Util\XML;
|
||||
|
||||
function node2bbcode(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
||||
{
|
||||
|
@ -27,11 +26,12 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
|||
|
||||
$list = $xpath->query("//".$oldnode);
|
||||
foreach ($list as $oldNode) {
|
||||
|
||||
$attr = array();
|
||||
if ($oldNode->attributes->length)
|
||||
foreach ($oldNode->attributes as $attribute)
|
||||
if ($oldNode->attributes->length) {
|
||||
foreach ($oldNode->attributes as $attribute) {
|
||||
$attr[$attribute->name] = $attribute->value;
|
||||
}
|
||||
}
|
||||
|
||||
$replace = true;
|
||||
|
||||
|
@ -40,23 +40,22 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
|||
$i = 0;
|
||||
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
|
||||
$startbb = str_replace('\x01'.++$i, '$1', $startbb);
|
||||
|
||||
if (strpos('*'.$startbb, '$1') > 0) {
|
||||
|
||||
if ($replace && (@$attr[$attribute] != '')) {
|
||||
|
||||
$startbb = preg_replace($value, $startbb, $attr[$attribute], -1, $count);
|
||||
|
||||
// If nothing could be changed
|
||||
if ($count == 0)
|
||||
if ($count == 0) {
|
||||
$replace = false;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
$replace = false;
|
||||
}
|
||||
} else {
|
||||
if (@$attr[$attribute] != $value)
|
||||
if (@$attr[$attribute] != $value) {
|
||||
$replace = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,12 +124,12 @@ function html2bbcode($message, $basepath = '')
|
|||
|
||||
@$doc->loadHTML($message);
|
||||
|
||||
Xml::deleteNode($doc, 'style');
|
||||
Xml::deleteNode($doc, 'head');
|
||||
Xml::deleteNode($doc, 'title');
|
||||
Xml::deleteNode($doc, 'meta');
|
||||
Xml::deleteNode($doc, 'xml');
|
||||
Xml::deleteNode($doc, 'removeme');
|
||||
XML::deleteNode($doc, 'style');
|
||||
XML::deleteNode($doc, 'head');
|
||||
XML::deleteNode($doc, 'title');
|
||||
XML::deleteNode($doc, 'meta');
|
||||
XML::deleteNode($doc, 'xml');
|
||||
XML::deleteNode($doc, 'removeme');
|
||||
|
||||
$xpath = new DomXPath($doc);
|
||||
$list = $xpath->query("//pre");
|
||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\App;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
* @brief Curl wrapper
|
||||
|
@ -414,7 +414,7 @@ function xml_status($st, $message = '')
|
|||
|
||||
$xmldata = array("result" => $result);
|
||||
|
||||
echo Xml::from_array($xmldata, $xml);
|
||||
echo XML::from_array($xmldata, $xml);
|
||||
|
||||
killme();
|
||||
}
|
||||
|
@ -570,7 +570,8 @@ function allowed_url($url)
|
|||
* Checks if the provided url domain is on the domain blocklist.
|
||||
* Returns true if it is or malformed URL, false if not.
|
||||
*
|
||||
* @param string $url The url to check the domain from
|
||||
* @param string $url The url to check the domain from
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function blocked_url($url)
|
||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Core\Config;
|
|||
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';
|
||||
|
@ -1245,39 +1245,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::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;
|
||||
}
|
||||
|
@ -1292,7 +1292,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::add_element($doc, $root, "link", "", array("href" => $h, "rel" => "hub"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1314,7 +1314,7 @@ class ostatus
|
|||
"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",
|
||||
|
@ -1322,7 +1322,7 @@ class ostatus
|
|||
"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;
|
||||
|
@ -1335,7 +1335,7 @@ class ostatus
|
|||
"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']);
|
||||
|
@ -1354,7 +1354,7 @@ class ostatus
|
|||
if (trim($matches[4]) != "") {
|
||||
$attributes["title"] = trim($matches[4]);
|
||||
}
|
||||
Xml::add_element($doc, $root, "link", "", $attributes);
|
||||
XML::add_element($doc, $root, "link", "", $attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1375,15 +1375,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::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",
|
||||
|
@ -1391,7 +1391,7 @@ class ostatus
|
|||
"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(
|
||||
|
@ -1400,34 +1400,34 @@ class ostatus
|
|||
"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;
|
||||
}
|
||||
|
@ -1509,12 +1509,12 @@ class ostatus
|
|||
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;
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ class ostatus
|
|||
|
||||
$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);
|
||||
|
||||
|
@ -1622,7 +1622,7 @@ class ostatus
|
|||
|
||||
$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"]);
|
||||
|
||||
|
@ -1673,7 +1673,7 @@ class ostatus
|
|||
);
|
||||
$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");
|
||||
|
||||
|
@ -1696,18 +1696,18 @@ class ostatus
|
|||
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",
|
||||
|
@ -1715,14 +1715,14 @@ class ostatus
|
|||
"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);
|
||||
}
|
||||
|
||||
|
@ -1812,7 +1812,7 @@ class ostatus
|
|||
|
||||
$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);
|
||||
|
||||
|
@ -1874,8 +1874,8 @@ class ostatus
|
|||
$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']);
|
||||
|
||||
|
@ -1885,20 +1885,20 @@ class ostatus
|
|||
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1936,12 +1936,12 @@ class ostatus
|
|||
$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) {
|
||||
|
@ -1960,14 +1960,14 @@ class ostatus
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -1995,14 +1995,14 @@ class ostatus
|
|||
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,
|
||||
|
@ -2012,18 +2012,18 @@ class ostatus
|
|||
}
|
||||
|
||||
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]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2043,10 +2043,10 @@ class ostatus
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @file include/salmon.php
|
||||
*/
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/crypto.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::from_array($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::from_array($xmldata, $xml, false, $namespaces);
|
||||
|
||||
// slap them
|
||||
post_url($url, $salmon, array(
|
||||
|
@ -161,13 +161,13 @@ 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::from_array($xmldata, $xml, false, $namespaces);
|
||||
|
||||
// slap them
|
||||
post_url($url, $salmon, array(
|
||||
'Content-type: application/magic-envelope+xml',
|
||||
'Content-length: ' . strlen($salmon)
|
||||
));
|
||||
'Content-length: ' . strlen($salmon))
|
||||
);
|
||||
$return_code = $a->get_curl_code();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ This file is part of the Diaspora protocol. It is used for fetching single publi
|
|||
use Friendica\App;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once "include/crypto.php";
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\Core\Cache;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
require_once 'include/datetime.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
@ -114,7 +114,7 @@ function ping_init(App $a)
|
|||
}
|
||||
} else {
|
||||
header("Content-type: text/xml");
|
||||
echo Xml::from_array($data, $xml);
|
||||
echo XML::from_array($data, $xml);
|
||||
}
|
||||
killme();
|
||||
}
|
||||
|
@ -411,7 +411,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::from_array(array("result" => $data), $xml);
|
||||
}
|
||||
|
||||
killme();
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
use dba;
|
||||
use DomXPath;
|
||||
|
@ -123,7 +123,7 @@ class Probe {
|
|||
return array();
|
||||
}
|
||||
|
||||
$links = Xml::element_to_array($xrd);
|
||||
$links = XML::element_to_array($xrd);
|
||||
if (!isset($links["xrd"]["link"])) {
|
||||
logger("No xrd data found for ".$host, LOGGER_DEBUG);
|
||||
return array();
|
||||
|
@ -705,7 +705,7 @@ class Probe {
|
|||
return false;
|
||||
}
|
||||
|
||||
$xrd_arr = Xml::element_to_array($xrd);
|
||||
$xrd_arr = XML::element_to_array($xrd);
|
||||
if (!isset($xrd_arr["xrd"]["link"])) {
|
||||
logger("No XML webfinger links for ".$url, LOGGER_DEBUG);
|
||||
return false;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace Friendica;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
use dba;
|
||||
use DomXPath;
|
||||
|
@ -203,17 +203,17 @@ class ParseUrl
|
|||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML($body);
|
||||
|
||||
Xml::deleteNode($doc, "style");
|
||||
Xml::deleteNode($doc, "script");
|
||||
Xml::deleteNode($doc, "option");
|
||||
Xml::deleteNode($doc, "h1");
|
||||
Xml::deleteNode($doc, "h2");
|
||||
Xml::deleteNode($doc, "h3");
|
||||
Xml::deleteNode($doc, "h4");
|
||||
Xml::deleteNode($doc, "h5");
|
||||
Xml::deleteNode($doc, "h6");
|
||||
Xml::deleteNode($doc, "ol");
|
||||
Xml::deleteNode($doc, "ul");
|
||||
XML::deleteNode($doc, "style");
|
||||
XML::deleteNode($doc, "script");
|
||||
XML::deleteNode($doc, "option");
|
||||
XML::deleteNode($doc, "h1");
|
||||
XML::deleteNode($doc, "h2");
|
||||
XML::deleteNode($doc, "h3");
|
||||
XML::deleteNode($doc, "h4");
|
||||
XML::deleteNode($doc, "h5");
|
||||
XML::deleteNode($doc, "h6");
|
||||
XML::deleteNode($doc, "ol");
|
||||
XML::deleteNode($doc, "ul");
|
||||
|
||||
$xpath = new DomXPath($doc);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
use dba;
|
||||
use DOMDocument;
|
||||
|
@ -402,17 +402,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::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']);
|
||||
|
||||
$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::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']);
|
||||
|
||||
$root->appendChild($mail);
|
||||
|
||||
|
@ -437,11 +437,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::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']);
|
||||
|
||||
$root->appendChild($suggest);
|
||||
|
||||
|
@ -489,18 +489,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::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'));
|
||||
|
||||
$root->appendChild($relocate);
|
||||
|
||||
|
@ -539,17 +539,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::add_element($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]);
|
||||
XML::add_element($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::add_element($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::add_element($doc, $root, "link", "", $attributes);
|
||||
|
||||
$attributes = array("rel" => "alternate", "type" => "text/html", "href" => $alternatelink);
|
||||
Xml::add_element($doc, $root, "link", "", $attributes);
|
||||
XML::add_element($doc, $root, "link", "", $attributes);
|
||||
|
||||
|
||||
if ($public) {
|
||||
|
@ -557,26 +557,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::add_element($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::add_element($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::add_element($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::add_element($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::add_element($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::add_element($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME));
|
||||
|
||||
$author = self::add_author($doc, $owner, $authorelement, $public);
|
||||
$root->appendChild($author);
|
||||
|
@ -620,9 +620,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::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);
|
||||
|
||||
$attributes = array("rel" => "photo", "type" => "image/jpeg",
|
||||
"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
|
||||
|
@ -631,13 +631,13 @@ class DFRN
|
|||
$attributes["dfrn:updated"] = $picdate;
|
||||
}
|
||||
|
||||
Xml::add_element($doc, $author, "link", "", $attributes);
|
||||
XML::add_element($doc, $author, "link", "", $attributes);
|
||||
|
||||
$attributes["rel"] = "avatar";
|
||||
Xml::add_element($doc, $author, "link", "", $attributes);
|
||||
XML::add_element($doc, $author, "link", "", $attributes);
|
||||
|
||||
if ($hidewall) {
|
||||
Xml::add_element($doc, $author, "dfrn:hide", "true");
|
||||
XML::add_element($doc, $author, "dfrn:hide", "true");
|
||||
}
|
||||
|
||||
// The following fields will only be generated if the data isn't meant for a public feed
|
||||
|
@ -648,7 +648,7 @@ class DFRN
|
|||
$birthday = feed_birthday($owner['uid'], $owner['timezone']);
|
||||
|
||||
if ($birthday) {
|
||||
Xml::add_element($doc, $author, "dfrn:birthday", $birthday);
|
||||
XML::add_element($doc, $author, "dfrn:birthday", $birthday);
|
||||
}
|
||||
|
||||
// Only show contact details when we are allowed to
|
||||
|
@ -664,60 +664,60 @@ 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::add_element($doc, $author, "poco:displayName", $profile["name"]);
|
||||
XML::add_element($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::add_element($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::add_element($doc, $author, "poco:note", $profile["about"]);
|
||||
XML::add_element($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::add_element($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::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 (trim($profile["pub_keywords"]) != "") {
|
||||
$keywords = explode(",", $profile["pub_keywords"]);
|
||||
|
||||
foreach ($keywords AS $keyword) {
|
||||
Xml::add_element($doc, $author, "poco:tags", trim($keyword));
|
||||
foreach ($keywords as $keyword) {
|
||||
XML::add_element($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::add_element($doc, $ims, "poco:type", "xmpp");
|
||||
XML::add_element($doc, $ims, "poco:value", $profile["xmpp"]);
|
||||
XML::add_element($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", formatted_location($profile));
|
||||
XML::add_element($doc, $element, "poco:formatted", formatted_location($profile));
|
||||
|
||||
if (trim($profile["locality"]) != "") {
|
||||
Xml::add_element($doc, $element, "poco:locality", $profile["locality"]);
|
||||
XML::add_element($doc, $element, "poco:locality", $profile["locality"]);
|
||||
}
|
||||
|
||||
if (trim($profile["region"]) != "") {
|
||||
Xml::add_element($doc, $element, "poco:region", $profile["region"]);
|
||||
XML::add_element($doc, $element, "poco:region", $profile["region"]);
|
||||
}
|
||||
|
||||
if (trim($profile["country-name"]) != "") {
|
||||
Xml::add_element($doc, $element, "poco:country", $profile["country-name"]);
|
||||
XML::add_element($doc, $element, "poco:country", $profile["country-name"]);
|
||||
}
|
||||
|
||||
$author->appendChild($element);
|
||||
|
@ -744,9 +744,9 @@ class DFRN
|
|||
$contact = get_contact_details_by_url($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::add_element($doc, $author, "name", $contact["name"]);
|
||||
XML::add_element($doc, $author, "uri", $contact["url"]);
|
||||
XML::add_element($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::add_element($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::add_element($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::add_element($doc, $entry, "activity:object-type", $r->type);
|
||||
}
|
||||
if ($r->id) {
|
||||
Xml::add_element($doc, $entry, "id", $r->id);
|
||||
XML::add_element($doc, $entry, "id", $r->id);
|
||||
}
|
||||
if ($r->title) {
|
||||
Xml::add_element($doc, $entry, "title", $r->title);
|
||||
XML::add_element($doc, $entry, "title", $r->title);
|
||||
}
|
||||
|
||||
if ($r->link) {
|
||||
|
@ -812,19 +812,19 @@ class DFRN
|
|||
if (is_object($data)) {
|
||||
foreach ($data->link AS $link) {
|
||||
$attributes = array();
|
||||
foreach ($link->attributes() AS $parameter => $value) {
|
||||
foreach ($link->attributes() as $parameter => $value) {
|
||||
$attributes[$parameter] = $value;
|
||||
}
|
||||
Xml::add_element($doc, $entry, "link", "", $attributes);
|
||||
XML::add_element($doc, $entry, "link", "", $attributes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$attributes = array("rel" => "alternate", "type" => "text/html", "href" => $r->link);
|
||||
Xml::add_element($doc, $entry, "link", "", $attributes);
|
||||
XML::add_element($doc, $entry, "link", "", $attributes);
|
||||
}
|
||||
}
|
||||
if ($r->content) {
|
||||
Xml::add_element($doc, $entry, "content", bbcode($r->content), array("type" => "html"));
|
||||
XML::add_element($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::add_element($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::create_element($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::add_element($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::add_element($doc, $entry, "ostatus:conversation", $conversation_uri, $attributes);
|
||||
|
||||
Xml::add_element($doc, $entry, "id", $item["uri"]);
|
||||
Xml::add_element($doc, $entry, "title", $item["title"]);
|
||||
XML::add_element($doc, $entry, "id", $item["uri"]);
|
||||
XML::add_element($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::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));
|
||||
|
||||
// "dfrn:env" is used to read the content
|
||||
Xml::add_element($doc, $entry, "dfrn:env", base64url_encode($body, true));
|
||||
XML::add_element($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::add_element($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::add_element(
|
||||
$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::add_element($doc, $entry, "dfrn:comment-allow", intval($item['last-child']));
|
||||
}
|
||||
|
||||
if ($item['location']) {
|
||||
Xml::add_element($doc, $entry, "dfrn:location", $item['location']);
|
||||
XML::add_element($doc, $entry, "dfrn:location", $item['location']);
|
||||
}
|
||||
|
||||
if ($item['coord']) {
|
||||
Xml::add_element($doc, $entry, "georss:point", $item['coord']);
|
||||
XML::add_element($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::add_element($doc, $entry, "dfrn:private", (($item['private']) ? $item['private'] : 1));
|
||||
}
|
||||
|
||||
if ($item['extid']) {
|
||||
Xml::add_element($doc, $entry, "dfrn:extid", $item['extid']);
|
||||
XML::add_element($doc, $entry, "dfrn:extid", $item['extid']);
|
||||
}
|
||||
|
||||
if ($item['bookmark']) {
|
||||
Xml::add_element($doc, $entry, "dfrn:bookmark", "true");
|
||||
XML::add_element($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::add_element($doc, $entry, "statusnet:notice_info", "", array("local_id" => $item['id'], "source" => $item['app']));
|
||||
}
|
||||
|
||||
Xml::add_element($doc, $entry, "dfrn:diaspora_guid", $item["guid"]);
|
||||
XML::add_element($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::add_element($doc, $entry, "dfrn:diaspora_signature", $sign);
|
||||
}
|
||||
|
||||
Xml::add_element($doc, $entry, "activity:verb", construct_verb($item));
|
||||
XML::add_element($doc, $entry, "activity:verb", construct_verb($item));
|
||||
|
||||
if ($item['object-type'] != "") {
|
||||
Xml::add_element($doc, $entry, "activity:object-type", $item['object-type']);
|
||||
XML::add_element($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::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_NOTE);
|
||||
} else {
|
||||
Xml::add_element($doc, $entry, "activity:object-type", ACTIVITY_OBJ_COMMENT);
|
||||
XML::add_element($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::add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
foreach ($mentioned AS $mention) {
|
||||
foreach ($mentioned as $mention) {
|
||||
$r = q(
|
||||
"SELECT `forum`, `prv` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'",
|
||||
intval($owner["uid"]),
|
||||
|
@ -1077,7 +1077,7 @@ class DFRN
|
|||
);
|
||||
|
||||
if (DBM::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
|
||||
Xml::add_element(
|
||||
XML::add_element(
|
||||
$doc,
|
||||
$entry,
|
||||
"link",
|
||||
|
@ -1087,7 +1087,7 @@ class DFRN
|
|||
"href" => $mention)
|
||||
);
|
||||
} else {
|
||||
Xml::add_element(
|
||||
XML::add_element(
|
||||
$doc,
|
||||
$entry,
|
||||
"link",
|
||||
|
@ -1705,7 +1705,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::add_element($obj_doc, $obj_element, "type", $activity_type);
|
||||
|
||||
$id = $xpath->query("atom:id", $activity)->item(0);
|
||||
if (is_object($id)) {
|
||||
|
|
|
@ -17,7 +17,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Xml;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
use dba;
|
||||
use SimpleXMLElement;
|
||||
|
@ -672,7 +672,7 @@ class Diaspora
|
|||
if (!in_array($fieldname, array("parent_author_signature", "target_author_signature"))
|
||||
|| ($orig_type == "relayable_retraction")
|
||||
) {
|
||||
Xml::copy($entry, $fields, $fieldname);
|
||||
XML::copy($entry, $fields, $fieldname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1912,7 +1912,7 @@ class Diaspora
|
|||
"title" => "",
|
||||
"content" => $parent_body));
|
||||
|
||||
return Xml::from_array($xmldata, $xml, true);
|
||||
return XML::from_array($xmldata, $xml, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2344,7 +2344,7 @@ class Diaspora
|
|||
"id" => $contact["url"]."/".$contact["name"],
|
||||
"link" => $link));
|
||||
|
||||
return Xml::from_array($xmldata, $xml, true);
|
||||
return XML::from_array($xmldata, $xml, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3039,7 +3039,7 @@ class Diaspora
|
|||
|
||||
$namespaces = array("me" => "http://salmon-protocol.org/ns/magic-env");
|
||||
|
||||
return Xml::from_array($xmldata, $xml, false, $namespaces);
|
||||
return XML::from_array($xmldata, $xml, false, $namespaces);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3172,7 +3172,7 @@ class Diaspora
|
|||
{
|
||||
$data = array($type => $message);
|
||||
|
||||
return Xml::from_array($data, $xml);
|
||||
return XML::from_array($data, $xml);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Util/Xml.php
|
||||
* @file src/Util/XML.php
|
||||
*/
|
||||
namespace Friendica\Util;
|
||||
|
||||
|
@ -11,7 +11,7 @@ use SimpleXMLElement;
|
|||
/**
|
||||
* @brief This class contain methods to work with XML data
|
||||
*/
|
||||
class Xml
|
||||
class XML
|
||||
{
|
||||
/**
|
||||
* @brief Creates an XML structure out of a given array
|
Loading…
Reference in a new issue