PluginProbe
ActivityPub / 7.0.0
ActivityPub v7.0.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
activitypub / includes / activity / class-actor.php

class-actor.php in ActivityPub 7.0.0, at includes/activity/class-actor.php

298 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Inspired by the PHP ActivityPub Library by @Landrok
4 *
5 * @link https://github.com/landrok/activitypub
6 *
7 * @package Activitypub
8 */
9
10 namespace Activitypub\Activity;
11
12 /**
13 * \Activitypub\Activity\Actor is an implementation of
14 * one an Activity Streams Actor.
15 *
16 * Represents an individual actor.
17 *
18 * @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
19 */
20 class Actor extends Base_Object {
21 // Reduced context for actors. TODO: still unused.
22 const JSON_LD_CONTEXT = array(
23 'https://www.w3.org/ns/activitystreams',
24 'https://w3id.org/security/v1',
25 'https://purl.archive.org/socialweb/webfinger',
26 'https://w3id.org/fep/844e',
27 array(
28 'schema' => 'http://schema.org#',
29 'toot' => 'http://joinmastodon.org/ns#',
30 'lemmy' => 'https://join-lemmy.org/ns#',
31 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
32 'PropertyValue' => 'schema:PropertyValue',
33 'value' => 'schema:value',
34 'Hashtag' => 'as:Hashtag',
35 'featured' => array(
36 '@id' => 'toot:featured',
37 '@type' => '@id',
38 ),
39 'featuredTags' => array(
40 '@id' => 'toot:featuredTags',
41 '@type' => '@id',
42 ),
43 'moderators' => array(
44 '@id' => 'lemmy:moderators',
45 '@type' => '@id',
46 ),
47 'alsoKnownAs' => array(
48 '@id' => 'as:alsoKnownAs',
49 '@type' => '@id',
50 ),
51 'movedTo' => array(
52 '@id' => 'as:movedTo',
53 '@type' => '@id',
54 ),
55 'attributionDomains' => array(
56 '@id' => 'toot:attributionDomains',
57 '@type' => '@id',
58 ),
59 'postingRestrictedToMods' => 'lemmy:postingRestrictedToMods',
60 'discoverable' => 'toot:discoverable',
61 'indexable' => 'toot:indexable',
62 ),
63 );
64
65 /**
66 * The default types for Actors.
67 *
68 * @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
69 *
70 * @var array
71 */
72 const TYPES = array(
73 'Application',
74 'Group',
75 'Organization',
76 'Person',
77 'Service',
78 );
79
80 /**
81 * The type of the object.
82 *
83 * @var string
84 */
85 protected $type;
86
87 /**
88 * A reference to an ActivityStreams OrderedCollection comprised of
89 * all the messages received by the actor.
90 *
91 * @see https://www.w3.org/TR/activitypub/#inbox
92 *
93 * @var string|null
94 */
95 protected $inbox;
96
97 /**
98 * A reference to an ActivityStreams OrderedCollection comprised of
99 * all the messages produced by the actor.
100 *
101 * @see https://www.w3.org/TR/activitypub/#outbox
102 *
103 * @var string|null
104 */
105 protected $outbox;
106
107 /**
108 * A link to an ActivityStreams collection of the actors that this
109 * actor is following.
110 *
111 * @see https://www.w3.org/TR/activitypub/#following
112 *
113 * @var string
114 */
115 protected $following;
116
117 /**
118 * A link to an ActivityStreams collection of the actors that
119 * follow this actor.
120 *
121 * @see https://www.w3.org/TR/activitypub/#followers
122 *
123 * @var string
124 */
125 protected $followers;
126
127 /**
128 * A link to an ActivityStreams collection of objects this actor has
129 * liked.
130 *
131 * @see https://www.w3.org/TR/activitypub/#liked
132 *
133 * @var string
134 */
135 protected $liked;
136
137 /**
138 * A list of supplementary Collections which may be of interest.
139 *
140 * @see https://www.w3.org/TR/activitypub/#streams-property
141 *
142 * @var array
143 */
144 protected $streams = array();
145
146 /**
147 * A short username which may be used to refer to the actor, with no
148 * uniqueness guarantees.
149 *
150 * @see https://www.w3.org/TR/activitypub/#preferredUsername
151 *
152 * @var string|null
153 */
154 protected $preferred_username;
155
156 /**
157 * A JSON object which maps additional typically server/domain-wide
158 * endpoints which may be useful either for this actor or someone
159 * referencing this actor. This mapping may be nested inside the
160 * actor document as the value or may be a link to a JSON-LD
161 * document with these properties.
162 *
163 * @see https://www.w3.org/TR/activitypub/#endpoints
164 *
165 * @var string|array|null
166 */
167 protected $endpoints;
168
169 /**
170 * It's not part of the ActivityPub protocol, but it's a quite common
171 * practice to handle an actor public key with a publicKey array:
172 * [
173 * 'id' => 'https://my-example.com/actor#main-key'
174 * 'owner' => 'https://my-example.com/actor',
175 * 'publicKeyPem' => '-----BEGIN PUBLIC KEY-----
176 * [...]
177 * -----END PUBLIC KEY-----'
178 * ]
179 *
180 * @see https://www.w3.org/wiki/SocialCG/ActivityPub/Authentication_Authorization#Signing_requests_using_HTTP_Signatures
181 *
182 * @var string|array|null
183 */
184 protected $public_key;
185
186 /**
187 * It's not part of the ActivityPub protocol, but it's a quite common
188 * practice to lock an account. If enabled, new followers will not be
189 * automatically accepted, but will instead require you to manually
190 * approve them.
191 *
192 * WordPress does only support 'false' at the moment.
193 *
194 * @see https://docs.joinmastodon.org/spec/activitypub/#as
195 *
196 * @context as:manuallyApprovesFollowers
197 *
198 * @var boolean
199 */
200 protected $manually_approves_followers = false;
201
202 /**
203 * Domains allowed to use `fediverse:creator` for this actor in
204 * published articles.
205 *
206 * @see https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/
207 *
208 * @var array
209 */
210 protected $attribution_domains = null;
211
212 /**
213 * The target of the actor.
214 *
215 * @var string|null
216 */
217 protected $moved_to;
218
219 /**
220 * The alsoKnownAs of the actor.
221 *
222 * @var array
223 */
224 protected $also_known_as;
225
226 /**
227 * The Featured-Posts.
228 *
229 * @see https://docs.joinmastodon.org/spec/activitypub/#featured
230 *
231 * @context {
232 * "@id": "http://joinmastodon.org/ns#featured",
233 * "@type": "@id"
234 * }
235 *
236 * @var string
237 */
238 protected $featured;
239
240 /**
241 * Whether the User is discoverable.
242 *
243 * @see https://docs.joinmastodon.org/spec/activitypub/#discoverable
244 *
245 * @context http://joinmastodon.org/ns#discoverable
246 *
247 * @var boolean
248 */
249 protected $discoverable;
250
251 /**
252 * Whether the User is indexable.
253 *
254 * @see https://docs.joinmastodon.org/spec/activitypub/#indexable
255 *
256 * @context http://joinmastodon.org/ns#indexable
257 *
258 * @var boolean
259 */
260 protected $indexable;
261
262 /**
263 * The WebFinger Resource.
264 *
265 * @see https://codeberg.org/fediverse/fep/src/branch/main/fep/2c59/fep-2c59.md
266 *
267 * @var string
268 */
269 protected $webfinger;
270
271 /**
272 * URL to the Moderators endpoint.
273 *
274 * @see https://join-lemmy.org/docs/contributors/05-federation.html
275 *
276 * @var string
277 */
278 protected $moderators;
279
280 /**
281 * Restrict posting to mods.
282 *
283 * @see https://join-lemmy.org/docs/contributors/05-federation.html
284 *
285 * @var boolean
286 */
287 protected $posting_restricted_to_mods;
288
289 /**
290 * Listing Implemented Specifications on the Application Actor
291 *
292 * @see https://codeberg.org/helge/fep/src/commit/e1b2a16707b542ea5ea0cfb390ac1abce89f05bb/fep/aaa3/fep-aaa3.md
293 *
294 * @var array
295 */
296 protected $implemented;
297 }
298