X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FActivity.php;h=c5fca4a5cc63dac44dd80e97dcbd87ff39ea4fc3;hb=5e2b655b43f5a74e249d9c069a44cf50ab5e5162;hp=83e0327525d9cb86e92ed19fa33300ae6dcf3ddd;hpb=3897c74debb303c45c3678d379edea4d3b480fbc;p=friendica.git diff --git a/src/Protocol/Activity.php b/src/Protocol/Activity.php index 83e0327525..c5fca4a5cc 100644 --- a/src/Protocol/Activity.php +++ b/src/Protocol/Activity.php @@ -1,8 +1,27 @@ . + * + */ namespace Friendica\Protocol; -use Friendica\Protocol\Activity\ANamespace; +use Friendica\Protocol\ActivityNamespace; /** * Base class for the Activity Verbs @@ -15,14 +34,14 @@ final class Activity * @see http://activitystrea.ms/head/activity-schema.html#verbs * @var string */ - const LIKE = ANamespace::ACTIVITY_SCHEMA . 'like'; + const LIKE = ActivityNamespace::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 = ActivityNamespace::DFRN . '/dislike'; /** * Attend an event @@ -30,21 +49,21 @@ final class Activity * @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_attend * @var string */ - const ATTEND = ANamespace::ZOT . '/activity/attendyes'; + const ATTEND = ActivityNamespace::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'; + const ATTENDNO = ActivityNamespace::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 ATTENDMAYBE = ActivityNamespace::ZOT . '/activity/attendmaybe'; /** * Indicates the creation of a friendship that is reciprocated by the object. @@ -52,110 +71,122 @@ final class Activity * @see http://activitystrea.ms/head/activity-schema.html#verbs * @var string */ - const FRIEND = ANamespace::ACTIVITY_SCHEMA . 'make-friend'; + const FRIEND = ActivityNamespace::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'; + const REQ_FRIEND = ActivityNamespace::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'; + const UNFRIEND = ActivityNamespace::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'; + const FOLLOW = ActivityNamespace::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'; + const UNFOLLOW = ActivityNamespace::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'; + const JOIN = ActivityNamespace::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'; + const POST = ActivityNamespace::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'; + const UPDATE = ActivityNamespace::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'; + const TAG = ActivityNamespace::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'; + const FAVORITE = ActivityNamespace::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'; + const UNFAVORITE = ActivityNamespace::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'; + const SHARE = ActivityNamespace::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'; + const DELETE = ActivityNamespace::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 ANNOUNCE = ActivityNamespace::ACTIVITY2 . 'Announce'; /** - * Pokes an user. + * Indicates that the actor has read the object. * - * @see https://github.com/friendica/friendica/wiki/ActivityStreams#activity_poke + * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-read * @var string */ - const POKE = ANamespace::ZOT . '/activity/poke'; + const READ = ActivityNamespace::ACTIVITY2 . 'read'; + const O_UNFOLLOW = ActivityNamespace::OSTATUS . '/unfollow'; + const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite'; + + /** + * React to a post via an emoji + * + * @var string + */ + const EMOJIREACT = ActivityNamespace::LITEPUB . '/emojireact'; - const O_UNFOLLOW = ANamespace::OSTATUS . '/unfollow'; - const O_UNFAVOURITE = ANamespace::OSTATUS . '/unfavorite'; + /** + * View notification from Peertube + * + * @var string + */ + const VIEW = ActivityNamespace::PEERTUBE . '/view'; /** * likes (etc.) can apply to other things besides posts. Check if they are post children, @@ -164,10 +195,13 @@ final class Activity * Hidden activities, which doesn't need to be shown */ const HIDDEN_ACTIVITIES = [ - Activity::LIKE, Activity::DISLIKE, - Activity::ATTEND, Activity::ATTENDNO, Activity::ATTENDMAYBE, - Activity::FOLLOW, - Activity::ANNOUNCE, + self::LIKE, self::DISLIKE, + self::ATTEND, self::ATTENDNO, self::ATTENDMAYBE, + self::FOLLOW, + self::ANNOUNCE, + self::EMOJIREACT, + self::VIEW, + self::READ, ]; /** @@ -177,7 +211,7 @@ final class Activity * * @return bool True, if the activity is hidden */ - public function isHidden(string $activity) + public function isHidden(string $activity): bool { foreach (self::HIDDEN_ACTIVITIES as $hiddenActivity) { if ($this->match($activity, $hiddenActivity)) { @@ -196,10 +230,10 @@ final class Activity * * @return boolean */ - public function match(string $haystack, string $needle) + public function match(string $haystack, string $needle): bool { return (($haystack === $needle) || ((basename($needle) === $haystack) && - strstr($needle, ANamespace::ACTIVITY_SCHEMA))); + strstr($needle, ActivityNamespace::ACTIVITY_SCHEMA))); } }