| 1 |
<?php |
| 2 |
/** |
| 3 |
* Reply embed template. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
/* @var array $args Template arguments. */ |
| 9 |
$args = wp_parse_args( |
| 10 |
$args, |
| 11 |
array( |
| 12 |
'avatar_url' => '', |
| 13 |
'author_name' => '', |
| 14 |
'author_url' => '', |
| 15 |
'title' => '', |
| 16 |
'content' => '', |
| 17 |
'image' => '', |
| 18 |
'published' => '', |
| 19 |
'url' => '', |
| 20 |
'boosts' => null, |
| 21 |
'favorites' => null, |
| 22 |
'webfinger' => '', |
| 23 |
) |
| 24 |
); |
| 25 |
|
| 26 |
\wp_enqueue_style( 'activitypub-embed', ACTIVITYPUB_PLUGIN_URL . 'assets/css/activitypub-embed.css', array(), ACTIVITYPUB_PLUGIN_VERSION ); |
| 27 |
?> |
| 28 |
|
| 29 |
<div class="activitypub-embed u-in-reply-to h-cite"> |
| 30 |
<div class="activitypub-embed-header p-author h-card"> |
| 31 |
<?php if ( $args['avatar_url'] ) : ?> |
| 32 |
<img class="u-photo" src="<?php echo \esc_url( $args['avatar_url'] ); ?>" alt="" /> |
| 33 |
<?php endif; ?> |
| 34 |
<div class="activitypub-embed-header-text"> |
| 35 |
<h2 class="p-name"><?php echo \esc_html( $args['author_name'] ); ?></h2> |
| 36 |
<?php if ( $args['author_url'] ) : ?> |
| 37 |
<a href="<?php echo \esc_url( $args['author_url'] ); ?>" class="ap-account u-url"><?php echo \esc_html( $args['webfinger'] ?? $args['author_url'] ); ?></a> |
| 38 |
<?php endif; ?> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
|
| 42 |
<div class="activitypub-embed-content"> |
| 43 |
<?php if ( $args['title'] ) : ?> |
| 44 |
<h3 class="ap-title p-name"><?php echo \esc_html( $args['title'] ); ?></h3> |
| 45 |
<?php endif; ?> |
| 46 |
|
| 47 |
<?php if ( $args['content'] ) : ?> |
| 48 |
<div class="ap-subtitle p-summary e-content"><?php echo \wp_kses_post( $args['content'] ); ?></div> |
| 49 |
<?php endif; ?> |
| 50 |
|
| 51 |
<?php if ( $args['image'] ) : ?> |
| 52 |
<div class="ap-preview"> |
| 53 |
<img class="u-photo u-featured" src="<?php echo \esc_url( $args['image'] ); ?>" alt="" /> |
| 54 |
</div> |
| 55 |
<?php endif; ?> |
| 56 |
</div> |
| 57 |
|
| 58 |
<div class="activitypub-embed-meta"> |
| 59 |
<?php if ( $args['published'] ) : ?> |
| 60 |
<a href="<?php echo \esc_url( $args['url'] ); ?>" class="ap-stat ap-date dt-published u-in-reply-to"><?php echo \esc_html( $args['published'] ); ?></a> |
| 61 |
<?php endif; ?> |
| 62 |
|
| 63 |
<?php if ( null !== $args['boosts'] ) : ?> |
| 64 |
<span class="ap-stat"> |
| 65 |
<?php |
| 66 |
/* translators: %s: number of boosts */ |
| 67 |
printf( \esc_html__( '%s boosts', 'activitypub' ), '<strong>' . \esc_html( $args['boosts'] ) . '</strong>' ); |
| 68 |
?> |
| 69 |
</span> |
| 70 |
<?php endif; ?> |
| 71 |
|
| 72 |
<?php if ( null !== $args['favorites'] ) : ?> |
| 73 |
<span class="ap-stat"> |
| 74 |
<?php |
| 75 |
/* translators: %s: number of favorites */ |
| 76 |
printf( \esc_html__( '%s favorites', 'activitypub' ), '<strong>' . \esc_html( $args['favorites'] ) . '</strong>' ); |
| 77 |
?> |
| 78 |
</span> |
| 79 |
<?php endif; ?> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
|