| @@ -2,8 +2,10 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Inspired by the PHP ActivityPub Library by @Landrok |
| 4 | 4 | * |
| 5 | 5 | * @link https://github.com/landrok/activitypub |
| 6 | + * | |
| 7 | + * @package Activitypub | |
| 6 | 8 | */ |
| 7 | 9 | |
| 8 | 10 | namespace Activitypub\Activity; |
| 9 | 11 | |
| @@ -15,12 +17,72 @@ | ||
| 15 | 17 | * |
| 16 | 18 | * @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types |
| 17 | 19 | */ |
| 18 | 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 | + array( | |
| 27 | + 'schema' => 'http://schema.org#', | |
| 28 | + 'toot' => 'http://joinmastodon.org/ns#', | |
| 29 | + 'lemmy' => 'https://join-lemmy.org/ns#', | |
| 30 | + 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', | |
| 31 | + 'PropertyValue' => 'schema:PropertyValue', | |
| 32 | + 'value' => 'schema:value', | |
| 33 | + 'Hashtag' => 'as:Hashtag', | |
| 34 | + 'featured' => array( | |
| 35 | + '@id' => 'toot:featured', | |
| 36 | + '@type' => '@id', | |
| 37 | + ), | |
| 38 | + 'featuredTags' => array( | |
| 39 | + '@id' => 'toot:featuredTags', | |
| 40 | + '@type' => '@id', | |
| 41 | + ), | |
| 42 | + 'moderators' => array( | |
| 43 | + '@id' => 'lemmy:moderators', | |
| 44 | + '@type' => '@id', | |
| 45 | + ), | |
| 46 | + 'alsoKnownAs' => array( | |
| 47 | + '@id' => 'as:alsoKnownAs', | |
| 48 | + '@type' => '@id', | |
| 49 | + ), | |
| 50 | + 'movedTo' => array( | |
| 51 | + '@id' => 'as:movedTo', | |
| 52 | + '@type' => '@id', | |
| 53 | + ), | |
| 54 | + 'attributionDomains' => array( | |
| 55 | + '@id' => 'toot:attributionDomains', | |
| 56 | + '@type' => '@id', | |
| 57 | + ), | |
| 58 | + 'postingRestrictedToMods' => 'lemmy:postingRestrictedToMods', | |
| 59 | + 'discoverable' => 'toot:discoverable', | |
| 60 | + 'indexable' => 'toot:indexable', | |
| 61 | + ), | |
| 62 | + ); | |
| 63 | + | |
| 19 | 64 | /** |
| 65 | + * The default types for Actors. | |
| 66 | + * | |
| 67 | + * @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types | |
| 68 | + * | |
| 69 | + * @var array | |
| 70 | + */ | |
| 71 | + const TYPES = array( | |
| 72 | + 'Application', | |
| 73 | + 'Group', | |
| 74 | + 'Organization', | |
| 75 | + 'Person', | |
| 76 | + 'Service', | |
| 77 | + ); | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * The type of the object. | |
| 81 | + * | |
| 20 | 82 | * @var string |
| 21 | 83 | */ |
| 22 | - protected $type = 'Person'; | |
| 84 | + protected $type; | |
| 23 | 85 | |
| 24 | 86 | /** |
| 25 | 87 | * A reference to an ActivityStreams OrderedCollection comprised of |
| 26 | 88 | * all the messages received by the actor. |
| @@ -26,10 +88,9 @@ | ||
| 26 | 88 | * all the messages received by the actor. |
| 27 | 89 | * |
| 28 | 90 | * @see https://www.w3.org/TR/activitypub/#inbox |
| 29 | 91 | * |
| 30 | - * @var string | |
| 31 | - * | null | |
| 92 | + * @var string|null | |
| 32 | 93 | */ |
| 33 | 94 | protected $inbox; |
| 34 | 95 | |
| 35 | 96 | /** |
| @@ -37,10 +98,9 @@ | ||
| 37 | 98 | * all the messages produced by the actor. |
| 38 | 99 | * |
| 39 | 100 | * @see https://www.w3.org/TR/activitypub/#outbox |
| 40 | 101 | * |
| 41 | - * @var string | |
| 42 | - * | null | |
| 102 | + * @var string|null | |
| 43 | 103 | */ |
| 44 | 104 | protected $outbox; |
| 45 | 105 | |
| 46 | 106 | /** |
| @@ -132,8 +192,34 @@ | ||
| 132 | 192 | * WordPress does only support 'false' at the moment. |
| 133 | 193 | * |
| 134 | 194 | * @see https://docs.joinmastodon.org/spec/activitypub/#as |
| 135 | 195 | * |
| 196 | + * @context as:manuallyApprovesFollowers | |
| 197 | + * | |
| 136 | 198 | * @var boolean |
| 137 | 199 | */ |
| 138 | 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; | |
| 139 | 225 | } |