Rename namespace
This commit is contained in:
parent
07cea24430
commit
2fba7ed477
11 changed files with 156 additions and 161 deletions
|
@ -2,19 +2,19 @@
|
|||
/**
|
||||
* @file mod/salmon.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
function salmon_post(App $a, $xml = '') {
|
||||
|
||||
|
@ -37,7 +37,7 @@ function salmon_post(App $a, $xml = '') {
|
|||
|
||||
// parse the xml
|
||||
|
||||
$dom = simplexml_load_string($xml,'SimpleXMLElement',0, Namespaces::SALMON_ME);
|
||||
$dom = simplexml_load_string($xml,'SimpleXMLElement',0, ANamespace::SALMON_ME);
|
||||
|
||||
$base = null;
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -23,7 +23,6 @@ use Friendica\Protocol\ActivityPub;
|
|||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -829,7 +828,7 @@ class Contact extends BaseObject
|
|||
} elseif (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
|
||||
// create an unfollow slap
|
||||
$item = [];
|
||||
$item['verb'] = Activity\Namespaces::OSTATUS . "/unfollow";
|
||||
$item['verb'] = Activity\ANamespace::OSTATUS . "/unfollow";
|
||||
$item['follow'] = $contact["url"];
|
||||
$item['body'] = '';
|
||||
$item['title'] = '';
|
||||
|
|
|
@ -4,12 +4,11 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -96,11 +95,11 @@ class Xrd extends BaseModule
|
|||
],
|
||||
'links' => [
|
||||
[
|
||||
'rel' => Namespaces::DFRN ,
|
||||
'rel' => ANamespace::DFRN ,
|
||||
'href' => $owner['url'],
|
||||
],
|
||||
[
|
||||
'rel' => Namespaces::FEED,
|
||||
'rel' => ANamespace::FEED,
|
||||
'type' => 'application/atom+xml',
|
||||
'href' => $owner['poll'],
|
||||
],
|
||||
|
@ -120,7 +119,7 @@ class Xrd extends BaseModule
|
|||
'href' => $baseURL . '/hcard/' . $owner['nickname'],
|
||||
],
|
||||
[
|
||||
'rel' => Namespaces::POCO,
|
||||
'rel' => ANamespace::POCO,
|
||||
'href' => $owner['poco'],
|
||||
],
|
||||
[
|
||||
|
|
|
@ -18,12 +18,11 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\Email;
|
||||
use Friendica\Protocol\Feed;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -201,10 +200,10 @@ class Probe
|
|||
Logger::log('webfingerDfrn: '.$webbie.':'.print_r($links, true), Logger::DATA);
|
||||
if (!empty($links) && is_array($links)) {
|
||||
foreach ($links as $link) {
|
||||
if ($link['@attributes']['rel'] === Namespaces::DFRN) {
|
||||
if ($link['@attributes']['rel'] === ANamespace::DFRN) {
|
||||
$profile_link = $link['@attributes']['href'];
|
||||
}
|
||||
if (($link['@attributes']['rel'] === Namespaces::OSTATUSSUB) && ($profile_link == "")) {
|
||||
if (($link['@attributes']['rel'] === ANamespace::OSTATUSSUB) && ($profile_link == "")) {
|
||||
$profile_link = 'stat:'.$link['@attributes']['template'];
|
||||
}
|
||||
if ($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard') {
|
||||
|
@ -493,7 +492,7 @@ class Probe
|
|||
$has_key = false;
|
||||
|
||||
foreach ($webfinger['links'] as $link) {
|
||||
if ($link['rel'] == Namespaces::OSTATUSSUB) {
|
||||
if ($link['rel'] == ANamespace::OSTATUSSUB) {
|
||||
$is_ostatus = true;
|
||||
}
|
||||
if ($link['rel'] == 'magic-public-key') {
|
||||
|
@ -956,15 +955,15 @@ class Probe
|
|||
// The array is reversed to take into account the order of preference for same-rel links
|
||||
// See: https://tools.ietf.org/html/rfc7033#section-4.4.4
|
||||
foreach (array_reverse($webfinger["links"]) as $link) {
|
||||
if (($link["rel"] == Namespaces::DFRN) && !empty($link["href"])) {
|
||||
if (($link["rel"] == ANamespace::DFRN) && !empty($link["href"])) {
|
||||
$data["network"] = Protocol::DFRN;
|
||||
} elseif (($link["rel"] == Namespaces::FEED) && !empty($link["href"])) {
|
||||
} elseif (($link["rel"] == ANamespace::FEED) && !empty($link["href"])) {
|
||||
$data["poll"] = $link["href"];
|
||||
} elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && (($link["type"] ?? "") == "text/html") && !empty($link["href"])) {
|
||||
$data["url"] = $link["href"];
|
||||
} elseif (($link["rel"] == "http://microformats.org/profile/hcard") && !empty($link["href"])) {
|
||||
$hcard_url = $link["href"];
|
||||
} elseif (($link["rel"] == Namespaces::POCO) && !empty($link["href"])) {
|
||||
} elseif (($link["rel"] == ANamespace::POCO) && !empty($link["href"])) {
|
||||
$data["poco"] = $link["href"];
|
||||
} elseif (($link["rel"] == "http://webfinger.net/rel/avatar") && !empty($link["href"])) {
|
||||
$data["photo"] = $link["href"];
|
||||
|
@ -1172,9 +1171,9 @@ class Probe
|
|||
$data["guid"] = $link["href"];
|
||||
} elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") && (($link["type"] ?? "") == "text/html") && !empty($link["href"])) {
|
||||
$data["url"] = $link["href"];
|
||||
} elseif (($link["rel"] == Namespaces::FEED) && !empty($link["href"])) {
|
||||
} elseif (($link["rel"] == ANamespace::FEED) && !empty($link["href"])) {
|
||||
$data["poll"] = $link["href"];
|
||||
} elseif (($link["rel"] == Namespaces::POCO) && !empty($link["href"])) {
|
||||
} elseif (($link["rel"] == ANamespace::POCO) && !empty($link["href"])) {
|
||||
$data["poco"] = $link["href"];
|
||||
} elseif (($link["rel"] == "salmon") && !empty($link["href"])) {
|
||||
$data["notify"] = $link["href"];
|
||||
|
@ -1274,7 +1273,7 @@ class Probe
|
|||
$data["url"] = $link["href"];
|
||||
} elseif (($link["rel"] == "salmon") && !empty($link["href"])) {
|
||||
$data["notify"] = $link["href"];
|
||||
} elseif (($link["rel"] == Namespaces::FEED) && !empty($link["href"])) {
|
||||
} elseif (($link["rel"] == ANamespace::FEED) && !empty($link["href"])) {
|
||||
$data["poll"] = $link["href"];
|
||||
} elseif (($link["rel"] == "magic-public-key") && !empty($link["href"])) {
|
||||
$pubkey = $link["href"];
|
||||
|
|
|
@ -2,51 +2,51 @@
|
|||
|
||||
namespace Friendica\Protocol;
|
||||
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
|
||||
/**
|
||||
* Base class for the Activity constants and match method
|
||||
* Base class for the Activity constants and particular method
|
||||
*/
|
||||
final class Activity
|
||||
{
|
||||
const LIKE = Namespaces::ACTIVITY_SCHEMA . 'like';
|
||||
const LIKE = ANamespace::ACTIVITY_SCHEMA . 'like';
|
||||
|
||||
const DISLIKE = Namespaces::DFRN . '/dislike';
|
||||
const ATTEND = Namespaces::ZOT . '/activity/attendyes';
|
||||
const ATTENDNO = Namespaces::ZOT . '/activity/attendno';
|
||||
const ATTENDMAYBE = Namespaces::ZOT . '/activity/attendmaybe';
|
||||
const OBJ_HEART = Namespaces::DFRN . '/heart';
|
||||
const DISLIKE = ANamespace::DFRN . '/dislike';
|
||||
const ATTEND = ANamespace::ZOT . '/activity/attendyes';
|
||||
const ATTENDNO = ANamespace::ZOT . '/activity/attendno';
|
||||
const ATTENDMAYBE = ANamespace::ZOT . '/activity/attendmaybe';
|
||||
const OBJ_HEART = ANamespace::DFRN . '/heart';
|
||||
|
||||
const FRIEND = Namespaces::ACTIVITY_SCHEMA . 'make-friend';
|
||||
const REQ_FRIEND = Namespaces::ACTIVITY_SCHEMA . 'request-friend';
|
||||
const UNFRIEND = Namespaces::ACTIVITY_SCHEMA . 'remove-friend';
|
||||
const FOLLOW = Namespaces::ACTIVITY_SCHEMA . 'follow';
|
||||
const UNFOLLOW = Namespaces::ACTIVITY_SCHEMA . 'stop-following';
|
||||
const JOIN = Namespaces::ACTIVITY_SCHEMA . 'join';
|
||||
const POST = Namespaces::ACTIVITY_SCHEMA . 'post';
|
||||
const UPDATE = Namespaces::ACTIVITY_SCHEMA . 'update';
|
||||
const TAG = Namespaces::ACTIVITY_SCHEMA . 'tag';
|
||||
const FAVORITE = Namespaces::ACTIVITY_SCHEMA . 'favorite';
|
||||
const UNFAVORITE = Namespaces::ACTIVITY_SCHEMA . 'unfavorite';
|
||||
const SHARE = Namespaces::ACTIVITY_SCHEMA . 'share';
|
||||
const DELETE = Namespaces::ACTIVITY_SCHEMA . 'delete';
|
||||
const ANNOUNCE = Namespaces::ACTIVITY2 . 'Announce';
|
||||
const FRIEND = ANamespace::ACTIVITY_SCHEMA . 'make-friend';
|
||||
const REQ_FRIEND = ANamespace::ACTIVITY_SCHEMA . 'request-friend';
|
||||
const UNFRIEND = ANamespace::ACTIVITY_SCHEMA . 'remove-friend';
|
||||
const FOLLOW = ANamespace::ACTIVITY_SCHEMA . 'follow';
|
||||
const UNFOLLOW = ANamespace::ACTIVITY_SCHEMA . 'stop-following';
|
||||
const JOIN = ANamespace::ACTIVITY_SCHEMA . 'join';
|
||||
const POST = ANamespace::ACTIVITY_SCHEMA . 'post';
|
||||
const UPDATE = ANamespace::ACTIVITY_SCHEMA . 'update';
|
||||
const TAG = ANamespace::ACTIVITY_SCHEMA . 'tag';
|
||||
const FAVORITE = ANamespace::ACTIVITY_SCHEMA . 'favorite';
|
||||
const UNFAVORITE = ANamespace::ACTIVITY_SCHEMA . 'unfavorite';
|
||||
const SHARE = ANamespace::ACTIVITY_SCHEMA . 'share';
|
||||
const DELETE = ANamespace::ACTIVITY_SCHEMA . 'delete';
|
||||
const ANNOUNCE = ANamespace::ACTIVITY2 . 'Announce';
|
||||
|
||||
const POKE = Namespaces::ZOT . '/activity/poke';
|
||||
const POKE = ANamespace::ZOT . '/activity/poke';
|
||||
|
||||
const OBJ_BOOKMARK = Namespaces::ACTIVITY_SCHEMA . 'bookmark';
|
||||
const OBJ_COMMENT = Namespaces::ACTIVITY_SCHEMA . 'comment';
|
||||
const OBJ_NOTE = Namespaces::ACTIVITY_SCHEMA . 'note';
|
||||
const OBJ_PERSON = Namespaces::ACTIVITY_SCHEMA . 'person';
|
||||
const OBJ_IMAGE = Namespaces::ACTIVITY_SCHEMA . 'image';
|
||||
const OBJ_PHOTO = Namespaces::ACTIVITY_SCHEMA . 'photo';
|
||||
const OBJ_VIDEO = Namespaces::ACTIVITY_SCHEMA . 'video';
|
||||
const OBJ_P_PHOTO = Namespaces::ACTIVITY_SCHEMA . 'profile-photo';
|
||||
const OBJ_ALBUM = Namespaces::ACTIVITY_SCHEMA . 'photo-album';
|
||||
const OBJ_EVENT = Namespaces::ACTIVITY_SCHEMA . 'event';
|
||||
const OBJ_GROUP = Namespaces::ACTIVITY_SCHEMA . 'group';
|
||||
const OBJ_TAGTERM = Namespaces::DFRN . '/tagterm';
|
||||
const OBJ_PROFILE = Namespaces::DFRN . '/profile';
|
||||
const OBJ_BOOKMARK = ANamespace::ACTIVITY_SCHEMA . 'bookmark';
|
||||
const OBJ_COMMENT = ANamespace::ACTIVITY_SCHEMA . 'comment';
|
||||
const OBJ_NOTE = ANamespace::ACTIVITY_SCHEMA . 'note';
|
||||
const OBJ_PERSON = ANamespace::ACTIVITY_SCHEMA . 'person';
|
||||
const OBJ_IMAGE = ANamespace::ACTIVITY_SCHEMA . 'image';
|
||||
const OBJ_PHOTO = ANamespace::ACTIVITY_SCHEMA . 'photo';
|
||||
const OBJ_VIDEO = ANamespace::ACTIVITY_SCHEMA . 'video';
|
||||
const OBJ_P_PHOTO = ANamespace::ACTIVITY_SCHEMA . 'profile-photo';
|
||||
const OBJ_ALBUM = ANamespace::ACTIVITY_SCHEMA . 'photo-album';
|
||||
const OBJ_EVENT = ANamespace::ACTIVITY_SCHEMA . 'event';
|
||||
const OBJ_GROUP = ANamespace::ACTIVITY_SCHEMA . 'group';
|
||||
const OBJ_TAGTERM = ANamespace::DFRN . '/tagterm';
|
||||
const OBJ_PROFILE = ANamespace::DFRN . '/profile';
|
||||
|
||||
const OBJ_QUESTION = 'http://activityschema.org/object/question';
|
||||
|
||||
|
@ -93,6 +93,6 @@ final class Activity
|
|||
{
|
||||
return (($haystack === $needle) ||
|
||||
((basename($needle) === $haystack) &&
|
||||
strstr($needle, Namespaces::ACTIVITY_SCHEMA)));
|
||||
strstr($needle, ANamespace::ACTIVITY_SCHEMA)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Friendica\Protocol\Activity;
|
|||
/**
|
||||
* Activity namespaces constants
|
||||
*/
|
||||
final class Namespaces
|
||||
final class ANamespace
|
||||
{
|
||||
const ZOT = 'http://purl.org/zot';
|
||||
const DFRN = 'http://purl.org/macgirvin/dfrn/1.0';
|
|
@ -10,7 +10,6 @@ namespace Friendica\Protocol;
|
|||
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Friendica\App;
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\OEmbed;
|
||||
|
@ -21,7 +20,6 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
|
@ -34,7 +32,7 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -383,18 +381,18 @@ class DFRN
|
|||
$type = 'html';
|
||||
|
||||
if ($conversation) {
|
||||
$root = $doc->createElementNS(Namespaces::ATOM1, 'feed');
|
||||
$root = $doc->createElementNS(ANamespace::ATOM1, 'feed');
|
||||
$doc->appendChild($root);
|
||||
|
||||
$root->setAttribute("xmlns:thr", Namespaces::THREAD);
|
||||
$root->setAttribute("xmlns:at", Namespaces::TOMB);
|
||||
$root->setAttribute("xmlns:media", Namespaces::MEDIA);
|
||||
$root->setAttribute("xmlns:dfrn", Namespaces::DFRN);
|
||||
$root->setAttribute("xmlns:activity", Namespaces::ACTIVITY);
|
||||
$root->setAttribute("xmlns:georss", Namespaces::GEORSS);
|
||||
$root->setAttribute("xmlns:poco", Namespaces::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", Namespaces::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", Namespaces::STATUSNET);
|
||||
$root->setAttribute("xmlns:thr", ANamespace::THREAD);
|
||||
$root->setAttribute("xmlns:at", ANamespace::TOMB);
|
||||
$root->setAttribute("xmlns:media", ANamespace::MEDIA);
|
||||
$root->setAttribute("xmlns:dfrn", ANamespace::DFRN);
|
||||
$root->setAttribute("xmlns:activity", ANamespace::ACTIVITY);
|
||||
$root->setAttribute("xmlns:georss", ANamespace::GEORSS);
|
||||
$root->setAttribute("xmlns:poco", ANamespace::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", ANamespace::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", ANamespace::STATUSNET);
|
||||
|
||||
//$root = self::addHeader($doc, $owner, "dfrn:owner", "", false);
|
||||
|
||||
|
@ -558,18 +556,18 @@ class DFRN
|
|||
$alternatelink = $owner['url'];
|
||||
}
|
||||
|
||||
$root = $doc->createElementNS(Namespaces::ATOM1, 'feed');
|
||||
$root = $doc->createElementNS(ANamespace::ATOM1, 'feed');
|
||||
$doc->appendChild($root);
|
||||
|
||||
$root->setAttribute("xmlns:thr", Namespaces::THREAD);
|
||||
$root->setAttribute("xmlns:at", Namespaces::TOMB);
|
||||
$root->setAttribute("xmlns:media", Namespaces::MEDIA);
|
||||
$root->setAttribute("xmlns:dfrn", Namespaces::DFRN);
|
||||
$root->setAttribute("xmlns:activity", Namespaces::ACTIVITY);
|
||||
$root->setAttribute("xmlns:georss", Namespaces::GEORSS);
|
||||
$root->setAttribute("xmlns:poco", Namespaces::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", Namespaces::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", Namespaces::STATUSNET);
|
||||
$root->setAttribute("xmlns:thr", ANamespace::THREAD);
|
||||
$root->setAttribute("xmlns:at", ANamespace::TOMB);
|
||||
$root->setAttribute("xmlns:media", ANamespace::MEDIA);
|
||||
$root->setAttribute("xmlns:dfrn", ANamespace::DFRN);
|
||||
$root->setAttribute("xmlns:activity", ANamespace::ACTIVITY);
|
||||
$root->setAttribute("xmlns:georss", ANamespace::GEORSS);
|
||||
$root->setAttribute("xmlns:poco", ANamespace::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", ANamespace::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", ANamespace::STATUSNET);
|
||||
|
||||
XML::addElement($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]);
|
||||
XML::addElement($doc, $root, "title", $owner["name"]);
|
||||
|
@ -942,18 +940,18 @@ class DFRN
|
|||
if (!$single) {
|
||||
$entry = $doc->createElement("entry");
|
||||
} else {
|
||||
$entry = $doc->createElementNS(Namespaces::ATOM1, 'entry');
|
||||
$entry = $doc->createElementNS(ANamespace::ATOM1, 'entry');
|
||||
$doc->appendChild($entry);
|
||||
|
||||
$entry->setAttribute("xmlns:thr", Namespaces::THREAD);
|
||||
$entry->setAttribute("xmlns:at", Namespaces::TOMB);
|
||||
$entry->setAttribute("xmlns:media", Namespaces::MEDIA);
|
||||
$entry->setAttribute("xmlns:dfrn", Namespaces::DFRN);
|
||||
$entry->setAttribute("xmlns:activity", Namespaces::ACTIVITY);
|
||||
$entry->setAttribute("xmlns:georss", Namespaces::GEORSS);
|
||||
$entry->setAttribute("xmlns:poco", Namespaces::POCO);
|
||||
$entry->setAttribute("xmlns:ostatus", Namespaces::OSTATUS);
|
||||
$entry->setAttribute("xmlns:statusnet", Namespaces::STATUSNET);
|
||||
$entry->setAttribute("xmlns:thr", ANamespace::THREAD);
|
||||
$entry->setAttribute("xmlns:at", ANamespace::TOMB);
|
||||
$entry->setAttribute("xmlns:media", ANamespace::MEDIA);
|
||||
$entry->setAttribute("xmlns:dfrn", ANamespace::DFRN);
|
||||
$entry->setAttribute("xmlns:activity", ANamespace::ACTIVITY);
|
||||
$entry->setAttribute("xmlns:georss", ANamespace::GEORSS);
|
||||
$entry->setAttribute("xmlns:poco", ANamespace::POCO);
|
||||
$entry->setAttribute("xmlns:ostatus", ANamespace::OSTATUS);
|
||||
$entry->setAttribute("xmlns:statusnet", ANamespace::STATUSNET);
|
||||
}
|
||||
|
||||
if ($item['private']) {
|
||||
|
@ -1751,7 +1749,7 @@ class DFRN
|
|||
$obj_doc = new DOMDocument("1.0", "utf-8");
|
||||
$obj_doc->formatOutput = true;
|
||||
|
||||
$obj_element = $obj_doc->createElementNS( Namespaces::ATOM1, $element);
|
||||
$obj_element = $obj_doc->createElementNS( ANamespace::ATOM1, $element);
|
||||
|
||||
$activity_type = $xpath->query("activity:object-type/text()", $activity)->item(0)->nodeValue;
|
||||
XML::addElement($obj_doc, $obj_element, "type", $activity_type);
|
||||
|
@ -2732,16 +2730,16 @@ class DFRN
|
|||
@$doc->loadXML($xml);
|
||||
|
||||
$xpath = new DOMXPath($doc);
|
||||
$xpath->registerNamespace("atom", Namespaces::ATOM1);
|
||||
$xpath->registerNamespace("thr", Namespaces::THREAD);
|
||||
$xpath->registerNamespace("at", Namespaces::TOMB);
|
||||
$xpath->registerNamespace("media", Namespaces::MEDIA);
|
||||
$xpath->registerNamespace("dfrn", Namespaces::DFRN);
|
||||
$xpath->registerNamespace("activity", Namespaces::ACTIVITY);
|
||||
$xpath->registerNamespace("georss", Namespaces::GEORSS);
|
||||
$xpath->registerNamespace("poco", Namespaces::POCO);
|
||||
$xpath->registerNamespace("ostatus", Namespaces::OSTATUS);
|
||||
$xpath->registerNamespace("statusnet", Namespaces::STATUSNET);
|
||||
$xpath->registerNamespace("atom", ANamespace::ATOM1);
|
||||
$xpath->registerNamespace("thr", ANamespace::THREAD);
|
||||
$xpath->registerNamespace("at", ANamespace::TOMB);
|
||||
$xpath->registerNamespace("media", ANamespace::MEDIA);
|
||||
$xpath->registerNamespace("dfrn", ANamespace::DFRN);
|
||||
$xpath->registerNamespace("activity", ANamespace::ACTIVITY);
|
||||
$xpath->registerNamespace("georss", ANamespace::GEORSS);
|
||||
$xpath->registerNamespace("poco", ANamespace::POCO);
|
||||
$xpath->registerNamespace("ostatus", ANamespace::OSTATUS);
|
||||
$xpath->registerNamespace("statusnet", ANamespace::STATUSNET);
|
||||
|
||||
$header = [];
|
||||
$header["uid"] = $importer["importer_uid"];
|
||||
|
|
|
@ -32,7 +32,7 @@ use Friendica\Model\Mail;
|
|||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Map;
|
||||
|
@ -466,7 +466,7 @@ class Diaspora
|
|||
}
|
||||
}
|
||||
|
||||
$base = $basedom->children(Namespaces::SALMON_ME);
|
||||
$base = $basedom->children(ANamespace::SALMON_ME);
|
||||
|
||||
// Not sure if this cleaning is needed
|
||||
$data = str_replace([" ", "\t", "\r", "\n"], ["", "", "", ""], $base->data);
|
||||
|
@ -578,7 +578,7 @@ class Diaspora
|
|||
$author_link = str_replace('acct:', '', $idom->author_id);
|
||||
}
|
||||
|
||||
$dom = $basedom->children(Namespaces::SALMON_ME);
|
||||
$dom = $basedom->children(ANamespace::SALMON_ME);
|
||||
|
||||
// figure out where in the DOM tree our data is hiding
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -60,13 +60,13 @@ class Feed {
|
|||
$doc = new DOMDocument();
|
||||
@$doc->loadXML(trim($xml));
|
||||
$xpath = new DOMXPath($doc);
|
||||
$xpath->registerNamespace('atom', Namespaces::ATOM1);
|
||||
$xpath->registerNamespace('atom', ANamespace::ATOM1);
|
||||
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
|
||||
$xpath->registerNamespace('content', "http://purl.org/rss/1.0/modules/content/");
|
||||
$xpath->registerNamespace('rdf', "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
||||
$xpath->registerNamespace('rss', "http://purl.org/rss/1.0/");
|
||||
$xpath->registerNamespace('media', "http://search.yahoo.com/mrss/");
|
||||
$xpath->registerNamespace('poco', Namespaces::POCO);
|
||||
$xpath->registerNamespace('poco', ANamespace::POCO);
|
||||
|
||||
$author = [];
|
||||
$entries = null;
|
||||
|
|
|
@ -10,22 +10,22 @@ use Friendica\Content\Text\BBCode;
|
|||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Lock;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity\Namespaces;
|
||||
use Friendica\Protocol\Activity\ANamespace;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
@ -262,14 +262,14 @@ class OStatus
|
|||
@$doc->loadXML($xml);
|
||||
|
||||
$xpath = new DOMXPath($doc);
|
||||
$xpath->registerNamespace('atom', Namespaces::ATOM1);
|
||||
$xpath->registerNamespace('thr', Namespaces::THREAD);
|
||||
$xpath->registerNamespace('georss', Namespaces::GEORSS);
|
||||
$xpath->registerNamespace('activity', Namespaces::ACTIVITY);
|
||||
$xpath->registerNamespace('media', Namespaces::MEDIA);
|
||||
$xpath->registerNamespace('poco', Namespaces::POCO);
|
||||
$xpath->registerNamespace('ostatus', Namespaces::OSTATUS);
|
||||
$xpath->registerNamespace('statusnet', Namespaces::STATUSNET);
|
||||
$xpath->registerNamespace('atom', ANamespace::ATOM1);
|
||||
$xpath->registerNamespace('thr', ANamespace::THREAD);
|
||||
$xpath->registerNamespace('georss', ANamespace::GEORSS);
|
||||
$xpath->registerNamespace('activity', ANamespace::ACTIVITY);
|
||||
$xpath->registerNamespace('media', ANamespace::MEDIA);
|
||||
$xpath->registerNamespace('poco', ANamespace::POCO);
|
||||
$xpath->registerNamespace('ostatus', ANamespace::OSTATUS);
|
||||
$xpath->registerNamespace('statusnet', ANamespace::STATUSNET);
|
||||
|
||||
$contact = ["id" => 0];
|
||||
|
||||
|
@ -343,14 +343,14 @@ class OStatus
|
|||
@$doc->loadXML($xml);
|
||||
|
||||
$xpath = new DOMXPath($doc);
|
||||
$xpath->registerNamespace('atom', Namespaces::ATOM1);
|
||||
$xpath->registerNamespace('thr', Namespaces::THREAD);
|
||||
$xpath->registerNamespace('georss', Namespaces::GEORSS);
|
||||
$xpath->registerNamespace('activity', Namespaces::ACTIVITY);
|
||||
$xpath->registerNamespace('media', Namespaces::MEDIA);
|
||||
$xpath->registerNamespace('poco', Namespaces::POCO);
|
||||
$xpath->registerNamespace('ostatus', Namespaces::OSTATUS);
|
||||
$xpath->registerNamespace('statusnet', Namespaces::STATUSNET);
|
||||
$xpath->registerNamespace('atom', ANamespace::ATOM1);
|
||||
$xpath->registerNamespace('thr', ANamespace::THREAD);
|
||||
$xpath->registerNamespace('georss', ANamespace::GEORSS);
|
||||
$xpath->registerNamespace('activity', ANamespace::ACTIVITY);
|
||||
$xpath->registerNamespace('media', ANamespace::MEDIA);
|
||||
$xpath->registerNamespace('poco', ANamespace::POCO);
|
||||
$xpath->registerNamespace('ostatus', ANamespace::OSTATUS);
|
||||
$xpath->registerNamespace('statusnet', ANamespace::STATUSNET);
|
||||
|
||||
$hub = "";
|
||||
$hub_items = $xpath->query("/atom:feed/atom:link[@rel='hub']")->item(0);
|
||||
|
@ -434,7 +434,7 @@ class OStatus
|
|||
continue;
|
||||
}
|
||||
|
||||
if (in_array($item["verb"], [Namespaces::OSTATUS . "/unfavorite", Activity::UNFAVORITE])) {
|
||||
if (in_array($item["verb"], [ANamespace::OSTATUS . "/unfavorite", Activity::UNFAVORITE])) {
|
||||
// Ignore "Unfavorite" message
|
||||
Logger::log("Ignore unfavorite message ".print_r($item, true), Logger::DEBUG);
|
||||
continue;
|
||||
|
@ -465,7 +465,7 @@ class OStatus
|
|||
continue;
|
||||
}
|
||||
|
||||
if ($item["verb"] == Namespaces::OSTATUS."/unfollow") {
|
||||
if ($item["verb"] == ANamespace::OSTATUS . "/unfollow") {
|
||||
$dummy = null;
|
||||
Contact::removeFollower($importer, $contact, $item, $dummy);
|
||||
continue;
|
||||
|
@ -804,9 +804,9 @@ class OStatus
|
|||
@$doc->loadXML($xml);
|
||||
|
||||
$xpath = new DOMXPath($doc);
|
||||
$xpath->registerNamespace('atom', Namespaces::ATOM1);
|
||||
$xpath->registerNamespace('thr', Namespaces::THREAD);
|
||||
$xpath->registerNamespace('ostatus', Namespaces::OSTATUS);
|
||||
$xpath->registerNamespace('atom', ANamespace::ATOM1);
|
||||
$xpath->registerNamespace('thr', ANamespace::THREAD);
|
||||
$xpath->registerNamespace('ostatus', ANamespace::OSTATUS);
|
||||
|
||||
$entries = $xpath->query('/atom:feed/atom:entry');
|
||||
|
||||
|
@ -1282,17 +1282,17 @@ class OStatus
|
|||
*/
|
||||
private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
|
||||
{
|
||||
$root = $doc->createElementNS(Namespaces::ATOM1, 'feed');
|
||||
$root = $doc->createElementNS(ANamespace::ATOM1, 'feed');
|
||||
$doc->appendChild($root);
|
||||
|
||||
$root->setAttribute("xmlns:thr", Namespaces::THREAD);
|
||||
$root->setAttribute("xmlns:georss", Namespaces::GEORSS);
|
||||
$root->setAttribute("xmlns:activity", Namespaces::ACTIVITY);
|
||||
$root->setAttribute("xmlns:media", Namespaces::MEDIA);
|
||||
$root->setAttribute("xmlns:poco", Namespaces::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", Namespaces::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", Namespaces::STATUSNET);
|
||||
$root->setAttribute("xmlns:mastodon", Namespaces::MASTODON);
|
||||
$root->setAttribute("xmlns:thr", ANamespace::THREAD);
|
||||
$root->setAttribute("xmlns:georss", ANamespace::GEORSS);
|
||||
$root->setAttribute("xmlns:activity", ANamespace::ACTIVITY);
|
||||
$root->setAttribute("xmlns:media", ANamespace::MEDIA);
|
||||
$root->setAttribute("xmlns:poco", ANamespace::POCO);
|
||||
$root->setAttribute("xmlns:ostatus", ANamespace::OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", ANamespace::STATUSNET);
|
||||
$root->setAttribute("xmlns:mastodon", ANamespace::MASTODON);
|
||||
|
||||
$title = '';
|
||||
$selfUri = '/feed/' . $owner["nick"] . '/';
|
||||
|
@ -1592,7 +1592,7 @@ class OStatus
|
|||
|
||||
if ($item["verb"] == Activity::LIKE) {
|
||||
return self::likeEntry($doc, $item, $owner, $toplevel);
|
||||
} elseif (in_array($item["verb"], [Activity::FOLLOW, Namespaces::OSTATUS . "/unfollow"])) {
|
||||
} elseif (in_array($item["verb"], [Activity::FOLLOW, ANamespace::OSTATUS . "/unfollow"])) {
|
||||
return self::followEntry($doc, $item, $owner, $toplevel);
|
||||
} else {
|
||||
return self::noteEntry($doc, $item, $owner, $toplevel, $feed_mode);
|
||||
|
@ -1710,7 +1710,7 @@ class OStatus
|
|||
|
||||
$as_object = $doc->createElement("activity:object");
|
||||
|
||||
XML::addElement($doc, $as_object, "activity:object-type", Namespaces::ACTIVITY_SCHEMA . "activity");
|
||||
XML::addElement($doc, $as_object, "activity:object-type", ANamespace::ACTIVITY_SCHEMA . "activity");
|
||||
|
||||
self::entryContent($doc, $as_object, $repeated_item, $owner, "", "", false);
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ class OStatus
|
|||
|
||||
$entry = self::entryHeader($doc, $owner, $item, $toplevel);
|
||||
|
||||
$verb = Activity\Namespaces::ACTIVITY_SCHEMA."favorite";
|
||||
$verb = Activity\ANamespace::ACTIVITY_SCHEMA . "favorite";
|
||||
self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
|
||||
|
||||
$parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]);
|
||||
|
@ -1951,16 +1951,16 @@ class OStatus
|
|||
$entry->appendChild($author);
|
||||
}
|
||||
} else {
|
||||
$entry = $doc->createElementNS(Namespaces::ATOM1, "entry");
|
||||
$entry = $doc->createElementNS(ANamespace::ATOM1, "entry");
|
||||
|
||||
$entry->setAttribute("xmlns:thr", Namespaces::THREAD);
|
||||
$entry->setAttribute("xmlns:georss", Namespaces::GEORSS);
|
||||
$entry->setAttribute("xmlns:activity", Namespaces::ACTIVITY);
|
||||
$entry->setAttribute("xmlns:media", Namespaces::MEDIA);
|
||||
$entry->setAttribute("xmlns:poco", Namespaces::POCO);
|
||||
$entry->setAttribute("xmlns:ostatus", Namespaces::OSTATUS);
|
||||
$entry->setAttribute("xmlns:statusnet", Namespaces::STATUSNET);
|
||||
$entry->setAttribute("xmlns:mastodon", Namespaces::MASTODON);
|
||||
$entry->setAttribute("xmlns:thr", ANamespace::THREAD);
|
||||
$entry->setAttribute("xmlns:georss", ANamespace::GEORSS);
|
||||
$entry->setAttribute("xmlns:activity", ANamespace::ACTIVITY);
|
||||
$entry->setAttribute("xmlns:media", ANamespace::MEDIA);
|
||||
$entry->setAttribute("xmlns:poco", ANamespace::POCO);
|
||||
$entry->setAttribute("xmlns:ostatus", ANamespace::OSTATUS);
|
||||
$entry->setAttribute("xmlns:statusnet", ANamespace::STATUSNET);
|
||||
$entry->setAttribute("xmlns:mastodon", ANamespace::MASTODON);
|
||||
|
||||
$author = self::addAuthor($doc, $owner);
|
||||
$entry->appendChild($author);
|
||||
|
|
|
@ -22,7 +22,7 @@ class ActivityTest extends MockedTest
|
|||
],
|
||||
'withNamespace' => [
|
||||
'haystack' => 'tagterm',
|
||||
'needle' => Activity\Namespaces::ACTIVITY_SCHEMA . Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . Activity::OBJ_TAGTERM,
|
||||
'assert' => true,
|
||||
],
|
||||
'invalidSimple' => [
|
||||
|
@ -37,7 +37,7 @@ class ActivityTest extends MockedTest
|
|||
],
|
||||
'withSubPath' => [
|
||||
'haystack' => 'tagterm',
|
||||
'needle' => Activity\Namespaces::ACTIVITY_SCHEMA . '/bla/' . Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . '/bla/' . Activity::OBJ_TAGTERM,
|
||||
'assert' => true,
|
||||
],
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue