Browse Source

[FreeNetwork] First step towards de-duplication mechanism for federation

Refactored AS2 inside AP; [ENTITY][Activity] went from core to AP
Webfinger plugin will be part of FreeNetwork component
v3
parent
commit
517ed953f2
Signed by: diogo <mail@diogo.site> GPG Key ID: 18D2D35001FBFAB0
100 changed files with 989 additions and 336 deletions
  1. +214
    -0
      components/FreeNetwork/Entity/FreenetworkActor.php
  2. +26
    -0
      components/FreeNetwork/FreeNetwork.php
  3. +73
    -8
      plugins/ActivityPub/ActivityPub.php
  4. +10
    -10
      plugins/ActivityPub/Controller/Inbox.php
  5. +55
    -11
      plugins/ActivityPub/Entity/ActivitypubActivity.php
  6. +170
    -0
      plugins/ActivityPub/Entity/ActivitypubActor.php
  7. +77
    -0
      plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToEntity.php
  8. +2
    -2
      plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToGSActor.php
  9. +52
    -0
      plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToNote.php
  10. +2
    -2
      plugins/ActivityPub/Util/Model/EntityToType/EntityToType.php
  11. +5
    -3
      plugins/ActivityPub/Util/Model/EntityToType/GSActorToType.php
  12. +6
    -3
      plugins/ActivityPub/Util/Model/EntityToType/NoteToType.php
  13. +2
    -2
      plugins/ActivityPub/Util/Response/AbstractResponse.php
  14. +2
    -2
      plugins/ActivityPub/Util/Response/ActorResponse.php
  15. +2
    -2
      plugins/ActivityPub/Util/Response/NoteResponse.php
  16. +1
    -1
      plugins/ActivityPub/Util/Response/TypeResponse.php
  17. +4
    -4
      plugins/ActivityPub/Util/Type.php
  18. +2
    -2
      plugins/ActivityPub/Util/Type/AbstractObject.php
  19. +3
    -3
      plugins/ActivityPub/Util/Type/Core/AbstractActivity.php
  20. +2
    -2
      plugins/ActivityPub/Util/Type/Core/Activity.php
  21. +2
    -2
      plugins/ActivityPub/Util/Type/Core/Collection.php
  22. +1
    -1
      plugins/ActivityPub/Util/Type/Core/CollectionPage.php
  23. +2
    -2
      plugins/ActivityPub/Util/Type/Core/IntransitiveActivity.php
  24. +3
    -3
      plugins/ActivityPub/Util/Type/Core/Link.php
  25. +2
    -2
      plugins/ActivityPub/Util/Type/Core/ObjectType.php
  26. +2
    -2
      plugins/ActivityPub/Util/Type/Core/OrderedCollection.php
  27. +2
    -2
      plugins/ActivityPub/Util/Type/Core/OrderedCollectionPage.php
  28. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/AbstractActor.php
  29. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Accept.php
  30. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Announce.php
  31. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Activity/Block.php
  32. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Create.php
  33. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Delete.php
  34. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Follow.php
  35. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Activity/Ignore.php
  36. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Join.php
  37. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Leave.php
  38. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Like.php
  39. +7
    -7
      plugins/ActivityPub/Util/Type/Extended/Activity/Question.php
  40. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Reject.php
  41. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Remove.php
  42. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Undo.php
  43. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Activity/Update.php
  44. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Actor/Application.php
  45. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Actor/Group.php
  46. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Actor/Organization.php
  47. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Actor/Person.php
  48. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Actor/Service.php
  49. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Article.php
  50. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Object/Audio.php
  51. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Document.php
  52. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Event.php
  53. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Object/Image.php
  54. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Mention.php
  55. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Note.php
  56. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Object/Page.php
  57. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Place.php
  58. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Profile.php
  59. +3
    -3
      plugins/ActivityPub/Util/Type/Extended/Object/Tombstone.php
  60. +2
    -2
      plugins/ActivityPub/Util/Type/Extended/Object/Video.php
  61. +2
    -2
      plugins/ActivityPub/Util/Type/TypeResolver.php
  62. +4
    -4
      plugins/ActivityPub/Util/Type/Util.php
  63. +4
    -4
      plugins/ActivityPub/Util/Type/Validator.php
  64. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/AccuracyValidator.php
  65. +7
    -7
      plugins/ActivityPub/Util/Type/Validator/ActorValidator.php
  66. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/AltitudeValidator.php
  67. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/AnyOfValidator.php
  68. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/AttachmentValidator.php
  69. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/AttributedToValidator.php
  70. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/AudienceValidator.php
  71. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/BccValidator.php
  72. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/BtoValidator.php
  73. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/CcValidator.php
  74. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/ClosedValidator.php
  75. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/ContentMapValidator.php
  76. +3
    -3
      plugins/ActivityPub/Util/Type/Validator/ContentValidator.php
  77. +4
    -4
      plugins/ActivityPub/Util/Type/Validator/ContextValidator.php
  78. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/CurrentValidator.php
  79. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/DeletedValidator.php
  80. +6
    -6
      plugins/ActivityPub/Util/Type/Validator/DescribesValidator.php
  81. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/DurationValidator.php
  82. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/EndTimeValidator.php
  83. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/EndpointsValidator.php
  84. +2
    -2
      plugins/ActivityPub/Util/Type/Validator/FirstValidator.php
  85. +7
    -7
      plugins/ActivityPub/Util/Type/Validator/FollowersValidator.php
  86. +2
    -2
      plugins/ActivityPub/Util/Type/Validator/FollowingValidator.php
  87. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/FormerTypeValidator.php
  88. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/GeneratorValidator.php
  89. +6
    -6
      plugins/ActivityPub/Util/Type/Validator/HeightValidator.php
  90. +6
    -6
      plugins/ActivityPub/Util/Type/Validator/HrefValidator.php
  91. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/HreflangValidator.php
  92. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/IconValidator.php
  93. +4
    -4
      plugins/ActivityPub/Util/Type/Validator/IdValidator.php
  94. +2
    -2
      plugins/ActivityPub/Util/Type/Validator/ImageValidator.php
  95. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/InReplyToValidator.php
  96. +7
    -7
      plugins/ActivityPub/Util/Type/Validator/InboxValidator.php
  97. +2
    -2
      plugins/ActivityPub/Util/Type/Validator/InstrumentValidator.php
  98. +6
    -6
      plugins/ActivityPub/Util/Type/Validator/ItemsValidator.php
  99. +2
    -2
      plugins/ActivityPub/Util/Type/Validator/LastValidator.php
  100. +5
    -5
      plugins/ActivityPub/Util/Type/Validator/LatitudeValidator.php

