2021-01-08 17:43:35 +01:00
|
|
|
<?php
|
2023-05-31 09:39:35 +02:00
|
|
|
$user = new \Activitypub\Model\Blog_User();
|
2021-01-08 17:43:35 +01:00
|
|
|
|
2023-06-28 16:43:05 +02:00
|
|
|
$user->set_context(
|
2023-07-03 17:59:42 +02:00
|
|
|
\Activitypub\Activity\Activity::CONTEXT
|
2023-06-28 16:43:05 +02:00
|
|
|
);
|
|
|
|
|
2021-01-08 17:43:35 +01:00
|
|
|
/*
|
|
|
|
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
|
|
|
*/
|
2023-06-28 14:22:27 +02:00
|
|
|
\do_action( 'activitypub_json_author_pre', $user->get__id() );
|
2021-01-08 17:43:35 +01:00
|
|
|
|
|
|
|
$options = 0;
|
|
|
|
// JSON_PRETTY_PRINT added in PHP 5.4
|
|
|
|
if ( \get_query_var( 'pretty' ) ) {
|
|
|
|
$options |= \JSON_PRETTY_PRINT; // phpcs:ignore
|
|
|
|
}
|
|
|
|
|
|
|
|
$options |= \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Options to be passed to json_encode()
|
|
|
|
*
|
|
|
|
* @param int $options The current options flags
|
|
|
|
*/
|
2023-06-28 14:22:27 +02:00
|
|
|
$options = \apply_filters( 'activitypub_json_author_options', $options, $user->get__id() );
|
2021-01-08 17:43:35 +01:00
|
|
|
|
|
|
|
\header( 'Content-Type: application/activity+json' );
|
2023-05-30 11:22:20 +02:00
|
|
|
echo \wp_json_encode( $user->to_array(), $options );
|
2021-01-08 17:43:35 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Action triggerd after the ActivityPub profile has been created and sent to the client
|
|
|
|
*/
|
2023-06-28 14:22:27 +02:00
|
|
|
\do_action( 'activitypub_json_author_post', $user->get__id() );
|