mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Add docs
This commit is contained in:
parent
a83dfc11a0
commit
3897c74deb
21 changed files with 439 additions and 122 deletions
|
@ -27,12 +27,12 @@ use Friendica\Model\Term;
|
|||
use Friendica\Object\Post;
|
||||
use Friendica\Object\Thread;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Util\Crypto;
|
||||
|
||||
function item_extract_images($body) {
|
||||
|
||||
|
@ -163,7 +163,7 @@ function localize_item(&$item)
|
|||
switch ($obj['verb']) {
|
||||
case Activity::POST:
|
||||
switch ($obj['object-type']) {
|
||||
case Activity::OBJ_EVENT:
|
||||
case Activity\ObjectType::EVENT:
|
||||
$post_type = L10n::t('event');
|
||||
break;
|
||||
default:
|
||||
|
@ -201,7 +201,7 @@ function localize_item(&$item)
|
|||
|
||||
if ($activity->match($item['verb'], Activity::FRIEND)) {
|
||||
|
||||
if ($item['object-type']=="" || $item['object-type']!== Activity::OBJ_PERSON) return;
|
||||
if ($item['object-type']=="" || $item['object-type']!== Activity\ObjectType::PERSON) return;
|
||||
|
||||
$Aname = $item['author-name'];
|
||||
$Alink = $item['author-link'];
|
||||
|
@ -236,7 +236,7 @@ function localize_item(&$item)
|
|||
if (!$verb) {
|
||||
return;
|
||||
}
|
||||
if ($item['object-type']=="" || $item['object-type']!== Activity::OBJ_PERSON) {
|
||||
if ($item['object-type']=="" || $item['object-type']!== Activity\ObjectType::PERSON) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ function localize_item(&$item)
|
|||
switch ($obj['verb']) {
|
||||
case Activity::POST:
|
||||
switch ($obj['object-type']) {
|
||||
case Activity::OBJ_EVENT:
|
||||
case Activity\ObjectType::EVENT:
|
||||
$post_type = L10n::t('event');
|
||||
break;
|
||||
default:
|
||||
|
@ -408,7 +408,7 @@ function visible_activity($item) {
|
|||
|
||||
// @TODO below if() block can be rewritten to a single line: $isVisible = allConditionsHere;
|
||||
if ($activity->match($item['verb'], Activity::FOLLOW) &&
|
||||
$item['object-type'] === Activity::OBJ_NOTE &&
|
||||
$item['object-type'] === Activity\ObjectType::NOTE &&
|
||||
empty($item['self']) &&
|
||||
$item['uid'] == local_user()) {
|
||||
return false;
|
||||
|
|
14
mod/item.php
14
mod/item.php
|
@ -134,7 +134,7 @@ function item_post(App $a) {
|
|||
$toplevel_item_id = $toplevel_item['id'];
|
||||
$parent_user = $toplevel_item['uid'];
|
||||
|
||||
$objecttype = Activity::OBJ_COMMENT;
|
||||
$objecttype = Activity\ObjectType::COMMENT;
|
||||
}
|
||||
|
||||
if ($toplevel_item_id) {
|
||||
|
@ -467,7 +467,7 @@ function item_post(App $a) {
|
|||
$match = null;
|
||||
|
||||
if (!$preview && Photo::setPermissionFromBody($body, $profile_uid, $original_contact_id, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny)) {
|
||||
$objecttype = Activity::OBJ_IMAGE;
|
||||
$objecttype = Activity\ObjectType::IMAGE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -503,7 +503,7 @@ function item_post(App $a) {
|
|||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
|
||||
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
||||
$posttype = Item::PT_PAGE;
|
||||
$objecttype = Activity::OBJ_BOOKMARK;
|
||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||
}
|
||||
|
||||
/** @var BBCode\Video $bbCodeVideo */
|
||||
|
@ -517,15 +517,15 @@ function item_post(App $a) {
|
|||
|
||||
// Setting the object type if not defined before
|
||||
if (!$objecttype) {
|
||||
$objecttype = Activity::OBJ_NOTE; // Default value
|
||||
$objecttype = Activity\ObjectType::NOTE; // Default value
|
||||
$objectdata = BBCode::getAttachedData($body);
|
||||
|
||||
if ($objectdata["type"] == "link") {
|
||||
$objecttype = Activity::OBJ_BOOKMARK;
|
||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||
} elseif ($objectdata["type"] == "video") {
|
||||
$objecttype = Activity::OBJ_VIDEO;
|
||||
$objecttype = Activity\ObjectType::VIDEO;
|
||||
} elseif ($objectdata["type"] == "photo") {
|
||||
$objecttype = Activity::OBJ_IMAGE;
|
||||
$objecttype = Activity\ObjectType::IMAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -569,22 +569,22 @@ function photos_post(App $a)
|
|||
$arr['visible'] = 1;
|
||||
$arr['verb'] = Activity::TAG;
|
||||
$arr['gravity'] = GRAVITY_PARENT;
|
||||
$arr['object-type'] = Activity::OBJ_PERSON;
|
||||
$arr['target-type'] = Activity::OBJ_IMAGE;
|
||||
$arr['object-type'] = Activity\ObjectType::PERSON;
|
||||
$arr['target-type'] = Activity\ObjectType::IMAGE;
|
||||
$arr['tag'] = $tagged[4];
|
||||
$arr['inform'] = $tagged[2];
|
||||
$arr['origin'] = 1;
|
||||
$arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
|
||||
$arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
|
||||
|
||||
$arr['object'] = '<object><type>' . Activity::OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
|
||||
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
|
||||
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
|
||||
if ($tagged[3]) {
|
||||
$arr['object'] .= XML::escape('<link rel="photo" type="' . $photo['type'] . '" href="' . $tagged[3]['photo'] . '" />' . "\n");
|
||||
}
|
||||
$arr['object'] .= '</link></object>' . "\n";
|
||||
|
||||
$arr['target'] = '<target><type>' . Activity::OBJ_IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
|
||||
$arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
|
||||
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
|
||||
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
|
||||
|
||||
|
|
|
@ -118,12 +118,12 @@ function poke_init(App $a)
|
|||
$arr['visible'] = 1;
|
||||
$arr['verb'] = $activity;
|
||||
$arr['private'] = $private;
|
||||
$arr['object-type'] = Activity::OBJ_PERSON;
|
||||
$arr['object-type'] = Activity\ObjectType::PERSON;
|
||||
|
||||
$arr['origin'] = 1;
|
||||
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
|
||||
|
||||
$arr['object'] = '<object><type>' . Activity::OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $target['url'] . '</id>';
|
||||
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $target['name'] . '</title><id>' . $target['url'] . '</id>';
|
||||
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
|
||||
|
||||
$arr['object'] .= XML::escape('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/**
|
||||
* @file mod/subthread.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -88,7 +89,7 @@ function subthread_content(App $a) {
|
|||
$uri = Item::newURI($owner_uid);
|
||||
|
||||
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
|
||||
$objtype = (($item['resource-id']) ? Activity::OBJ_IMAGE : Activity::OBJ_NOTE );
|
||||
$objtype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );
|
||||
$link = XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $item['guid'] . '" />' . "\n");
|
||||
$body = $item['body'];
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
/**
|
||||
* @file mod/tagger.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -69,7 +70,7 @@ function tagger_content(App $a) {
|
|||
$uri = Item::newURI($owner_uid);
|
||||
$xterm = XML::escape($term);
|
||||
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
|
||||
$targettype = (($item['resource-id']) ? Activity::OBJ_IMAGE : Activity::OBJ_NOTE );
|
||||
$targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );
|
||||
$href = System::baseUrl() . '/display/' . $item['guid'];
|
||||
|
||||
$link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n");
|
||||
|
@ -88,7 +89,7 @@ function tagger_content(App $a) {
|
|||
EOT;
|
||||
|
||||
$tagid = System::baseUrl() . '/search?tag=' . $xterm;
|
||||
$objtype = Activity::OBJ_TAGTERM;
|
||||
$objtype = Activity\ObjectType::TAGTERM;
|
||||
|
||||
$obj = <<< EOT
|
||||
<object>
|
||||
|
|
|
@ -277,7 +277,7 @@ class BBCode extends BaseObject
|
|||
|
||||
if (preg_match_all("(\[url=(.*?)\]\s*\[img\](.*?)\[\/img\]\s*\[\/url\])ism", $body, $pictures, PREG_SET_ORDER)) {
|
||||
if ((count($pictures) == 1) && !$has_title) {
|
||||
if (!empty($item['object-type']) && ($item['object-type'] == Activity::OBJ_IMAGE)) {
|
||||
if (!empty($item['object-type']) && ($item['object-type'] == Activity\ObjectType::IMAGE)) {
|
||||
// Replace the preview picture with the real picture
|
||||
$url = str_replace('-1.', '-0.', $pictures[0][2]);
|
||||
$data = ['url' => $url, 'type' => 'photo'];
|
||||
|
|
|
@ -828,7 +828,7 @@ class Contact extends BaseObject
|
|||
} elseif (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
|
||||
// create an unfollow slap
|
||||
$item = [];
|
||||
$item['verb'] = Activity\ANamespace::OSTATUS . "/unfollow";
|
||||
$item['verb'] = Activity::O_UNFOLLOW;
|
||||
$item['follow'] = $contact["url"];
|
||||
$item['body'] = '';
|
||||
$item['title'] = '';
|
||||
|
|
|
@ -304,7 +304,7 @@ class Event extends BaseObject
|
|||
|
||||
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
|
||||
if (DBA::isResult($item)) {
|
||||
$object = '<object><type>' . XML::escape(Activity::OBJ_EVENT) . '</type><title></title><id>' . XML::escape($event['uri']) . '</id>';
|
||||
$object = '<object><type>' . XML::escape(Activity\ObjectType::EVENT) . '</type><title></title><id>' . XML::escape($event['uri']) . '</id>';
|
||||
$object .= '<content>' . XML::escape(self::getBBCode($event)) . '</content>';
|
||||
$object .= '</object>' . "\n";
|
||||
|
||||
|
@ -352,12 +352,12 @@ class Event extends BaseObject
|
|||
$item_arr['private'] = $private;
|
||||
$item_arr['visible'] = 1;
|
||||
$item_arr['verb'] = Activity::POST;
|
||||
$item_arr['object-type'] = Activity::OBJ_EVENT;
|
||||
$item_arr['object-type'] = Activity\ObjectType::EVENT;
|
||||
$item_arr['origin'] = $event['cid'] === 0 ? 1 : 0;
|
||||
$item_arr['body'] = self::getBBCode($event);
|
||||
$item_arr['event-id'] = $event['id'];
|
||||
|
||||
$item_arr['object'] = '<object><type>' . XML::escape(Activity::OBJ_EVENT) . '</type><title></title><id>' . XML::escape($event['uri']) . '</id>';
|
||||
$item_arr['object'] = '<object><type>' . XML::escape(Activity\ObjectType::EVENT) . '</type><title></title><id>' . XML::escape($event['uri']) . '</id>';
|
||||
$item_arr['object'] .= '<content>' . XML::escape(self::getBBCode($event)) . '</content>';
|
||||
$item_arr['object'] .= '</object>' . "\n";
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ class Item extends BaseObject
|
|||
$row['object'] = '';
|
||||
}
|
||||
if (array_key_exists('object-type', $row)) {
|
||||
$row['object-type'] = Activity::OBJ_NOTE;
|
||||
$row['object-type'] = Activity\ObjectType::NOTE;
|
||||
}
|
||||
} elseif (array_key_exists('verb', $row) && in_array($row['verb'], ['', Activity::POST, Activity::SHARE])) {
|
||||
// Posts don't have an object or target - but having tags or files.
|
||||
|
@ -1157,14 +1157,14 @@ class Item extends BaseObject
|
|||
|
||||
private static function deleteTagsFromItem($item)
|
||||
{
|
||||
if (($item["verb"] != Activity::TAG) || ($item["object-type"] != Activity::OBJ_TAGTERM)) {
|
||||
if (($item["verb"] != Activity::TAG) || ($item["object-type"] != Activity\ObjectType::TAGTERM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$xo = XML::parseString($item["object"], false);
|
||||
$xt = XML::parseString($item["target"], false);
|
||||
|
||||
if ($xt->type != Activity::OBJ_NOTE) {
|
||||
if ($xt->type != Activity\ObjectType::NOTE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3156,7 +3156,7 @@ class Item extends BaseObject
|
|||
return true;
|
||||
}
|
||||
|
||||
$objtype = $item['resource-id'] ? Activity::OBJ_IMAGE : Activity::OBJ_NOTE;
|
||||
$objtype = $item['resource-id'] ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE;
|
||||
|
||||
$new_item = [
|
||||
'guid' => System::createUUID(),
|
||||
|
@ -3436,7 +3436,7 @@ class Item extends BaseObject
|
|||
|
||||
// In order to provide theme developers more possibilities, event items
|
||||
// are treated differently.
|
||||
if ($item['object-type'] === Activity::OBJ_EVENT && isset($item['event-id'])) {
|
||||
if ($item['object-type'] === Activity\ObjectType::EVENT && isset($item['event-id'])) {
|
||||
$ev = Event::getItemHTML($item);
|
||||
return $ev;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -240,7 +240,7 @@ class Post extends BaseObject
|
|||
|
||||
$isevent = false;
|
||||
$attend = [];
|
||||
if ($item['object-type'] === Activity::OBJ_EVENT) {
|
||||
if ($item['object-type'] === Activity\ObjectType::EVENT) {
|
||||
$response_verbs[] = 'attendyes';
|
||||
$response_verbs[] = 'attendno';
|
||||
$response_verbs[] = 'attendmaybe';
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -495,7 +495,7 @@ class OnePoll
|
|||
|
||||
$datarray = [];
|
||||
$datarray['verb'] = Activity::POST;
|
||||
$datarray['object-type'] = Activity::OBJ_NOTE;
|
||||
$datarray['object-type'] = Activity\ObjectType::NOTE;
|
||||
$datarray['network'] = Protocol::MAIL;
|
||||
// $meta = Email::messageMeta($mbox, $msg_uid);
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ class ActivityTest extends MockedTest
|
|||
'assert' => true,
|
||||
],
|
||||
'simple' => [
|
||||
'haystack' => Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity::OBJ_TAGTERM,
|
||||
'haystack' => Activity\ObjectType::TAGTERM,
|
||||
'needle' => Activity\ObjectType::TAGTERM,
|
||||
'assert' => true,
|
||||
],
|
||||
'withNamespace' => [
|
||||
'haystack' => 'tagterm',
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . Activity\ObjectType::TAGTERM,
|
||||
'assert' => true,
|
||||
],
|
||||
'invalidSimple' => [
|
||||
|
@ -32,12 +32,12 @@ class ActivityTest extends MockedTest
|
|||
],
|
||||
'invalidWithOutNamespace' => [
|
||||
'haystack' => 'tagterm',
|
||||
'needle' => Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity\ObjectType::TAGTERM,
|
||||
'assert' => false,
|
||||
],
|
||||
'withSubPath' => [
|
||||
'haystack' => 'tagterm',
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . '/bla/' . Activity::OBJ_TAGTERM,
|
||||
'needle' => Activity\ANamespace::ACTIVITY_SCHEMA . '/bla/' . Activity\ObjectType::TAGTERM,
|
||||
'assert' => true,
|
||||
],
|
||||
];
|
||||
|
@ -60,6 +60,6 @@ class ActivityTest extends MockedTest
|
|||
$activity = new Activity();
|
||||
|
||||
$this->assertTrue($activity->isHidden(Activity::LIKE));
|
||||
$this->assertFalse($activity->isHidden(Activity::OBJ_BOOKMARK));
|
||||
$this->assertFalse($activity->isHidden(Activity\ObjectType::BOOKMARK));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue