wordpress-activitypub/templates/comment-json.php
Konstantin Obenland ef666772ec
PHPCS: Include all files by default (#930)
* PHPCS: Include all files by default

* simplify menu highlighting

* Update includes/transformer/class-factory.php

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-10-09 08:57:13 +02:00

29 lines
847 B
PHP

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