2024-02-08 12:31:25 +00:00
|
|
|
<?php
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* ActivityPub Comment JSON template.
|
|
|
|
*
|
|
|
|
* @package Activitypub
|
|
|
|
*/
|
|
|
|
|
|
|
|
$comment = \get_comment( \get_query_var( 'c', null ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
2024-06-27 12:10:38 +00:00
|
|
|
$transformer = \Activitypub\Transformer\Factory::get_transformer( $comment );
|
|
|
|
|
|
|
|
if ( \is_wp_error( $transformer ) ) {
|
|
|
|
\wp_die(
|
|
|
|
\esc_html( $transformer->get_error_message() ),
|
|
|
|
404
|
|
|
|
);
|
|
|
|
}
|
2024-02-08 12:31:25 +00:00
|
|
|
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Action triggered prior to the ActivityPub profile being created and sent to the client
|
2024-02-08 12:31:25 +00:00
|
|
|
*/
|
|
|
|
\do_action( 'activitypub_json_comment_pre' );
|
|
|
|
|
|
|
|
\header( 'Content-Type: application/activity+json' );
|
2024-06-27 12:10:38 +00:00
|
|
|
echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
2024-02-08 12:31:25 +00:00
|
|
|
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Action triggered after the ActivityPub profile has been created and sent to the client
|
2024-02-08 12:31:25 +00:00
|
|
|
*/
|
2024-06-27 12:10:38 +00:00
|
|
|
\do_action( 'activitypub_json_comment_post' );
|