laipower/wp-content/plugins/activitypub/templates/post-json.php

31 lines
803 B
PHP
Raw Normal View History

2020-04-07 13:03:04 +00:00
<?php
/**
* ActivityPub Post JSON template.
*
* @package Activitypub
*/
$post = \get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$transformer = \Activitypub\Transformer\Factory::get_transformer( $post );
if ( \is_wp_error( $transformer ) ) {
\wp_die(
esc_html( $transformer->get_error_message() ),
404
);
}
2020-04-07 13:03:04 +00:00
/**
* Action triggered prior to the ActivityPub profile being created and sent to the client
2020-04-07 13:03:04 +00:00
*/
\do_action( 'activitypub_json_post_pre' );
\header( 'Content-Type: application/activity+json' );
echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2020-04-07 13:03:04 +00:00
/**
* Action triggered after the ActivityPub profile has been created and sent to the client
2020-04-07 13:03:04 +00:00
*/
\do_action( 'activitypub_json_post_post' );