updated plugin ActivityPub version 5.8.0

This commit is contained in:
2025-04-29 21:19:06 +00:00
committed by Gitium
parent 19dfd317cc
commit fdfbf76539
166 changed files with 14119 additions and 7163 deletions

View File

@ -0,0 +1,49 @@
<?php
/**
* ActivityPub New DM E-Mail template.
*
* @package Activitypub
*/
use Activitypub\Collection\Actors;
use Activitypub\Embed;
/* @var array $args Template arguments. */
$args = wp_parse_args( $args ?? array() );
// Load header.
require __DIR__ . '/parts/header.php';
?>
<h1><?php esc_html_e( 'You&#8217;ve got a new message!', 'activitypub' ); ?></h1>
<p>
<?php
if ( Actors::BLOG_USER_ID === $args['user_id'] ) :
/* translators: %s: The name of the person who mentioned the blog. */
$message = __( 'Looks like someone&#8217;s reaching out! Your blog just got a direct message from %s on the Fediverse. Here&#8217;s what they said:', 'activitypub' );
else :
/* translators: %s: The name of the person who sent the message. */
$message = __( 'Looks like someone&#8217;s reaching out! You just got a direct message from %s on the Fediverse. Here&#8217;s what they said:', 'activitypub' );
endif;
printf( esc_html( $message ), '<a href="' . esc_url( $args['actor']['url'] ) . '">' . esc_html( $args['actor']['webfinger'] ) . '</a>' );
?>
</p>
<div class="embed">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Embed::get_html_for_object( $args['activity']['object'] );
?>
</div>
<?php
/**
* Fires at the bottom of the new direct message emails.
*
* @param array $args The template arguments.
*/
do_action( 'activitypub_new_dm_email', $args );
// Load footer.
require __DIR__ . '/parts/footer.php';

View File

@ -0,0 +1,159 @@
<?php
/**
* ActivityPub New Follower E-Mail template.
*
* @package Activitypub
*/
use Activitypub\Collection\Actors;
/* @var array $args Template arguments. */
$args = wp_parse_args( $args ?? array() );
// Load header.
require __DIR__ . '/parts/header.php';
?>
<style>
.card {
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.card-header {
width: 100%;
height: 120px;
background-color: #ccc;
background-size: cover;
background-position: center;
}
.card-body {
display: flex;
gap: 16px;
align-items: flex-start;
padding: 16px;
}
.card-body img {
border-radius: 50%;
width: 64px;
height: 64px;
flex-shrink: 0;
}
.card-content {
flex: 1;
}
.card-content h2 {
font-size: 18px;
margin: 0 0 4px;
}
.card-content p {
margin: 0 0 8px;
}
</style>
<h1>
<?php
if ( Actors::BLOG_USER_ID === $args['user_id'] ) :
esc_html_e( 'Your blog has a new follower!', 'activitypub' );
else :
esc_html_e( 'You have a new follower!', 'activitypub' );
endif;
?>
</h1>
<p>
<?php
if ( Actors::BLOG_USER_ID === $args['user_id'] ) :
/* translators: %s: The name of the person who mentioned the blog. */
$message = __( 'Meet your blog&#8217;s newest follower, %s. Here&#8217;s a quick look at their profile:', 'activitypub' );
else :
/* translators: %s: The name of the person who mentioned the user. */
$message = __( 'Meet your newest follower, %s. Here&#8217;s a quick look at their profile:', 'activitypub' );
endif;
printf( esc_html( $message ), '<a href="' . esc_url( $args['url'] ) . '">' . esc_html( $args['webfinger'] ) . '</a>' );
?>
</p>
<div class="card">
<?php if ( ! empty( $args['image']['url'] ) ) : ?>
<div class="card-header" style="background-image: url('<?php echo esc_url( $args['image']['url'] ); ?>');"></div>
<?php endif; ?>
<div class="card-body">
<?php if ( ! empty( $args['icon']['url'] ) ) : ?>
<img src="<?php echo esc_url( $args['icon']['url'] ); ?>" alt="<?php echo esc_attr( $args['name'] ); ?>">
<?php endif; ?>
<div class="card-content">
<h2><?php echo esc_html( $args['name'] ); ?> <small style="font-size: 14px; color: #666;"><?php echo esc_html( $args['webfinger'] ); ?></small></h2>
<?php if ( ! empty( $args['summary'] ) ) : ?>
<p><?php echo wp_kses_post( nl2br( $args['summary'] ) ); ?></p>
<?php endif; ?>
<?php if ( isset( $args['stats']['outbox'] ) || isset( $args['stats']['followers'] ) || isset( $args['stats']['following'] ) ) : ?>
<div class="card-stats" style="display: flex; gap: 16px; font-size: 14px; color: #666; margin-top: 16px;">
<?php if ( null !== $args['stats']['outbox'] ) : ?>
<div>
<?php
printf(
/* translators: %s: Number of posts */
esc_html( _n( '%s post', '%s posts', (int) $args['stats']['outbox'], 'activitypub' ) ),
'<strong>' . esc_html( number_format_i18n( $args['stats']['outbox'] ) ) . '</strong>'
);
?>
</div>
<?php endif; ?>
<?php if ( null !== $args['stats']['followers'] ) : ?>
<div>
<?php
printf(
/* translators: %s: Number of followers */
esc_html( _n( '%s follower', '%s followers', (int) $args['stats']['followers'], 'activitypub' ) ),
'<strong>' . esc_html( number_format_i18n( $args['stats']['followers'] ) ) . '</strong>'
);
?>
</div>
<?php endif; ?>
<?php if ( null !== $args['stats']['following'] ) : ?>
<div>
<?php
printf(
/* translators: %s: Number of following */
esc_html( _n( '%s following', '%s following', (int) $args['stats']['following'], 'activitypub' ) ),
'<strong>' . esc_html( number_format_i18n( $args['stats']['following'] ) ) . '</strong>'
);
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<p>
<a class="button" href="<?php echo esc_url( $args['url'] ); ?>">
<?php esc_html_e( 'View Profile', 'activitypub' ); ?>
</a>
</p>
<p>
<?php
printf(
/* translators: %s: URL to followers list. */
wp_kses( __( 'Visit the <a href="%s">followers list</a> to see all followers.', 'activitypub' ), array( 'a' => array( 'href' => array() ) ) ),
esc_url( admin_url( $args['admin_url'] ) )
);
?>
</p>
<?php
/**
* Fires at the bottom of the new follower email.
*
* @param array $args The actor that followed the blog.
*/
do_action( 'activitypub_new_follower_email', $args );
// Load footer.
require __DIR__ . '/parts/footer.php';

View File

@ -0,0 +1,64 @@
<?php
/**
* ActivityPub New Mention E-Mail template with styles.
*
* @package Activitypub
*/
use Activitypub\Collection\Actors;
use Activitypub\Embed;
/* @var array $args Template arguments. */
$args = wp_parse_args( $args ?? array() );
// Load header.
require __DIR__ . '/parts/header.php';
?>
<h1>
<?php
if ( Actors::BLOG_USER_ID === $args['user_id'] ) :
esc_html_e( 'Your blog was mentioned!', 'activitypub' );
else :
esc_html_e( 'You were mentioned!', 'activitypub' );
endif;
?>
</h1>
<p>
<?php
if ( Actors::BLOG_USER_ID === $args['user_id'] ) :
/* translators: %s: The name of the person who mentioned the blog. */
$message = __( 'Looks like someone&#8217;s talking about your blog! It was just mentioned by %s in a post on the Fediverse. Here&#8217;s what they said:', 'activitypub' );
else :
/* translators: %s: The name of the person who mentioned the user. */
$message = __( 'Looks like someone&#8217;s talking about you! You were just mentioned by %s in a post on the Fediverse. Here&#8217;s what they said:', 'activitypub' );
endif;
printf( esc_html( $message ), '<a href="' . esc_url( $args['actor']['url'] ) . '">' . esc_html( $args['actor']['webfinger'] ) . '</a>' );
?>
</p>
<div class="embed">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo Embed::get_html_for_object( $args['activity']['object'] );
?>
</div>
<p>
<a class="button" href="<?php echo esc_url( admin_url( 'post-new.php?in_reply_to=' . $args['activity']['object']['id'] ) ); ?>">
<?php esc_html_e( 'Reply to the post', 'activitypub' ); ?>
</a>
</p>
<?php
/**
* Fires at the bottom of the new mention emails.
*
* @param array $args The template arguments.
*/
do_action( 'activitypub_new_mention_email', $args );
// Load footer.
require __DIR__ . '/parts/footer.php';

View File

@ -0,0 +1,28 @@
<?php
/**
* ActivityPub E-Mail template footer.
*
* @package Activitypub
*/
/* @var array $args Template arguments. */
use Activitypub\Collection\Actors;
/* @var array $args Template arguments. */
$args = wp_parse_args( $args ?? array() );
$settings_path = 'profile.php#activitypub-notifications';
if ( Actors::BLOG_USER_ID === $args['user_id'] ) {
$settings_path = 'options-general.php?page=activitypub&tab=blog-profile#activitypub-notifications';
}
?>
<div class="footer">
<p><?php esc_html_e( 'You are receiving this emails because of your ActivityPub plugin settings.', 'activitypub' ); ?></p>
<p>
<a href="<?php echo esc_url( admin_url( $settings_path ) ); ?>">
<?php esc_html_e( 'Manage notification settings', 'activitypub' ); ?>
</a>
</p>
</div>
</div><!-- .container -->

View File

@ -0,0 +1,60 @@
<?php
/**
* ActivityPub E-Mail template header.
*
* @package Activitypub
*/
?>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #222;
background-color: #ffffff;
margin: 0;
padding: 0;
}
@media only screen and (max-width: 599px) {
body {
background-color: #f9f9f9 !important;
}
}
.container {
max-width: 600px;
margin: 20px auto;
padding: 20px;
background-color: #f9f9f9;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
@media only screen and (max-width: 599px) {
.container {
border-radius: 0 !important;
box-shadow: none !important;
margin: 0 !important;
}
}
h1 {
font-size: 20px;
margin-bottom: 16px;
}
a.button {
display: inline-block;
background-color: #2271b1;
color: #ffffff !important;
text-decoration: none;
padding: 10px 16px;
border-radius: 4px;
font-weight: bold;
margin: 10px 0;
}
.footer {
font-size: 13px;
color: #777;
margin-top: 30px;
}
</style>
<div class="container">