modified file upgrade-temp-backup

This commit is contained in:
2026-07-28 15:05:31 +00:00
committed by Gitium
parent 64be23dffb
commit dd0a8b69b1
486 changed files with 123520 additions and 0 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.1);
}
.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,68 @@
<?php
/**
* ActivityPub New Mention E-Mail template with styles.
*
* @package Activitypub
*/
use Activitypub\Collection\Actors;
use Activitypub\Embed;
use function Activitypub\site_supports_blocks;
/* @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>
<?php if ( site_supports_blocks() && ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) : ?>
<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 endif; ?>
<?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">

View File

@ -0,0 +1,219 @@
<?php
/**
* ActivityPub Stats Report E-Mail template.
*
* Used for both monthly and annual reports.
* All texts are passed via $args to keep the template logic-free.
*
* Expected $args keys:
* - title (string) The email heading.
* - intro (string) The intro paragraph.
* - closing (string) The closing paragraph.
* - supporter_text (string) The top supporter text (HTML allowed).
* - posts_count (int) Number of federated posts.
* - top_posts (array) Top posts with title, url, engagement_count.
* - top_multiplicator (array|null) Top supporter data.
* - followers_count (int) New followers gained.
* - followers_total (int) Total follower count.
* - followers_start (int) Followers at period start (annual only).
* - followers_end (int) Followers at period end (annual only).
* - followers_text (string) The follower detail text (HTML allowed).
* - most_active_month_name (string) Most active month (annual only).
* - {type}_count (int) Per-engagement-type counts.
*
* @package Activitypub
*/
use Activitypub\Statistics;
/* @var array $args Template arguments. */
$args = wp_parse_args(
$args ?? array(),
array(
'title' => '',
'intro' => '',
'closing' => '',
'posts_count' => 0,
'followers_count' => 0,
'followers_total' => 0,
'followers_net_change' => null,
'followers_text' => '',
'most_active_month_name' => '',
'top_posts' => array(),
'top_multiplicator' => null,
'supporter_text' => '',
'user_id' => 0,
)
);
// Get comment types for dynamic stats display.
$comment_types = Statistics::get_comment_types_for_stats();
// Load header.
require __DIR__ . '/parts/header.php';
?>
<style>
.stats-grid {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin: 20px 0;
}
.stats-grid .stat {
flex: 1 1 calc(50% - 6px);
min-width: 100px;
background: #fff;
border-radius: 8px;
padding: 14px;
text-align: center;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.stats-grid .stat-value {
display: block;
font-size: 28px;
font-weight: 700;
color: #1d2327;
line-height: 1.2;
}
.stats-grid .stat-label {
display: block;
font-size: 13px;
color: #50575e;
margin-top: 4px;
}
.info-box {
background: #fff;
border-radius: 8px;
padding: 16px;
margin: 20px 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.info-box h3 {
margin: 0 0 8px;
font-size: 16px;
color: #1d2327;
}
.info-box p {
margin: 0;
font-size: 14px;
color: #50575e;
}
.follower-change {
font-size: 24px;
font-weight: 700;
color: #00a32a;
margin: 4px 0 8px;
}
.follower-change.negative {
color: #d63638;
}
.top-posts ol {
margin: 8px 0 0;
padding-left: 20px;
}
.top-posts li {
margin: 6px 0;
font-size: 14px;
}
.top-posts a {
color: #2271b1;
text-decoration: none;
}
.top-posts .engagement {
font-size: 12px;
color: #50575e;
}
</style>
<h1><?php echo esc_html( $args['title'] ); ?></h1>
<p><?php echo esc_html( $args['intro'] ); ?></p>
<div class="stats-grid">
<div class="stat">
<span class="stat-value"><?php echo esc_html( number_format_i18n( $args['posts_count'] ) ); ?></span>
<span class="stat-label"><?php esc_html_e( 'Posts Federated', 'activitypub' ); ?></span>
</div>
<?php foreach ( $comment_types as $slug => $type_info ) : ?>
<div class="stat">
<span class="stat-value"><?php echo esc_html( number_format_i18n( $args[ $slug . '_count' ] ?? 0 ) ); ?></span>
<span class="stat-label"><?php echo esc_html( $type_info['label'] ); ?></span>
</div>
<?php endforeach; ?>
</div>
<?php if ( ! empty( $args['most_active_month_name'] ) ) : ?>
<div class="info-box">
<h3><?php esc_html_e( 'Most Active Month', 'activitypub' ); ?></h3>
<p><?php echo esc_html( $args['most_active_month_name'] ); ?></p>
</div>
<?php endif; ?>
<?php
$net_change = $args['followers_net_change'] ?? $args['followers_count'] ?? null;
if ( null !== $net_change ) :
$change_class = $net_change >= 0 ? '' : 'negative';
$change_sign = $net_change >= 0 ? '+' : '';
?>
<div class="info-box">
<h3><?php esc_html_e( 'Follower Growth', 'activitypub' ); ?></h3>
<p class="follower-change <?php echo esc_attr( $change_class ); ?>">
<?php echo esc_html( $change_sign . number_format_i18n( $net_change ) ); ?>
</p>
<?php if ( ! empty( $args['followers_text'] ) ) : ?>
<p><?php echo wp_kses( $args['followers_text'], array( 'strong' => array() ) ); ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( ! empty( $args['top_multiplicator'] ) && ! empty( $args['supporter_text'] ) ) : ?>
<div class="info-box">
<h3><?php esc_html_e( 'Top Supporter', 'activitypub' ); ?></h3>
<p>
<?php
echo wp_kses(
$args['supporter_text'],
array(
'strong' => array(),
'a' => array( 'href' => array() ),
)
);
?>
</p>
</div>
<?php endif; ?>
<?php if ( ! empty( $args['top_posts'] ) ) : ?>
<div class="info-box top-posts">
<h3><?php esc_html_e( 'Top Posts', 'activitypub' ); ?></h3>
<ol>
<?php foreach ( $args['top_posts'] as $top_post ) : ?>
<li>
<a href="<?php echo esc_url( $top_post['url'] ); ?>"><?php echo esc_html( $top_post['title'] ?: __( '(no title)', 'activitypub' ) ); ?></a>
<span class="engagement">
<?php
printf(
/* translators: %s: engagement count */
esc_html__( '(%s engagements)', 'activitypub' ),
esc_html( number_format_i18n( $top_post['engagement_count'] ?? 0 ) )
);
?>
</span>
</li>
<?php endforeach; ?>
</ol>
</div>
<?php endif; ?>
<p><?php echo esc_html( $args['closing'] ?? '' ); ?></p>
<?php
/**
* Fires at the bottom of the stats report email.
*
* @param array $args The stats data.
*/
do_action( 'activitypub_stats_report_email', $args );
// Load footer.
require __DIR__ . '/parts/footer.php';