2018-09-27 22:27:23 +02:00
|
|
|
<?php
|
2023-05-24 16:32:00 +02:00
|
|
|
$user = \Activitypub\User_Factory::get_by_id( \get_the_author_meta( 'ID' ) );
|
2021-09-15 17:00:20 +02:00
|
|
|
|
2018-09-27 22:27:23 +02:00
|
|
|
/*
|
|
|
|
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
|
|
|
*/
|
2023-05-24 16:32:00 +02:00
|
|
|
\do_action( 'activitypub_json_author_pre', $user->get_user_id() );
|
2018-09-27 22:27:23 +02:00
|
|
|
|
|
|
|
$options = 0;
|
|
|
|
// JSON_PRETTY_PRINT added in PHP 5.4
|
2019-09-27 11:36:52 +02:00
|
|
|
if ( \get_query_var( 'pretty' ) ) {
|
2020-05-12 19:42:09 +02:00
|
|
|
$options |= \JSON_PRETTY_PRINT; // phpcs:ignore
|
2018-09-27 22:27:23 +02:00
|
|
|
}
|
|
|
|
|
2020-05-12 19:42:09 +02:00
|
|
|
$options |= \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT;
|
2019-02-02 23:56:05 +01:00
|
|
|
|
2018-09-27 22:27:23 +02:00
|
|
|
/*
|
|
|
|
* Options to be passed to json_encode()
|
|
|
|
*
|
|
|
|
* @param int $options The current options flags
|
|
|
|
*/
|
2023-05-24 16:32:00 +02:00
|
|
|
$options = \apply_filters( 'activitypub_json_author_options', $options, $user->get_user_id() );
|
2018-09-27 22:27:23 +02:00
|
|
|
|
2019-09-27 11:36:52 +02:00
|
|
|
\header( 'Content-Type: application/activity+json' );
|
2023-05-24 16:32:00 +02:00
|
|
|
echo \wp_json_encode( $user->to_array(), $options );
|
2018-09-27 22:27:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Action triggerd after the ActivityPub profile has been created and sent to the client
|
|
|
|
*/
|
2023-05-24 16:32:00 +02:00
|
|
|
\do_action( 'activitypub_json_author_post', $user->get_user_id() );
|