+ 214
- 0
components/FreeNetwork/Entity/FreenetworkActor.php View File

@@ -0,0 +1,214 @@
<?php
// {{{ License

// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.

// }}}

/**
* WebFinger implementation for GNU social
*
* @package GNUsocial
*
* @author Diogo Peralta Cordeiro <mail@diogo.site
* @copyright 2021 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace Component\FreeNetwork\Entity;

use App\Core\DB\DB;
use App\Core\Entity;
use App\Core\Event;
use DateTimeInterface;

/**
* Table Definition for freenetwork_actor
*
* @author Diogo Peralta Cordeiro <mail@diogo.site
* @copyright 2021 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class FreenetworkActor extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart
private string $actor_uri;
private string $source;
private int $actor_id;
private bool $is_local;
private \DateTimeInterface $created;
private \DateTimeInterface $modified;

/**
* @return string
*/
public function getActorUri(): string
{
return $this->actor_uri;
}

/**
* @param string $actor_uri
*/
public function setActorUri(string $actor_uri): void
{
$this->actor_uri = $actor_uri;
}

/**
* @return string
*/
public function getSource(): string
{
return $this->source;
}

/**
* @param string $source
*/
public function setSource(string $source): void
{
$this->source = $source;
}

/**
* @return int
*/
public function getActorId(): int
{
return $this->actor_id;
}

/**
* @param int $actor_id
*/
public function setActorId(int $actor_id): void
{
$this->actor_id = $actor_id;
}

/**
* @return bool
*/
public function isIsLocal(): bool
{
return $this->is_local;
}

/**
* @param bool $is_local
*/
public function setIsLocal(bool $is_local): void
{
$this->is_local = $is_local;
}

/**
* @return DateTimeInterface
*/
public function getCreated(): DateTimeInterface
{
return $this->created;
}

/**
* @param DateTimeInterface $created
*/
public function setCreated(DateTimeInterface $created): void
{
$this->created = $created;
}

/**
* @return DateTimeInterface
*/
public function getModified(): DateTimeInterface
{
return $this->modified;
}

