mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-07 11:19:21 +02:00
- rename podlibre to adaures - rename castopod-host to castopod - simplify README and redirect to docs site - move INSTALL and UPDATE docs - add new gitlabci pipeline to deploy docs - upgrade node to v16 in Dockerfile
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* This class defines the Object which is the primary base type for the Activity Streams vocabulary.
|
|
*
|
|
* Object is a reserved word in php, so the class is named ObjectType.
|
|
*
|
|
* @copyright 2021 Ad Aures
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace Modules\Fediverse\Objects;
|
|
|
|
use Modules\Fediverse\Core\ObjectType;
|
|
use Modules\Fediverse\Entities\Post;
|
|
|
|
class NoteObject extends ObjectType
|
|
{
|
|
protected string $type = 'Note';
|
|
|
|
protected string $attributedTo;
|
|
|
|
protected string $inReplyTo;
|
|
|
|
protected string $replies;
|
|
|
|
/**
|
|
* @param Post $post
|
|
*/
|
|
public function __construct($post)
|
|
{
|
|
$this->id = $post->uri;
|
|
|
|
$this->content = $post->message_html;
|
|
$this->published = $post->published_at->format(DATE_W3C);
|
|
$this->attributedTo = $post->actor->uri;
|
|
|
|
if ($post->in_reply_to_id !== null) {
|
|
$this->to[] = $post->reply_to_post->actor->uri;
|
|
|
|
$this->inReplyTo = $post->reply_to_post->uri;
|
|
}
|
|
|
|
$this->replies = url_to('post-replies', $post->actor->username, $post->id);
|
|
|
|
$this->cc = [$post->actor->followers_url];
|
|
}
|
|
}
|