Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion assets/css/activitypub-embed.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
background: #fff;
border: 1px solid #e6e6e6;
border-radius: 12px;
margin: 1em 0;
padding: 0;
max-width: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.activitypub-reply-block .activitypub-embed {
margin: 1em 0;
}

.activitypub-embed-header {
padding: 15px;
display: flex;
Expand Down Expand Up @@ -93,6 +96,7 @@
}

.activitypub-embed-meta a.ap-stat {
color: inherit;
text-decoration: none;
}

Expand Down
2 changes: 1 addition & 1 deletion build/reply/index-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/reply/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'f07b381ebbd367924395');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '8ff5f0e6ab1e101a6c99');
2 changes: 1 addition & 1 deletion build/reply/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1636,15 +1636,15 @@ function get_embed_html( $url, $inline_css = true ) {
$title = $object['name'] ?? '';
$content = $object['content'] ?? '';
$published = isset( $object['published'] ) ? gmdate( get_option( 'date_format' ) . ', ' . get_option( 'time_format' ), strtotime( $object['published'] ) ) : '';
$boosts = isset( $object['shares']['totalItems'] ) ? (int) $object['shares']['totalItems'] : 0;
$favorites = isset( $object['likes']['totalItems'] ) ? (int) $object['likes']['totalItems'] : 0;
$boosts = isset( $object['shares']['totalItems'] ) ? (int) $object['shares']['totalItems'] : null;
$favorites = isset( $object['likes']['totalItems'] ) ? (int) $object['likes']['totalItems'] : null;

$image = '';
if ( isset( $object['image']['url'] ) ) {
$image = $object['image']['url'];
} elseif ( isset( $object['attachment'] ) ) {
foreach ( $object['attachment'] as $attachment ) {
if ( isset( $attachment['type'] ) && 'Document' === $attachment['type'] ) {
if ( isset( $attachment['type'] ) && in_array( $attachment['type'], array( 'Image', 'Document' ), true ) ) {
$image = $attachment['url'];
break;
}
Expand Down
28 changes: 16 additions & 12 deletions templates/reply-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
'image' => '',
'published' => '',
'url' => '',
'boosts' => '',
'favorites' => '',
'boosts' => null,
'favorites' => null,
'webfinger' => '',
)
);
Expand Down Expand Up @@ -60,18 +60,22 @@
<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>
<?php endif; ?>

<?php if ( null !== $args['boosts'] ) : ?>
<span class="ap-stat">
<?php
/* translators: %s: number of boosts */
printf( \esc_html__( '%s boosts', 'activitypub' ), '<strong>' . \esc_html( $args['boosts'] ) . '</strong>' );
?>
</span>
<?php
/* translators: %s: number of boosts */
printf( \esc_html__( '%s boosts', 'activitypub' ), '<strong>' . \esc_html( $args['boosts'] ) . '</strong>' );
?>
</span>
<?php endif; ?>

<?php if ( null !== $args['favorites'] ) : ?>
<span class="ap-stat">
<?php
/* translators: %s: number of favorites */
printf( \esc_html__( '%s favorites', 'activitypub' ), '<strong>' . \esc_html( $args['favorites'] ) . '</strong>' );
?>
</span>
<?php
/* translators: %s: number of favorites */
printf( \esc_html__( '%s favorites', 'activitypub' ), '<strong>' . \esc_html( $args['favorites'] ) . '</strong>' );
?>
</span>
<?php endif; ?>
</div>
</div>
Loading