/**
* @param DateTimeInterface $modified
*/
public function setModified(DateTimeInterface $modified): void
{
$this->modified = $modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

public static function getOrCreateById($actor_id, $source): self
{
$fnactor = self::getWithPK(['actor_id' => $actor_id, 'source' => $source]);
if ($fnactor === null) {
$actor_uri = null;
Event::handle('FreeNetworkGenerateLocalActorUri', [$source, $actor_id, &$actor_uri]);
$fnactor = self::create([
'actor_uri' => $actor_uri,
'source' => $source,
'actor_id' => $actor_id,
'is_local' => true,
]);
DB::persist($fnactor);
return $fnactor;
} else {
return $fnactor;
}
}

public static function getOrCreateByUri($actor_uri, $source): self
{
$fnactor = DB::findBy('freenetwork_actor', ['actor_uri' => $actor_uri, 'source' => $source]);
if ($fnactor === []) {
// TODO grab with webfinger
// If already has for a different protocol and isn't local, update
// else create actor and then fnactor
$fnactor = self::create([
'actor_uri' => $actor_uri,
'source' => $source,
'actor_id' => 1,
'is_local' => false,
]);
DB::persist($fnactor);
return $fnactor;
} else {
return $fnactor[0];
}
}

public static function schemaDef()
{
return [
'name' => 'freenetwork_actor',
'fields' => [
'actor_uri' => ['type' => 'text', 'not null' => true],
'source' => ['type' => 'varchar', 'not null' => true, 'foreign key' => true, 'length' => 32, 'target' => 'NoteSource.code', 'multiplicity' => 'many to one', 'description' => 'fkey to source of note, like "web", "im", or "clientname"'],
'actor_id' => ['type' => 'int', 'not null' => true],
'is_local' => ['type' => 'bool', 'not null' => true, 'description' => 'whether this was a locally generated or an imported actor'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['actor_id', 'source'],
'indexes' => [
'freenetwork_actor_uri_idx' => ['actor_uri', 'source'],
],
'foreign keys' => [
'freenetwork_actor_actor_id_fkey' => ['actor', ['actor_id' => 'id']],
],
];
}
}

+ 26
- 0
components/FreeNetwork/FreeNetwork.php View File

@@ -0,0 +1,26 @@
<?php

// {{{ License
// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
// }}}

namespace Component\FreeNetwork;

use App\Core\Modules\Component;

class FreeNetwork extends Component
{
}

+ 73
- 8
plugins/ActivityPub/ActivityPub.php View File

@@ -5,9 +5,12 @@ namespace Plugin\ActivityPub;
use App\Core\Event;
use App\Core\Modules\Plugin;
use App\Core\Router\RouteLoader;
use App\Core\Router\Router;
use Exception;
use Plugin\ActivityPub\Controller\Inbox;
use Plugin\ActivityStreamsTwo\ActivityStreamsTwo;
use Plugin\ActivityPub\Util\Response\ActorResponse;
use Plugin\ActivityPub\Util\Response\NoteResponse;
use Plugin\ActivityPub\Util\Response\TypeResponse;

class ActivityPub extends Plugin
{
@@ -18,7 +21,7 @@ class ActivityPub extends Plugin

/**
* This code executes when GNU social creates the page routing, and we hook
* on this event to add our action handler for Embed.
* on this event to add our Inbox and Outbox handler for ActivityPub.
*
* @param RouteLoader $r the router that was initialized.
*
@@ -30,19 +33,19 @@ class ActivityPub extends Plugin
'activitypub_actor_inbox',
'/actor/{gsactor_id<\d+>}/inbox.json',
[Inbox::class, 'handle'],
options: ['accept' => ActivityStreamsTwo::$accept_headers]
options: ['accept' => self::$accept_headers]
);
$r->connect(
'activitypub_actor_outbox',
'/actor/{gsactor_id<\d+>}/outbox.json',
[Inbox::class, 'handle'],
options: ['accept' => ActivityStreamsTwo::$accept_headers]
options: ['accept' => self::$accept_headers]
);
$r->connect(
'activitypub_inbox',
'/inbox.json',
[Inbox::class, 'handle'],
options: ['accept' => ActivityStreamsTwo::$accept_headers]
options: ['accept' => self::$accept_headers]
);
return Event::next;
}
@@ -53,19 +56,20 @@ class ActivityPub extends Plugin
* @param null|array|string $accept
* @param bool $strict Strict mode
*
* @throws \Exception when strict mode enabled
* @throws Exception when strict mode enabled
*
* @return bool
*
*/
public static function validateAcceptHeader(array|string|null $accept, bool $strict): bool
{
if (is_string($accept)
&& in_array($accept, ActivityStreamsTwo::$accept_headers)
&& in_array($accept, self::$accept_headers)
) {
return true;
} elseif (is_array($accept)
&& count(
array_intersect($accept, ActivityStreamsTwo::$accept_headers)
array_intersect($accept, self::$accept_headers)
) > 0
) {
return true;
@@ -82,4 +86,65 @@ class ActivityPub extends Plugin
)
);
}

public static array $accept_headers = [
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
'application/activity+json',
'application/json',
'application/ld+json',
];

/**
* @param string $route
* @param array $accept_header
* @param array $vars
* @param null|TypeResponse $response
*
* @throws Exception
*
* @return bool
*
*
*/
public function onControllerResponseInFormat(string $route, array $accept_header, array $vars, ?TypeResponse &$response = null): bool
{
if (count(array_intersect(self::$accept_headers, $accept_header)) === 0) {
return Event::next;
}
switch ($route) {
case 'actor_view_id':
case 'actor_view_nickname':
$response = ActorResponse::handle($vars['actor']);
return Event::stop;
case 'note_view':
$response = NoteResponse::handle($vars['note']);
return Event::stop;
/*case 'actor_favourites_id':
case 'actor_favourites_nickname':
$response = LikeResponse::handle($vars['actor']);
return Event::stop;
case 'actor_subscriptions_id':
case 'actor_subscriptions_nickname':
$response = FollowingResponse::handle($vars['actor']);
return Event::stop;
case 'actor_subscribers_id':
case 'actor_subscribers_nickname':
$response = FollowersResponse::handle($vars['actor']);
return Event::stop;*/
default:
if (Event::handle('ActivityStreamsTwoResponse', [$route, &$response])) {
return Event::stop;
}
return Event::next;
}
}

public function onFreeNetworkGenerateLocalActorUri(string $source, int $actor_id, ?string &$actor_uri): bool
{
if ($source !== 'ActivityPub') {
return Event::next;
}
$actor_uri = Router::url('actor_view_id', ['id' => $actor_id], Router::ABSOLUTE_URL);
return Event::stop;
}
}

+ 10
- 10
plugins/ActivityPub/Controller/Inbox.php View File

@@ -26,10 +26,10 @@ use App\Core\DB\DB;
use function App\Core\I18n\_m;
use App\Util\Exception\ClientException;
use Plugin\ActivityPub\ActivityPub;
use Plugin\ActivityStreamsTwo\Util\Model\AS2ToEntity\AS2ToEntity;
use Plugin\ActivityStreamsTwo\Util\Response\TypeResponse;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityStreamsTwo\Util\Type\Util;
use Plugin\ActivityPub\Util\Model\AS2ToEntity\AS2ToEntity;
use Plugin\ActivityPub\Util\Response\TypeResponse;
use Plugin\ActivityPub\Util\Type;
use Plugin\ActivityPub\Util\Type\Util;

class Inbox extends Controller
{
@@ -51,7 +51,7 @@ class Inbox extends Controller
true
);

// Check current actor can post
// TODO: Check if Actor can post

// Get content
$payload = Util::decodeJson(
@@ -60,12 +60,12 @@ class Inbox extends Controller

// Cast as an ActivityStreams type
$type = Type::create($payload);
dd(AS2ToEntity::translate(activity: $type->toArray()['object'], source: 'ActivityPub'));

// $http_signature = new HttpSignature($this->server);
// if ($http_signature->verify($request)) {
// return new Response('', 201);
// }
// TODO: Check if Actor has authority over payload

// Store Activity
dd(AS2ToEntity::store(activity: $type->toArray(), source: 'ActivityPub'));
DB::flush();

return new TypeResponse($type, status: 202);
}


src/Entity/Activity.php → plugins/ActivityPub/Entity/ActivitypubActivity.php View File

@@ -19,7 +19,7 @@

// }}}

namespace App\Entity;
namespace Plugin\ActivityPub\Entity;

use App\Core\DB\DB;
use App\Core\Entity;
@@ -32,21 +32,25 @@ use DateTimeInterface;
* @package GNUsocial
*
* @author Hugo Sales <hugo@hsal.es>
* @author Diogo Peralta Cordeiro <mail@diogo.site>
* @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class Activity extends Entity
class ActivitypubActivity extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private string $activity_uri;
private int $actor_id;
private string $verb;
private string $object_type;
private int $object_id;
private string $object_uri;
private bool $is_local;
private ?string $source;
private \DateTimeInterface $created;
private \DateTimeInterface $modified;

public function setId(int $id): self
{
@@ -59,6 +63,17 @@ class Activity extends Entity
return $this->id;
}

public function getActivityUri(): string
{
return $this->activity_uri;
}

public function setActivityUri(string $activity_uri): self
{
$this->activity_uri = $activity_uri;
return $this;
}

public function setActorId(int $actor_id): self
{
$this->actor_id = $actor_id;
@@ -103,6 +118,17 @@ class Activity extends Entity
return $this->object_id;
}

public function getObjectUri(): string
{
return $this->object_uri;
}

public function setObjectUri(string $object_uri): self
{
$this->object_uri = $object_uri;
return $this;
}

public function setIsLocal(bool $is_local): self
{
$this->is_local = $is_local;
@@ -136,24 +162,42 @@ class Activity extends Entity
return $this->created;
}

public function setModified(DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}

public function getModified(): DateTimeInterface
{
return $this->modified;
}

// @codeCoverageIgnoreEnd
// }}} Autocode

public static function schemaDef(): array
{
return [
'name' => 'activity',
'name' => 'activitypub_activity',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true],
'actor_id' => ['type' => 'int', 'not null' => true, 'description' => 'foreign key to actor table'],
'verb' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'internal activity verb, influenced by activity pub verbs'],
'object_type' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'the name of the table this object refers to'],
'object_id' => ['type' => 'int', 'not null' => true, 'description' => 'id in the referenced table'],
'is_local' => ['type' => 'bool', 'not null' => true, 'description' => 'whether this was a locally generated or an imported activity'],
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'the source of this activity'],
'created' => ['type' => 'datetime', 'not null' => true, 'description' => 'date this record was created', 'default' => 'CURRENT_TIMESTAMP'],
'id' => ['type' => 'serial', 'not null' => true],
'activity_uri' => ['type' => 'text', 'not null' => true, 'description' => 'Activity\'s URI'],
'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'who made the note'],
'verb' => ['type' => 'varchar', 'length' => 32, 'not null' => true, 'description' => 'internal activity verb, influenced by activity pub verbs'],
'object_type' => ['type' => 'varchar', 'length' => 32, 'description' => 'the name of the table this object refers to'],
'object_id' => ['type' => 'int', 'description' => 'id in the referenced table'],
'object_uri' => ['type' => 'text', 'not null' => true, 'description' => 'Object\'s URI'],
'is_local' => ['type' => 'bool', 'not null' => true, 'description' => 'whether this was a locally generated or an imported activity'],
'source' => ['type' => 'varchar', 'length' => 32, 'description' => 'the source of this activity'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['id'],
'indexes' => [
'activity_activity_uri_idx' => ['activity_uri'],
'activity_object_uri_idx' => ['object_uri'],
],
];
}
}

+ 170
- 0
plugins/ActivityPub/Entity/ActivitypubActor.php View File

@@ -0,0 +1,170 @@
<?php
// {{{ License

// This file is part of GNU social - https://www.gnu.org/software/social
//
// GNU social is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU social is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.

// }}}

/**
* ActivityPub implementation for GNU social
*
* @package GNUsocial
*
* @author Diogo Peralta Cordeiro <mail@diogo.site
* @copyright 2021 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/

namespace Plugin\ActivityPub\Entity;

use App\Core\Entity;
use DateTimeInterface;

/**
* Table Definition for activitypub_actor
*
* @author Diogo Peralta Cordeiro <mail@diogo.site
* @copyright 2021 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
class ActivitypubActor extends Entity
{
// {{{ Autocode
// @codeCoverageIgnoreStart
private string $uri;
private int $actor_id;
private string $inbox_uri;
private ?string $inbox_shared_uri = null;
private \DateTimeInterface $created;
private \DateTimeInterface $modified;

/**
* @return string
*/
public function getUri(): string
{
return $this->uri;
}

/**
* @param string $uri
*/
public function setUri(string $uri): void
{
$this->uri = $uri;
}

/**
* @return int
*/
public function getActorId(): int
{
return $this->actor_id;
}

/**
* @param int $actor_id
*/
public function setActorId(int $actor_id): void
{
$this->actor_id = $actor_id;
}

/**
* @return string
*/
public function getInboxUri(): string
{
return $this->inbox_uri;
}

/**
* @param string $inbox_uri
*/
public function setInboxUri(string $inbox_uri): void
{
$this->inbox_uri = $inbox_uri;
}

/**
* @return string
*/
public function getInboxSharedUri(): string
{
return $this->inbox_shared_uri;
}

/**
* @param string $inbox_shared_uri
*/
public function setInboxSharedUri(string $inbox_shared_uri): void
{
$this->inbox_shared_uri = $inbox_shared_uri;
}

/**
* @return DateTimeInterface
*/
public function getCreated(): DateTimeInterface
{
return $this->created;
}

/**
* @param DateTimeInterface $created
*/
public function setCreated(DateTimeInterface $created): void
{
$this->created = $created;
}

/**
* @return DateTimeInterface
*/
public function getModified(): DateTimeInterface
{
return $this->modified;
}

/**
* @param DateTimeInterface $modified
*/
public function setModified(DateTimeInterface $modified): void
{
$this->modified = $modified;
}
// @codeCoverageIgnoreEnd
// }}} Autocode

public static function schemaDef()
{
return [
'name' => 'activitypub_actor',
'fields' => [
'uri' => ['type' => 'text', 'not null' => true],
'actor_id' => ['type' => 'int', 'not null' => true],
'inbox_uri' => ['type' => 'text', 'not null' => true],
'inbox_shared_uri' => ['type' => 'text'],
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
],
'primary key' => ['actor_id'],
'foreign keys' => [
'activitypub_actor_actor_id_fkey' => ['actor', ['actor_id' => 'id']],
],
];
}
}

+ 77
- 0
plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToEntity.php View File

@@ -0,0 +1,77 @@
<?php

namespace Plugin\ActivityPub\Util\Model\AS2ToEntity;

use App\Core\DB\DB;
use App\Core\Event;
use App\Util\Exception\ClientException;
use App\Util\Formatting;
use Component\FreeNetwork\Entity\FreenetworkActor;
use DateTime;
use Plugin\ActivityPub\Entity\ActivitypubActivity;

abstract class AS2ToEntity
{
public static function activity_stream_two_verb_to_gs_verb($verb)
{
return match ($verb) {
'Create' => 'create',
default => throw new ClientException('Invalid verb'),
};
}

public static function activity_stream_two_object_type_to_gs_table($verb)
{
return match ($verb) {
'Note' => 'note',
default => throw new ClientException('Invalid verb'),
};
}

/**
* @param array $activity
* @param null|string $source
*
* @throws ClientException
*
* @return array
*/
public static function store(array $activity, ?string $source = null): array
{
$map = [
'activity_uri' => $activity['id'],
'actor_id' => FreenetworkActor::getOrCreateByUri(actor_uri: $activity['actor'], source: 'ActivityPub')->getActorId(),
'verb' => self::activity_stream_two_verb_to_gs_verb($activity['type']),
'object_type' => self::activity_stream_two_object_type_to_gs_table($activity['object']['type']),
'object_uri' => $activity['object']['id'],
'is_local' => false,
'created' => new DateTime($activity['published'] ?? 'now'),
'modified' => new DateTime(),
'source' => $source,
];

$act = new ActivitypubActivity();
foreach ($map as $prop => $val) {
$set = Formatting::snakeCaseToCamelCase("set_{$prop}");
$act->{$set}($val);
}

$obj = null;
switch ($activity['object']['type']) {
case'Note':
$obj = AS2ToNote::translate($activity['object'], $source);
break;
default:
if (!Event::handle('ActivityPubObject', [$activity['object']['type'], $activity['object'], &$obj])) {
throw new ClientException('Unsupported Object type.');
}
break;
}

DB::persist($obj);
$act->setObjectId($obj->getId());
DB::persist($act);

return [$act, $obj];
}
}

plugins/ActivityStreamsTwo/Util/Model/AS2ToEntity/AS2ToGSActor.php → plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToGSActor.php View File

@@ -1,6 +1,6 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Model\AS2ToEntity;
namespace Plugin\ActivityPub\Util\Model\AS2ToEntity;

