mirror of
https://github.com/friendica/friendica
synced 2025-04-26 17:10:10 +00:00
Add docs
This commit is contained in:
parent
a83dfc11a0
commit
3897c74deb
21 changed files with 439 additions and 122 deletions
|
@ -5,50 +5,157 @@ namespace Friendica\Protocol;
|
|||
use Friendica\Protocol\Activity\ANamespace;
|
||||
|
||||
/**
|
||||
* Base class for the Activity constants and particular method
|
||||
* Base class for the Activity Verbs
|
||||
*/
|
||||
final class Activity
|
||||
{
|
||||
const LIKE = ANamespace::ACTIVITY_SCHEMA . 'like';
|
||||
/**
|
||||
* Indicates that the actor marked the object as an item of special interest.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const LIKE = ANamespace::ACTIVITY_SCHEMA . 'like';
|
||||
/**
|
||||
* Dislike a message ("I don't like the post")
|
||||
*
|
||||
* @see http://purl.org/macgirvin/dfrn/1.0/dislike
|
||||
* @var string
|
||||
*/
|
||||
const DISLIKE = ANamespace::DFRN . '/dislike';
|
||||
|
||||
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';
|
||||
/**
|
||||
* Attend an event
|
||||
*
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_attend
|
||||
* @var string
|
||||
*/
|
||||
const ATTEND = ANamespace::ZOT . '/activity/attendyes';
|
||||
/**
|
||||
* Don't attend an event
|
||||
*
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_attendno
|
||||
* @var string
|
||||
*/
|
||||
const ATTENDNO = ANamespace::ZOT . '/activity/attendno';
|
||||
/**
|
||||
* Attend maybe an event
|
||||
*
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_attendmaybe
|
||||
* @var string
|
||||
*/
|
||||
const ATTENDMAYBE = ANamespace::ZOT . '/activity/attendmaybe';
|
||||
|
||||
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';
|
||||
/**
|
||||
* Indicates the creation of a friendship that is reciprocated by the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const FRIEND = ANamespace::ACTIVITY_SCHEMA . 'make-friend';
|
||||
/**
|
||||
* Indicates the creation of a friendship that has not yet been reciprocated by the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const REQ_FRIEND = ANamespace::ACTIVITY_SCHEMA . 'request-friend';
|
||||
/**
|
||||
* Indicates that the actor has removed the object from the collection of friends.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const UNFRIEND = ANamespace::ACTIVITY_SCHEMA . 'remove-friend';
|
||||
/**
|
||||
* Indicates that the actor began following the activity of the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const FOLLOW = ANamespace::ACTIVITY_SCHEMA . 'follow';
|
||||
/**
|
||||
* Indicates that the actor has stopped following the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const UNFOLLOW = ANamespace::ACTIVITY_SCHEMA . 'stop-following';
|
||||
/**
|
||||
* Indicates that the actor has become a member of the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const JOIN = ANamespace::ACTIVITY_SCHEMA . 'join';
|
||||
/**
|
||||
* Implementors SHOULD use verbs such as post where the actor is adding new items to a collection or similar.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const POST = ANamespace::ACTIVITY_SCHEMA . 'post';
|
||||
/**
|
||||
* The "update" verb indicates that the actor has modified the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const UPDATE = ANamespace::ACTIVITY_SCHEMA . 'update';
|
||||
/**
|
||||
* Indicates that the actor has identified the presence of a target inside another object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const TAG = ANamespace::ACTIVITY_SCHEMA . 'tag';
|
||||
/**
|
||||
* Indicates that the actor marked the object as an item of special interest.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const FAVORITE = ANamespace::ACTIVITY_SCHEMA . 'favorite';
|
||||
/**
|
||||
* Indicates that the actor has removed the object from the collection of favorited items.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const UNFAVORITE = ANamespace::ACTIVITY_SCHEMA . 'unfavorite';
|
||||
/**
|
||||
* Indicates that the actor has called out the object to readers.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const SHARE = ANamespace::ACTIVITY_SCHEMA . 'share';
|
||||
/**
|
||||
* Indicates that the actor has deleted the object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#verbs
|
||||
* @var string
|
||||
*/
|
||||
const DELETE = ANamespace::ACTIVITY_SCHEMA . 'delete';
|
||||
/**
|
||||
* Indicates that the actor is calling the target's attention the object.
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce
|
||||
* @var string
|
||||
*/
|
||||
const ANNOUNCE = ANamespace::ACTIVITY2 . 'Announce';
|
||||
|
||||
const POKE = ANamespace::ZOT . '/activity/poke';
|
||||
/**
|
||||
* Pokes an user.
|
||||
*
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_poke
|
||||
* @var string
|
||||
*/
|
||||
const POKE = ANamespace::ZOT . '/activity/poke';
|
||||
|
||||
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';
|
||||
const O_UNFOLLOW = ANamespace::OSTATUS . '/unfollow';
|
||||
const O_UNFAVOURITE = ANamespace::OSTATUS . '/unfavorite';
|
||||
|
||||
/**
|
||||
* likes (etc.) can apply to other things besides posts. Check if they are post children,
|
||||
|
|
|
@ -7,21 +7,126 @@ namespace Friendica\Protocol\Activity;
|
|||
*/
|
||||
final class ANamespace
|
||||
{
|
||||
/**
|
||||
* Zot is a WebMTA which provides a decentralised identity and communications protocol using HTTPS/JSON.
|
||||
*
|
||||
* @var string
|
||||
* @see https://zotlabs.org/page/zotlabs/specs+zot6+home
|
||||
*/
|
||||
const ZOT = 'http://purl.org/zot';
|
||||
/**
|
||||
* Friendica is using ActivityStreams in version 1.0 for its activities and object types.
|
||||
* Additional types are used for non standard activities.
|
||||
*
|
||||
* @var string
|
||||
* @see https://github.com/friendica/friendica/wiki/ActivityStreams
|
||||
*/
|
||||
const DFRN = 'http://purl.org/macgirvin/dfrn/1.0';
|
||||
/**
|
||||
* This namespace defines an extension for expressing threaded
|
||||
* discussions within the Atom Syndication Format [RFC4287]
|
||||
*
|
||||
* @see https://tools.ietf.org/rfc/rfc4685.txt
|
||||
* @var string
|
||||
*/
|
||||
const THREAD = 'http://purl.org/syndication/thread/1.0';
|
||||
/**
|
||||
* This namespace adds mechanisms to the Atom Syndication Format
|
||||
* that publishers of Atom Feed and Entry documents can use to
|
||||
* explicitly identify Atom entries that have been removed.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc6721
|
||||
* @var string
|
||||
*/
|
||||
const TOMB = 'http://purl.org/atompub/tombstones/1.0';
|
||||
/**
|
||||
* This specification details a model for representing potential and completed activities
|
||||
* using the JSON format.
|
||||
*
|
||||
* @see https://www.w3.org/ns/activitystreams
|
||||
* @var string
|
||||
*/
|
||||
const ACTIVITY2 = 'https://www.w3.org/ns/activitystreams#';
|
||||
/**
|
||||
* Atom Activities 1.0
|
||||
*
|
||||
* This namespace presents an XML format that allows activities on social objects
|
||||
* to be expressed within the Atom Syndication Format.
|
||||
*
|
||||
* @see http://activitystrea.ms/spec/1.0
|
||||
* @var string
|
||||
*/
|
||||
const ACTIVITY = 'http://activitystrea.ms/spec/1.0/';
|
||||
/**
|
||||
* This namespace presents a base set of Object types and Verbs for use with Activity Streams.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html
|
||||
* @var string
|
||||
*/
|
||||
const ACTIVITY_SCHEMA = 'http://activitystrea.ms/schema/1.0/';
|
||||
/**
|
||||
* Atom Media Extensions
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MEDIA = 'http://purl.org/syndication/atommedia';
|
||||
/**
|
||||
* The Salmon Protocol is an open, simple, standards-based solution that lets
|
||||
* aggregators and sources unify the conversations.
|
||||
*
|
||||
* @see http://www.salmon-protocol.org/salmon-protocol-summary
|
||||
* @var string
|
||||
*/
|
||||
const SALMON_ME = 'http://salmon-protocol.org/ns/magic-env';
|
||||
/**
|
||||
* OStatus is a minimal specification for distributed status updates or microblogging.
|
||||
*
|
||||
* @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html
|
||||
* @var string
|
||||
*/
|
||||
const OSTATUSSUB = 'http://ostatus.org/schema/1.0/subscribe';
|
||||
/**
|
||||
* GeoRSS was designed as a lightweight, community driven way to extend existing feeds with geographic information.
|
||||
*
|
||||
* @see http://www.georss.org/
|
||||
* @var string
|
||||
*/
|
||||
const GEORSS = 'http://www.georss.org/georss';
|
||||
/**
|
||||
* The Portable Contacts specification is designed to make it easier for developers
|
||||
* to give their users a secure way to access the address books and friends lists
|
||||
* they have built up all over the web.
|
||||
*
|
||||
* @see http://portablecontacts.net/draft-spec/
|
||||
* @var string
|
||||
*/
|
||||
const POCO = 'http://portablecontacts.net/spec/1.0';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const FEED = 'http://schemas.google.com/g/2010#updates-from';
|
||||
/**
|
||||
* OStatus is a minimal specification for distributed status updates or microblogging.
|
||||
*
|
||||
* @see https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html
|
||||
* @var string
|
||||
*/
|
||||
const OSTATUS = 'http://ostatus.org/schema/1.0';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const STATUSNET = 'http://status.net/schema/api/1/';
|
||||
/**
|
||||
* This namespace describes the Atom Activity Streams in RDF Vocabulary (AAIR),
|
||||
* defined as a dictionary of named properties and classes using W3C's RDF technology,
|
||||
* and specifically a mapping of the Atom Activity Streams work to RDF.
|
||||
*
|
||||
* @see http://xmlns.notu.be/aair/#RFC4287
|
||||
* @var string
|
||||
*/
|
||||
const ATOM1 = 'http://www.w3.org/2005/Atom';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const MASTODON = 'http://mastodon.social/schema/1.0';
|
||||
}
|
||||
|
|
103
src/Protocol/Activity/ObjectType.php
Normal file
103
src/Protocol/Activity/ObjectType.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Protocol\Activity;
|
||||
|
||||
/**
|
||||
* This class contains the different object types in activities
|
||||
*/
|
||||
final class ObjectType
|
||||
{
|
||||
/**
|
||||
* The "bookmark" object type represents a pointer to some URL -- typically a web page.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#bookmark
|
||||
* @var string
|
||||
*/
|
||||
const BOOKMARK = ANamespace::ACTIVITY_SCHEMA . 'bookmark';
|
||||
/**
|
||||
* The "comment" object type represents a textual response to another object.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#comment
|
||||
* @var string
|
||||
*/
|
||||
const COMMENT = ANamespace::ACTIVITY_SCHEMA . 'comment';
|
||||
/**
|
||||
* The "comment" object type represents a textual response to another object.
|
||||
* (Default type for items)
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#note
|
||||
* @var string
|
||||
*/
|
||||
const NOTE = ANamespace::ACTIVITY_SCHEMA . 'note';
|
||||
/**
|
||||
* The "person" object type represents a user account.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#person
|
||||
* @var string
|
||||
*/
|
||||
const PERSON = ANamespace::ACTIVITY_SCHEMA . 'person';
|
||||
/**
|
||||
* The "image" object type represents a graphical image.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#image
|
||||
* @var string
|
||||
*/
|
||||
const IMAGE = ANamespace::ACTIVITY_SCHEMA . 'image';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PHOTO = ANamespace::ACTIVITY_SCHEMA . 'photo';
|
||||
/**
|
||||
* The "video" object type represents video content,
|
||||
* which usually consists of a motion picture track and an audio track.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#video
|
||||
* @var string
|
||||
*/
|
||||
const VIDEO = ANamespace::ACTIVITY_SCHEMA . 'video';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROFILE_PHOTO = ANamespace::ACTIVITY_SCHEMA . 'profile-photo';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const ALBUM = ANamespace::ACTIVITY_SCHEMA . 'photo-album';
|
||||
/**
|
||||
* The "event" object type represents an event that occurs in a certain place during a particular interval of time.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#event
|
||||
* @var string
|
||||
*/
|
||||
const EVENT = ANamespace::ACTIVITY_SCHEMA . 'event';
|
||||
/**
|
||||
* The "group" object type represents a grouping of objects in which member objects can join or leave.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#group
|
||||
* @var string
|
||||
*/
|
||||
const GROUP = ANamespace::ACTIVITY_SCHEMA . 'group';
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const HEART = ANamespace::DFRN . '/heart';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const TAGTERM = ANamespace::DFRN . '/tagterm';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const PROFILE = ANamespace::DFRN . '/profile';
|
||||
|
||||
|
||||
/**
|
||||
* The "question" object type represents a question or poll.
|
||||
*
|
||||
* @see http://activitystrea.ms/head/activity-schema.html#question
|
||||
* @var string
|
||||
*/
|
||||
const QUESTION = 'http://activityschema.org/object/question';
|
||||
}
|
|
@ -4,20 +4,20 @@
|
|||
*/
|
||||
namespace Friendica\Protocol\ActivityPub;
|
||||
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -173,10 +173,10 @@ class Processor
|
|||
|
||||
if ($activity['reply-to-id'] == $activity['id']) {
|
||||
$item['gravity'] = GRAVITY_PARENT;
|
||||
$item['object-type'] = Activity::OBJ_NOTE;
|
||||
$item['object-type'] = Activity\ObjectType::NOTE;
|
||||
} else {
|
||||
$item['gravity'] = GRAVITY_COMMENT;
|
||||
$item['object-type'] = Activity::OBJ_COMMENT;
|
||||
$item['object-type'] = Activity\ObjectType::COMMENT;
|
||||
}
|
||||
|
||||
if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
|
||||
|
@ -255,7 +255,7 @@ class Processor
|
|||
$item['verb'] = $verb;
|
||||
$item['thr-parent'] = $activity['object_id'];
|
||||
$item['gravity'] = GRAVITY_ACTIVITY;
|
||||
$item['object-type'] = Activity::OBJ_NOTE;
|
||||
$item['object-type'] = Activity\ObjectType::NOTE;
|
||||
|
||||
$item['diaspora_signed_text'] = $activity['diaspora:like'] ?? '';
|
||||
|
||||
|
|
|
@ -1078,9 +1078,9 @@ class DFRN
|
|||
if ($item['object-type'] != "") {
|
||||
XML::addElement($doc, $entry, "activity:object-type", $item['object-type']);
|
||||
} elseif ($item['id'] == $item['parent']) {
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity::OBJ_NOTE);
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::NOTE);
|
||||
} else {
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity::OBJ_COMMENT);
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::COMMENT);
|
||||
}
|
||||
|
||||
$actobj = self::createActivity($doc, "activity:object", $item['object']);
|
||||
|
@ -1123,7 +1123,7 @@ class DFRN
|
|||
"link",
|
||||
"",
|
||||
["rel" => "mentioned",
|
||||
"ostatus:object-type" => Activity::OBJ_GROUP,
|
||||
"ostatus:object-type" => Activity\ObjectType::GROUP,
|
||||
"href" => $mention]
|
||||
);
|
||||
} else {
|
||||
|
@ -1133,7 +1133,7 @@ class DFRN
|
|||
"link",
|
||||
"",
|
||||
["rel" => "mentioned",
|
||||
"ostatus:object-type" => Activity::OBJ_PERSON,
|
||||
"ostatus:object-type" => Activity\ObjectType::PERSON,
|
||||
"href" => $mention]
|
||||
);
|
||||
}
|
||||
|
@ -2116,7 +2116,7 @@ class DFRN
|
|||
}
|
||||
$xo = XML::parseString($item["object"], false);
|
||||
|
||||
if (($xo->type == Activity::OBJ_PERSON) && ($xo->id)) {
|
||||
if (($xo->type == Activity\ObjectType::PERSON) && ($xo->id)) {
|
||||
// somebody was poked/prodded. Was it me?
|
||||
$Blink = '';
|
||||
foreach ($xo->link as $l) {
|
||||
|
@ -2237,11 +2237,11 @@ class DFRN
|
|||
$is_like = false;
|
||||
}
|
||||
|
||||
if (($item["verb"] == Activity::TAG) && ($item["object-type"] == Activity::OBJ_TAGTERM)) {
|
||||
if (($item["verb"] == Activity::TAG) && ($item["object-type"] == Activity\ObjectType::TAGTERM)) {
|
||||
$xo = XML::parseString($item["object"], false);
|
||||
$xt = XML::parseString($item["target"], false);
|
||||
|
||||
if ($xt->type == Activity::OBJ_NOTE) {
|
||||
if ($xt->type == Activity\ObjectType::NOTE) {
|
||||
$item_tag = Item::selectFirst(['id', 'tag'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
|
||||
|
||||
if (!DBA::isResult($item_tag)) {
|
||||
|
@ -2516,7 +2516,7 @@ class DFRN
|
|||
// Now assign the rest of the values that depend on the type of the message
|
||||
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
||||
if (!isset($item["object-type"])) {
|
||||
$item["object-type"] = Activity::OBJ_COMMENT;
|
||||
$item["object-type"] = Activity\ObjectType::COMMENT;
|
||||
}
|
||||
|
||||
if ($item["contact-id"] != $owner["contact-id"]) {
|
||||
|
@ -2540,11 +2540,11 @@ class DFRN
|
|||
$item["wall"] = 1;
|
||||
} elseif ($entrytype == DFRN::TOP_LEVEL) {
|
||||
if (!isset($item["object-type"])) {
|
||||
$item["object-type"] = Activity::OBJ_NOTE;
|
||||
$item["object-type"] = Activity\ObjectType::NOTE;
|
||||
}
|
||||
|
||||
// Is it an event?
|
||||
if (($item["object-type"] == Activity::OBJ_EVENT) && !$owner_unknown) {
|
||||
if (($item["object-type"] == Activity\ObjectType::EVENT) && !$owner_unknown) {
|
||||
Logger::log("Item ".$item["uri"]." seems to contain an event.", Logger::DEBUG);
|
||||
$ev = Event::fromBBCode($item["body"]);
|
||||
if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) {
|
||||
|
|
|
@ -1855,7 +1855,7 @@ class Diaspora
|
|||
$datarray["parent-uri"] = $parent_item["uri"];
|
||||
}
|
||||
|
||||
$datarray["object-type"] = Activity::OBJ_COMMENT;
|
||||
$datarray["object-type"] = Activity\ObjectType::COMMENT;
|
||||
|
||||
$datarray["protocol"] = Conversation::PARCEL_DIASPORA;
|
||||
$datarray["source"] = $xml;
|
||||
|
@ -2086,7 +2086,7 @@ class Diaspora
|
|||
$datarray["gravity"] = GRAVITY_ACTIVITY;
|
||||
$datarray["parent-uri"] = $parent_item["uri"];
|
||||
|
||||
$datarray["object-type"] = Activity::OBJ_NOTE;
|
||||
$datarray["object-type"] = Activity\ObjectType::NOTE;
|
||||
|
||||
$datarray["body"] = $verb;
|
||||
|
||||
|
@ -2687,7 +2687,7 @@ class Diaspora
|
|||
|
||||
$datarray['verb'] = $datarray['body'] = Activity::ANNOUNCE;
|
||||
$datarray['gravity'] = GRAVITY_ACTIVITY;
|
||||
$datarray['object-type'] = Activity::OBJ_NOTE;
|
||||
$datarray['object-type'] = Activity\ObjectType::NOTE;
|
||||
|
||||
$datarray['protocol'] = $item['protocol'];
|
||||
|
||||
|
@ -2963,9 +2963,9 @@ class Diaspora
|
|||
XML::unescape($photo->remote_photo_name)."[/img]\n".$body;
|
||||
}
|
||||
|
||||
$datarray["object-type"] = Activity::OBJ_IMAGE;
|
||||
$datarray["object-type"] = Activity\ObjectType::IMAGE;
|
||||
} else {
|
||||
$datarray["object-type"] = Activity::OBJ_NOTE;
|
||||
$datarray["object-type"] = Activity\ObjectType::NOTE;
|
||||
|
||||
// Add OEmbed and other information to the body
|
||||
if (!self::isRedmatrix($contact["url"])) {
|
||||
|
|
|
@ -200,7 +200,7 @@ class Feed {
|
|||
$header["gravity"] = GRAVITY_PARENT;
|
||||
$header["private"] = 2;
|
||||
$header["verb"] = Activity::POST;
|
||||
$header["object-type"] = Activity::OBJ_NOTE;
|
||||
$header["object-type"] = Activity\ObjectType::NOTE;
|
||||
|
||||
$header["contact-id"] = $contact["id"];
|
||||
|
||||
|
@ -421,7 +421,7 @@ class Feed {
|
|||
$item["title"] = "";
|
||||
$item["body"] = $item["body"].add_page_info($item["plink"], false, $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
|
||||
$item["tag"] = add_page_keywords($item["plink"], $preview, ($contact["fetch_further_information"] == 2), $contact["ffi_keyword_blacklist"]);
|
||||
$item["object-type"] = Activity::OBJ_BOOKMARK;
|
||||
$item["object-type"] = Activity\ObjectType::BOOKMARK;
|
||||
unset($item["attach"]);
|
||||
} else {
|
||||
if (!empty($summary)) {
|
||||
|
|
|
@ -434,7 +434,7 @@ class OStatus
|
|||
continue;
|
||||
}
|
||||
|
||||
if (in_array($item["verb"], [ANamespace::OSTATUS . "/unfavorite", Activity::UNFAVORITE])) {
|
||||
if (in_array($item["verb"], [Activity::O_UNFAVOURITE, 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"] == ANamespace::OSTATUS . "/unfollow") {
|
||||
if ($item["verb"] == Activity::O_UNFOLLOW) {
|
||||
$dummy = null;
|
||||
Contact::removeFollower($importer, $contact, $item, $dummy);
|
||||
continue;
|
||||
|
@ -478,7 +478,7 @@ class OStatus
|
|||
$item["verb"] = Activity::LIKE;
|
||||
$item["parent-uri"] = $orig_uri;
|
||||
$item["gravity"] = GRAVITY_ACTIVITY;
|
||||
$item["object-type"] = Activity::OBJ_NOTE;
|
||||
$item["object-type"] = Activity\ObjectType::NOTE;
|
||||
}
|
||||
|
||||
// http://activitystrea.ms/schema/1.0/rsvp-yes
|
||||
|
@ -593,10 +593,10 @@ class OStatus
|
|||
{
|
||||
$item["body"] = HTML::toBBCode(XML::getFirstNodeValue($xpath, 'atom:content/text()', $entry));
|
||||
$item["object-type"] = XML::getFirstNodeValue($xpath, 'activity:object-type/text()', $entry);
|
||||
if (($item["object-type"] == Activity::OBJ_BOOKMARK) || ($item["object-type"] == Activity::OBJ_EVENT)) {
|
||||
if (($item["object-type"] == Activity\ObjectType::BOOKMARK) || ($item["object-type"] == Activity\ObjectType::EVENT)) {
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
|
||||
$item["body"] = XML::getFirstNodeValue($xpath, 'atom:summary/text()', $entry);
|
||||
} elseif ($item["object-type"] == Activity::OBJ_QUESTION) {
|
||||
} elseif ($item["object-type"] == Activity\ObjectType::QUESTION) {
|
||||
$item["title"] = XML::getFirstNodeValue($xpath, 'atom:title/text()', $entry);
|
||||
}
|
||||
|
||||
|
@ -1106,8 +1106,8 @@ class OStatus
|
|||
switch ($attribute['rel']) {
|
||||
case "alternate":
|
||||
$item["plink"] = $attribute['href'];
|
||||
if (($item["object-type"] == Activity::OBJ_QUESTION)
|
||||
|| ($item["object-type"] == Activity::OBJ_EVENT)
|
||||
if (($item["object-type"] == Activity\ObjectType::QUESTION)
|
||||
|| ($item["object-type"] == Activity\ObjectType::EVENT)
|
||||
) {
|
||||
$item["body"] .= add_page_info($attribute['href']);
|
||||
}
|
||||
|
@ -1136,7 +1136,7 @@ class OStatus
|
|||
}
|
||||
break;
|
||||
case "related":
|
||||
if ($item["object-type"] != Activity::OBJ_BOOKMARK) {
|
||||
if ($item["object-type"] != Activity\ObjectType::BOOKMARK) {
|
||||
if (!isset($item["parent-uri"])) {
|
||||
$item["parent-uri"] = $attribute['href'];
|
||||
}
|
||||
|
@ -1462,9 +1462,9 @@ class OStatus
|
|||
$author = $doc->createElement("author");
|
||||
XML::addElement($doc, $author, "id", $owner["url"]);
|
||||
if ($owner['account-type'] == User::ACCOUNT_TYPE_COMMUNITY) {
|
||||
XML::addElement($doc, $author, "activity:object-type", Activity::OBJ_GROUP);
|
||||
XML::addElement($doc, $author, "activity:object-type", Activity\ObjectType::GROUP);
|
||||
} else {
|
||||
XML::addElement($doc, $author, "activity:object-type", Activity::OBJ_PERSON);
|
||||
XML::addElement($doc, $author, "activity:object-type", Activity\ObjectType::PERSON);
|
||||
}
|
||||
XML::addElement($doc, $author, "uri", $owner["url"]);
|
||||
XML::addElement($doc, $author, "name", $owner["nick"]);
|
||||
|
@ -1557,11 +1557,11 @@ class OStatus
|
|||
*/
|
||||
private static function constructObjecttype(array $item)
|
||||
{
|
||||
if (!empty($item['object-type']) && in_array($item['object-type'], [Activity::OBJ_NOTE, Activity::OBJ_COMMENT])) {
|
||||
if (!empty($item['object-type']) && in_array($item['object-type'], [Activity\ObjectType::NOTE, Activity\ObjectType::COMMENT])) {
|
||||
return $item['object-type'];
|
||||
}
|
||||
|
||||
return Activity::OBJ_NOTE;
|
||||
return Activity\ObjectType::NOTE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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, ANamespace::OSTATUS . "/unfollow"])) {
|
||||
} elseif (in_array($item["verb"], [Activity::FOLLOW, Activity::O_UNFOLLOW])) {
|
||||
return self::followEntry($doc, $item, $owner, $toplevel);
|
||||
} else {
|
||||
return self::noteEntry($doc, $item, $owner, $toplevel, $feed_mode);
|
||||
|
@ -1791,7 +1791,7 @@ class OStatus
|
|||
private static function addPersonObject(DOMDocument $doc, array $owner, array $contact)
|
||||
{
|
||||
$object = $doc->createElement("activity:object");
|
||||
XML::addElement($doc, $object, "activity:object-type", Activity::OBJ_PERSON);
|
||||
XML::addElement($doc, $object, "activity:object-type", Activity\ObjectType::PERSON);
|
||||
|
||||
if ($contact['network'] == Protocol::PHANTOM) {
|
||||
XML::addElement($doc, $object, "id", $contact['url']);
|
||||
|
@ -1919,7 +1919,7 @@ class OStatus
|
|||
|
||||
$entry = self::entryHeader($doc, $owner, $item, $toplevel);
|
||||
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity::OBJ_NOTE);
|
||||
XML::addElement($doc, $entry, "activity:object-type", Activity\ObjectType::NOTE);
|
||||
|
||||
self::entryContent($doc, $entry, $item, $owner, $title, '', true, $feed_mode);
|
||||
|
||||
|
@ -2112,14 +2112,14 @@ class OStatus
|
|||
XML::addElement($doc, $entry, "link", "",
|
||||
[
|
||||
"rel" => "mentioned",
|
||||
"ostatus:object-type" => Activity::OBJ_GROUP,
|
||||
"ostatus:object-type" => Activity\ObjectType::GROUP,
|
||||
"href" => $mention]
|
||||
);
|
||||
} else {
|
||||
XML::addElement($doc, $entry, "link", "",
|
||||
[
|
||||
"rel" => "mentioned",
|
||||
"ostatus:object-type" => Activity::OBJ_PERSON,
|
||||
"ostatus:object-type" => Activity\ObjectType::PERSON,
|
||||
"href" => $mention]
|
||||
);
|
||||
}
|
||||
|
@ -2232,7 +2232,7 @@ class OStatus
|
|||
|
||||
if ($filter === 'comments') {
|
||||
$condition[0] .= " AND `object-type` = ? ";
|
||||
$condition[] = Activity::OBJ_COMMENT;
|
||||
$condition[] = Activity\ObjectType::COMMENT;
|
||||
}
|
||||
|
||||
if ($owner['account-type'] != User::ACCOUNT_TYPE_COMMUNITY) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue