| 1 |
<?php |
| 2 |
$user = \Activitypub\Collection\Users::get_by_id( \get_the_author_meta( 'ID' ) ); |
| 3 |
|
| 4 |
$user->set_context( |
| 5 |
\Activitypub\Activity\Activity::CONTEXT |
| 6 |
); |
| 7 |
|
| 8 |
/* |
| 9 |
* Action triggerd prior to the ActivityPub profile being created and sent to the client |
| 10 |
*/ |
| 11 |
\do_action( 'activitypub_json_author_pre', $user->get__id() ); |
| 12 |
|
| 13 |
$options = 0; |
| 14 |
// JSON_PRETTY_PRINT added in PHP 5.4 |
| 15 |
if ( \get_query_var( 'pretty' ) ) { |
| 16 |
$options |= \JSON_PRETTY_PRINT; // phpcs:ignore |
| 17 |
} |
| 18 |
|
| 19 |
$options |= \JSON_HEX_TAG | \JSON_HEX_AMP | \JSON_HEX_QUOT; |
| 20 |
|
| 21 |
/* |
| 22 |
* Options to be passed to json_encode() |
| 23 |
* |
| 24 |
* @param int $options The current options flags |
| 25 |
*/ |
| 26 |
$options = \apply_filters( 'activitypub_json_author_options', $options, $user->get__id() ); |
| 27 |
|
| 28 |
\header( 'Content-Type: application/activity+json' ); |
| 29 |
echo \wp_json_encode( $user->to_array(), $options ); |
| 30 |
|
| 31 |
/* |
| 32 |
* Action triggerd after the ActivityPub profile has been created and sent to the client |
| 33 |
*/ |
| 34 |
\do_action( 'activitypub_json_author_post', $user->get__id() ); |
| 35 |
|