use App\Core\Event;
use App\Entity\Actor;
@@ -33,7 +33,7 @@ abstract class AS2ToGSActor
$map['content'],
$map['content_type'],
&$map['rendered'],
Actor::getFromId(1), // just for testing
Actor::getById(1), // just for testing
null, // reply to
]);
}

+ 52
- 0
plugins/ActivityPub/Util/Model/AS2ToEntity/AS2ToNote.php View File

@@ -0,0 +1,52 @@
<?php

namespace Plugin\ActivityPub\Util\Model\AS2ToEntity;

use App\Core\Event;
use App\Entity\Actor;
use App\Entity\Note;
use App\Util\Formatting;
use Component\FreeNetwork\Entity\FreenetworkActor;
use DateTime;

abstract class AS2ToNote
{
/**
* @param array $object
*
*@throws \Exception
*
* @return Note
*
*/
public static function translate(array $object, ?string $source = null): Note
{
$actor_id = FreenetworkActor::getOrCreateByUri(actor_uri: $object['attributedTo'], source: 'ActivityPub')->getActorId();
$map = [
'is_local' => false,
'created' => new DateTime($object['published'] ?? 'now'),
'content' => $object['content'] ?? null,
'content_type' => 'text/html',
'url' => array_key_exists('url', $object) ? $object['url'] : $object['id'],
'actor_id' => $actor_id,
'modified' => new DateTime(),
'source' => $source,
];
if ($map['content'] !== null) {
Event::handle('RenderNoteContent', [
$map['content'],
$map['content_type'],
&$map['rendered'],
Actor::getById($actor_id),
null, // TODO reply to
]);
}

$obj = new Note();
foreach ($map as $prop => $val) {
$set = Formatting::snakeCaseToCamelCase("set_{$prop}");
$obj->{$set}($val);
}
return $obj;
}
}

plugins/ActivityStreamsTwo/Util/Model/EntityToType/EntityToType.php → plugins/ActivityPub/Util/Model/EntityToType/EntityToType.php View File

@@ -1,9 +1,9 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Model\EntityToType;
namespace Plugin\ActivityPub\Util\Model\EntityToType;

use App\Core\Entity;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityPub\Util\Type;

abstract class EntityToType
{

plugins/ActivityStreamsTwo/Util/Model/EntityToType/GSActorToType.php → plugins/ActivityPub/Util/Model/EntityToType/GSActorToType.php View File

@@ -1,14 +1,15 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Model\EntityToType;
namespace Plugin\ActivityPub\Util\Model\EntityToType;

use App\Core\Event;
use App\Core\Router\Router;
use App\Entity\Actor;
use Component\Avatar\Avatar;
use Component\Avatar\Exception\NoAvatarException;
use DateTimeInterface;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityPub\Util\Type;

class GSActorToType
{
@@ -22,7 +23,8 @@ class GSActorToType
*/
public static function translate(Actor $gsactor)
{
$uri = Router::url('actor_view_id', ['id' => $gsactor->getId()], Router::ABSOLUTE_URL);
$uri = null;
Event::handle('FreeNetworkGenerateLocalActorUri', ['source' => 'ActivityPub', 'actor_id' => $gsactor->getId(), 'actor_uri' => &$attributedTo]);
$attr = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $uri,

plugins/ActivityStreamsTwo/Util/Model/EntityToType/NoteToType.php → plugins/ActivityPub/Util/Model/EntityToType/NoteToType.php View File

@@ -1,11 +1,12 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Model\EntityToType;
namespace Plugin\ActivityPub\Util\Model\EntityToType;

use App\Core\Event;
use App\Core\Router\Router;
use App\Entity\Note;
use DateTimeInterface;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityPub\Util\Type;

class NoteToType
{
@@ -18,11 +19,13 @@ class NoteToType
*/
public static function translate(Note $note)
{
$attributedTo = null;
Event::handle('FreeNetworkGenerateLocalActorUri', ['source' => 'ActivityPub', 'actor_id' => $note->getActorId(), 'actor_uri' => &$attributedTo]);
$attr = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => Router::url('note_view', ['id' => $note->getId()], Router::ABSOLUTE_URL),
'published' => $note->getCreated()->format(DateTimeInterface::RFC3339),
'attributedTo' => Router::url('actor_view_id', ['id' => $note->getActorId()], Router::ABSOLUTE_URL),
'attributedTo' => $attributedTo,
//'to' => $to,
//'cc' => $cc,
'content' => json_encode($note->getRendered()),

plugins/ActivityStreamsTwo/Util/Response/AbstractResponse.php → plugins/ActivityPub/Util/Response/AbstractResponse.php View File

@@ -1,8 +1,8 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Response;
namespace Plugin\ActivityPub\Util\Response;

use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\EntityToType;
use Plugin\ActivityPub\Util\Model\EntityToType\EntityToType;

abstract class AbstractResponse
{

plugins/ActivityStreamsTwo/Util/Response/ActorResponse.php → plugins/ActivityPub/Util/Response/ActorResponse.php View File

@@ -1,10 +1,10 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Response;
namespace Plugin\ActivityPub\Util\Response;

use App\Entity\Actor;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\GSActorToType;
use Plugin\ActivityPub\Util\Model\EntityToType\GSActorToType;

abstract class ActorResponse
{

plugins/ActivityStreamsTwo/Util/Response/NoteResponse.php → plugins/ActivityPub/Util/Response/NoteResponse.php View File

@@ -1,10 +1,10 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Response;
namespace Plugin\ActivityPub\Util\Response;

use App\Entity\Note;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Model\EntityToType\NoteToType;
use Plugin\ActivityPub\Util\Model\EntityToType\NoteToType;

abstract class NoteResponse
//class NoteResponse extends Controller

plugins/ActivityStreamsTwo/Util/Response/TypeResponse.php → plugins/ActivityPub/Util/Response/TypeResponse.php View File

@@ -1,6 +1,6 @@
<?php

namespace Plugin\ActivityStreamsTwo\Util\Response;
namespace Plugin\ActivityPub\Util\Response;

use Symfony\Component\HttpFoundation\JsonResponse;


plugins/ActivityStreamsTwo/Util/Type.php → plugins/ActivityPub/Util/Type.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util;
namespace Plugin\ActivityPub\Util;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\AbstractObject;
use Plugin\ActivityStreamsTwo\Util\Type\TypeResolver;
use Plugin\ActivityStreamsTwo\Util\Type\Validator;
use Plugin\ActivityPub\Util\Type\AbstractObject;
use Plugin\ActivityPub\Util\Type\TypeResolver;
use Plugin\ActivityPub\Util\Type\Validator;

/**
* \ActivityPhp\Type is a Factory for ActivityStreams 2.0 types.

plugins/ActivityStreamsTwo/Util/Type/AbstractObject.php → plugins/ActivityPub/Util/Type/AbstractObject.php View File

@@ -9,11 +9,11 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type;
namespace Plugin\ActivityPub\Util\Type;

use function array_key_exists;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityPub\Util\Type;
use ReflectionClass;

/**

plugins/ActivityStreamsTwo/Util/Type/Core/AbstractActivity.php → plugins/ActivityPub/Util/Type/Core/AbstractActivity.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\AbstractActivity implements only common
* \Plugin\ActivityPub\Util\Type\Core\AbstractActivity implements only common
* attributes between Activity and IntransitiveActivity.
*
* It SHOULD NOT be used as if.
@@ -38,7 +38,7 @@ abstract class AbstractActivity extends ObjectType
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor
*
* @var string
* | \Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor
* | \Plugin\ActivityPub\Util\Type\Extended\AbstractActor
* | array<Actor>
* | array<Link>
* | Link

plugins/ActivityStreamsTwo/Util/Type/Core/Activity.php → plugins/ActivityPub/Util/Type/Core/Activity.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\Activity is an implementation of one of the
* \Plugin\ActivityPub\Util\Type\Core\Activity is an implementation of one of the
* Activity Streams Core Types.
*
* Activity objects are specializations of the base Object type that

plugins/ActivityStreamsTwo/Util/Type/Core/Collection.php → plugins/ActivityPub/Util/Type/Core/Collection.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\Collection is an implementation of one of the
* \Plugin\ActivityPub\Util\Type\Core\Collection is an implementation of one of the
* Activity Streams Core Types.
*
* Collection objects are a specialization of the base Object that serve

plugins/ActivityStreamsTwo/Util/Type/Core/CollectionPage.php → plugins/ActivityPub/Util/Type/Core/CollectionPage.php View File

@@ -9,7 +9,7 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* CollectionPage is an implementation of one

plugins/ActivityStreamsTwo/Util/Type/Core/IntransitiveActivity.php → plugins/ActivityPub/Util/Type/Core/IntransitiveActivity.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\IntransitiveActivity is an implementation of
* \Plugin\ActivityPub\Util\Type\Core\IntransitiveActivity is an implementation of
* one of the Activity Streams Core Types.
*
* IntransitiveActivity objects are specializations of the Activity type

plugins/ActivityStreamsTwo/Util/Type/Core/Link.php → plugins/ActivityPub/Util/Type/Core/Link.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

use Plugin\ActivityStreamsTwo\Util\Type\AbstractObject;
use Plugin\ActivityPub\Util\Type\AbstractObject;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\Link is an implementation of one of the
* \Plugin\ActivityPub\Util\Type\Core\Link is an implementation of one of the
* Activity Streams Core Types.
*
* A Link describes a qualified, indirect reference to another resource.

plugins/ActivityStreamsTwo/Util/Type/Core/ObjectType.php → plugins/ActivityPub/Util/Type/Core/ObjectType.php View File

@@ -9,9 +9,9 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

use Plugin\ActivityStreamsTwo\Util\Type\AbstractObject;
use Plugin\ActivityPub\Util\Type\AbstractObject;

/**
* ObjectType is an implementation of one of the

plugins/ActivityStreamsTwo/Util/Type/Core/OrderedCollection.php → plugins/ActivityPub/Util/Type/Core/OrderedCollection.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\OrderedCollection is an implementation of one
* \Plugin\ActivityPub\Util\Type\Core\OrderedCollection is an implementation of one
* of the Activity Streams Core Types.
*
* A subtype of Collection in which members of the logical collection

plugins/ActivityStreamsTwo/Util/Type/Core/OrderedCollectionPage.php → plugins/ActivityPub/Util/Type/Core/OrderedCollectionPage.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Core;
namespace Plugin\ActivityPub\Util\Type\Core;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Core\OrderedCollection is an implementation of one
* \Plugin\ActivityPub\Util\Type\Core\OrderedCollection is an implementation of one
* of the Activity Streams Core Types.
*
* The OrderedCollectionPage type extends from both CollectionPage and

plugins/ActivityStreamsTwo/Util/Type/Extended/AbstractActor.php → plugins/ActivityPub/Util/Type/Extended/AbstractActor.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended;
namespace Plugin\ActivityPub\Util\Type\Extended;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityStreamsTwo\Util\Type\Core\OrderedCollection;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\OrderedCollection;

/**
* \ActivityPhp\Type\Extended\AbstractActor is an abstract class that

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Accept.php → plugins/ActivityPub/Util/Type/Extended/Activity/Accept.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Accept is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Accept is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor accepts the object. The target property can

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Announce.php → plugins/ActivityPub/Util/Type/Extended/Activity/Announce.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Announce is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Announce is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is calling the target's attention the

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Block.php → plugins/ActivityPub/Util/Type/Extended/Activity/Block.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Block is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Block is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is blocking the object. Blocking is a

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Create.php → plugins/ActivityPub/Util/Type/Extended/Activity/Create.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Create is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Create is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor has created the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Delete.php → plugins/ActivityPub/Util/Type/Extended/Activity/Delete.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Delete is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Delete is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor has deleted the object. If specified, the

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Follow.php → plugins/ActivityPub/Util/Type/Extended/Activity/Follow.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Follow is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Follow is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is "following" the object. Following is

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Ignore.php → plugins/ActivityPub/Util/Type/Extended/Activity/Ignore.php View File

@@ -9,9 +9,9 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \ActivityPhp\Type\Extended\Activity\Ignore is an implementation of

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Join.php → plugins/ActivityPub/Util/Type/Extended/Activity/Join.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Join is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Join is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor has joined the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Leave.php → plugins/ActivityPub/Util/Type/Extended/Activity/Leave.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Leave is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Leave is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor has left the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Like.php → plugins/ActivityPub/Util/Type/Extended/Activity/Like.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Like is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Like is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor likes, recommends or endorses the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Question.php → plugins/ActivityPub/Util/Type/Extended/Activity/Question.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\IntransitiveActivity;
use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\IntransitiveActivity;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Question is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Question is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a question being asked. Question objects are an extension
@@ -43,7 +43,7 @@ class Question extends IntransitiveActivity
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-oneof
*
* @var array<ObjectType>
* | array<\Plugin\ActivityStreamsTwo\Util\Type\Core\Link>
* | array<\Plugin\ActivityPub\Util\Type\Core\Link>
* | null
*/
protected array $oneOf;
@@ -55,7 +55,7 @@ class Question extends IntransitiveActivity
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-anyof
*
* @var array<ObjectType>
* | array<\Plugin\ActivityStreamsTwo\Util\Type\Core\Link>
* | array<\Plugin\ActivityPub\Util\Type\Core\Link>
* | null
*/
protected array $anyOf;
@@ -67,7 +67,7 @@ class Question extends IntransitiveActivity
* @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-closed
*
* @var ObjectType
* | \Plugin\ActivityStreamsTwo\Util\Type\Core\Link
* | \Plugin\ActivityPub\Util\Type\Core\Link
* | \DateTime
* | bool
* | null

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Reject.php → plugins/ActivityPub/Util/Type/Extended/Activity/Reject.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Reject is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Reject is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is rejecting the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Remove.php → plugins/ActivityPub/Util/Type/Extended/Activity/Remove.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Remove is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Remove is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is removing the object.

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Undo.php → plugins/ActivityPub/Util/Type/Extended/Activity/Undo.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Undo is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Undo is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor is undoing the object. In most cases, the

plugins/ActivityStreamsTwo/Util/Type/Extended/Activity/Update.php → plugins/ActivityPub/Util/Type/Extended/Activity/Update.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity;
namespace Plugin\ActivityPub\Util\Type\Extended\Activity;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Activity;
use Plugin\ActivityPub\Util\Type\Core\Activity;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Update is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Activity\Update is an implementation of
* one of the Activity Streams Extended Types.
*
* Indicates that the actor has updated the object. Note, however, that

plugins/ActivityStreamsTwo/Util/Type/Extended/Actor/Application.php → plugins/ActivityPub/Util/Type/Extended/Actor/Application.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor;
namespace Plugin\ActivityPub\Util\Type\Extended\Actor;

use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor\Application is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Actor\Application is an implementation of
* one of the Activity Streams Extended Types.
*
* Describes a software application.

plugins/ActivityStreamsTwo/Util/Type/Extended/Actor/Group.php → plugins/ActivityPub/Util/Type/Extended/Actor/Group.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor;
namespace Plugin\ActivityPub\Util\Type\Extended\Actor;

use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor\Group is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Actor\Group is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a formal or informal collective of Actors.

plugins/ActivityStreamsTwo/Util/Type/Extended/Actor/Organization.php → plugins/ActivityPub/Util/Type/Extended/Actor/Organization.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor;
namespace Plugin\ActivityPub\Util\Type\Extended\Actor;

use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor\Organization is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Actor\Organization is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a formal or informal collective of Actors.

plugins/ActivityStreamsTwo/Util/Type/Extended/Actor/Person.php → plugins/ActivityPub/Util/Type/Extended/Actor/Person.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor;
namespace Plugin\ActivityPub\Util\Type\Extended\Actor;

use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor\Person is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Actor\Person is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents an individual person.

plugins/ActivityStreamsTwo/Util/Type/Extended/Actor/Service.php → plugins/ActivityPub/Util/Type/Extended/Actor/Service.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor;
namespace Plugin\ActivityPub\Util\Type\Extended\Actor;

use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Actor\Service is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Actor\Service is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a service of any kind.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Article.php → plugins/ActivityPub/Util/Type/Extended/Object/Article.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Article is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Article is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents any kind of multi-paragraph written work.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Audio.php → plugins/ActivityPub/Util/Type/Extended/Object/Audio.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Audio is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Audio is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a document of any kind.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Document.php → plugins/ActivityPub/Util/Type/Extended/Object/Document.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Document is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Document is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents an audio document of any kind.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Event.php → plugins/ActivityPub/Util/Type/Extended/Object/Event.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Event is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Event is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents any kind of event.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Image.php → plugins/ActivityPub/Util/Type/Extended/Object/Image.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Image is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Image is an implementation of
* one of the Activity Streams Extended Types.
*
* An image document of any kind.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Mention.php → plugins/ActivityPub/Util/Type/Extended/Object/Mention.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\Link;
use Plugin\ActivityPub\Util\Type\Core\Link;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Mention is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Mention is an implementation of
* one of the Activity Streams Extended Types.
*
* A specialized Link that represents an @mention.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Note.php → plugins/ActivityPub/Util/Type/Extended/Object/Note.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Note is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Note is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a short written work typically less than a single

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Page.php → plugins/ActivityPub/Util/Type/Extended/Object/Page.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Page is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Page is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a Web Page.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Place.php → plugins/ActivityPub/Util/Type/Extended/Object/Place.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Place is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Place is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a logical or physical location.

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Profile.php → plugins/ActivityPub/Util/Type/Extended/Object/Profile.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Profile is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Profile is an implementation of
* one of the Activity Streams Extended Types.
*
* A Profile is a content object that describes another Object,

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Tombstone.php → plugins/ActivityPub/Util/Type/Extended/Object/Tombstone.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

use Plugin\ActivityStreamsTwo\Util\Type\Core\ObjectType;
use Plugin\ActivityPub\Util\Type\Core\ObjectType;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Tombstone is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Tombstone is an implementation of
* one of the Activity Streams Extended Types.
*
* A Tombstone represents a content object that has been deleted. It can

plugins/ActivityStreamsTwo/Util/Type/Extended/Object/Video.php → plugins/ActivityPub/Util/Type/Extended/Object/Video.php View File

@@ -9,10 +9,10 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Extended\Object;
namespace Plugin\ActivityPub\Util\Type\Extended\Object;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Extended\Object\Video is an implementation of
* \Plugin\ActivityPub\Util\Type\Extended\Object\Video is an implementation of
* one of the Activity Streams Extended Types.
*
* Represents a video document of any kind.

plugins/ActivityStreamsTwo/Util/Type/TypeResolver.php → plugins/ActivityPub/Util/Type/TypeResolver.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type;
namespace Plugin\ActivityPub\Util\Type;

use Exception;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\TypeResolver is an abstract class for
* \Plugin\ActivityPub\Util\Type\TypeResolver is an abstract class for
* resolving class names called by their short names (AS types).
*/
abstract class TypeResolver

plugins/ActivityStreamsTwo/Util/Type/Util.php → plugins/ActivityPub/Util/Type/Util.php View File

@@ -9,15 +9,15 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type;
namespace Plugin\ActivityPub\Util\Type;

use DateInterval;
use DateTime;
use Exception;
use Plugin\ActivityStreamsTwo\Util\Type;
use Plugin\ActivityPub\Util\Type;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Util is an abstract class for
* \Plugin\ActivityPub\Util\Type\Util is an abstract class for
* supporting validators checks & transformations.
*/
abstract class Util
@@ -379,7 +379,7 @@ abstract class Util
is_null($min) && is_null($max) => false,
is_null($min) => $value <= $max,
is_null($max) => $value >= $min,
default => $value >= $min
default => $value >= $min
&& $value <= $max,
};
}

plugins/ActivityStreamsTwo/Util/Type/Validator.php → plugins/ActivityPub/Util/Type/Validator.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type;
namespace Plugin\ActivityPub\Util\Type;

use Exception;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator is an abstract class for
* \Plugin\ActivityPub\Util\Type\Validator is an abstract class for
* attribute validation.
*/
abstract class Validator
@@ -58,7 +58,7 @@ abstract class Validator

// Try to load a default validator
$validatorName = sprintf(
'\Plugin\ActivityStreamsTwo\Util\Type\Validator\%sValidator',
'\Plugin\ActivityPub\Util\Type\Validator\%sValidator',
ucfirst($name)
);

@@ -79,7 +79,7 @@ abstract class Validator
* @param object|string $class A validator class name
*
* @throws Exception if validator class does not implement
* \Plugin\ActivityStreamsTwo\Util\Type\Helper\ValidatorInterface
* \Plugin\ActivityPub\Util\Type\Helper\ValidatorInterface
*/
public static function add(string $name, object|string $class): void
{

plugins/ActivityStreamsTwo/Util/Type/Validator/AccuracyValidator.php → plugins/ActivityPub/Util/Type/Validator/AccuracyValidator.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Plugin\ActivityStreamsTwo\Util\Type\ValidatorInterface;
use Plugin\ActivityPub\Util\Type\ValidatorInterface;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AccuracyValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AccuracyValidator is a dedicated
* validator for accuracy attribute.
*/
class AccuracyValidator implements ValidatorInterface

plugins/ActivityStreamsTwo/Util/Type/Validator/ActorValidator.php → plugins/ActivityPub/Util/Type/Validator/ActorValidator.php View File

@@ -9,17 +9,17 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\Core\Collection;
use Plugin\ActivityStreamsTwo\Util\Type\Core\Link;
use Plugin\ActivityStreamsTwo\Util\Type\Extended\AbstractActor;
use Plugin\ActivityStreamsTwo\Util\Type\Util;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorInterface;
use Plugin\ActivityPub\Util\Type\Core\Collection;
use Plugin\ActivityPub\Util\Type\Core\Link;
use Plugin\ActivityPub\Util\Type\Extended\AbstractActor;
use Plugin\ActivityPub\Util\Type\Util;
use Plugin\ActivityPub\Util\Type\ValidatorInterface;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\ActorValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\ActorValidator is a dedicated
* validator for actor attribute.
*/
class ActorValidator implements ValidatorInterface

plugins/ActivityStreamsTwo/Util/Type/Validator/AltitudeValidator.php → plugins/ActivityPub/Util/Type/Validator/AltitudeValidator.php View File

@@ -9,12 +9,12 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Plugin\ActivityStreamsTwo\Util\Type\ValidatorInterface;
use Plugin\ActivityPub\Util\Type\ValidatorInterface;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AltitudeValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AltitudeValidator is a dedicated
* validator for altitude attribute.
*/
class AltitudeValidator implements ValidatorInterface

plugins/ActivityStreamsTwo/Util/Type/Validator/AnyOfValidator.php → plugins/ActivityPub/Util/Type/Validator/AnyOfValidator.php View File

@@ -9,15 +9,15 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Question;
use Plugin\ActivityStreamsTwo\Util\Type\Util;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\Extended\Activity\Question;
use Plugin\ActivityPub\Util\Type\Util;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AnyOfValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AnyOfValidator is a dedicated
* validator for anyOf attribute.
*/
class AnyOfValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/AttachmentValidator.php → plugins/ActivityPub/Util/Type/Validator/AttachmentValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AttachmentValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AttachmentValidator is a dedicated
* validator for attachment attribute.
*/
class AttachmentValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/AttributedToValidator.php → plugins/ActivityPub/Util/Type/Validator/AttributedToValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AttributedToValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AttributedToValidator is a dedicated
* validator for attributedTo attribute.
*/
class AttributedToValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/AudienceValidator.php → plugins/ActivityPub/Util/Type/Validator/AudienceValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\AudienceValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\AudienceValidator is a dedicated
* validator for audience attribute.
*/
class AudienceValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/BccValidator.php → plugins/ActivityPub/Util/Type/Validator/BccValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\BccValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\BccValidator is a dedicated
* validator for bcc attribute.
*/
class BccValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/BtoValidator.php → plugins/ActivityPub/Util/Type/Validator/BtoValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\BtoValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\BtoValidator is a dedicated
* validator for bto attribute.
*/
class BtoValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/CcValidator.php → plugins/ActivityPub/Util/Type/Validator/CcValidator.php View File

@@ -9,13 +9,13 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorTools;
use Plugin\ActivityPub\Util\Type\ValidatorTools;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\CcValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\CcValidator is a dedicated
* validator for cc attribute.
*/
class CcValidator extends ValidatorTools

plugins/ActivityStreamsTwo/Util/Type/Validator/ClosedValidator.php → plugins/ActivityPub/Util/Type/Validator/ClosedValidator.php View File

@@ -9,15 +9,15 @@
* <https://github.com/landrok/activitypub/blob/master/LICENSE>.
*/

namespace Plugin\ActivityStreamsTwo\Util\Type\Validator;
namespace Plugin\ActivityPub\Util\Type\Validator;

use Exception;
use Plugin\ActivityStreamsTwo\Util\Type\Extended\Activity\Question;
use Plugin\ActivityStreamsTwo\Util\Type\Util;
use Plugin\ActivityStreamsTwo\Util\Type\ValidatorInterface;
use Plugin\ActivityPub\Util\Type\Extended\Activity\Question;
use Plugin\ActivityPub\Util\Type\Util;
use Plugin\ActivityPub\Util\Type\ValidatorInterface;

/**
* \Plugin\ActivityStreamsTwo\Util\Type\Validator\ClosedValidator is a dedicated
* \Plugin\ActivityPub\Util\Type\Validator\ClosedValidator is a dedicated
* validator for closed attribute.
*/
class ClosedValidator implements ValidatorInterface