updated plugin ActivityPub
version 5.8.0
This commit is contained in:
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$object = \Activitypub\Query::get_instance()->get_activitypub_object();
|
||||
|
||||
/**
|
||||
* Fires before an ActivityPub object is generated and sent to the client.
|
||||
*
|
||||
* @param object $object The ActivityPub object.
|
||||
*/
|
||||
\do_action( 'activitypub_json_pre', $object );
|
||||
|
||||
\header( 'Content-Type: application/activity+json' );
|
||||
echo $object->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Fires after an ActivityPub object is generated and sent to the client.
|
||||
*
|
||||
* @param object $object The ActivityPub object.
|
||||
*/
|
||||
\do_action( 'activitypub_json_post', $object );
|
@ -6,15 +6,7 @@
|
||||
*/
|
||||
|
||||
/* @var array $args Template arguments. */
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
'welcome' => '',
|
||||
'settings' => '',
|
||||
'blog-profile' => '',
|
||||
'followers' => '',
|
||||
)
|
||||
);
|
||||
$args = wp_parse_args( $args ?? array() );
|
||||
?>
|
||||
<div class="activitypub-settings-header">
|
||||
<div class="activitypub-settings-title-section">
|
||||
@ -22,25 +14,21 @@ $args = wp_parse_args(
|
||||
</div>
|
||||
|
||||
<nav class="activitypub-settings-tabs-wrapper" aria-label="<?php \esc_attr_e( 'Secondary menu', 'activitypub' ); ?>">
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>">
|
||||
<?php \esc_html_e( 'Welcome', 'activitypub' ); ?>
|
||||
</a>
|
||||
<?php
|
||||
foreach ( $args['tabs'] as $slug => $label ) :
|
||||
$url = add_query_arg(
|
||||
array( 'tab' => 'welcome' !== $slug ? $slug : false ),
|
||||
\admin_url( 'options-general.php?page=activitypub' )
|
||||
);
|
||||
?>
|
||||
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub&tab=settings' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>">
|
||||
<?php \esc_html_e( 'Settings', 'activitypub' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo \esc_url( $url ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args[ $slug ] ); ?>">
|
||||
<?php echo \esc_html( $label ); ?>
|
||||
</a>
|
||||
|
||||
<?php if ( ! \Activitypub\is_user_disabled( \Activitypub\Collection\Users::BLOG_USER_ID ) ) : ?>
|
||||
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub&tab=blog-profile' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['blog-profile'] ); ?>">
|
||||
<?php \esc_html_e( 'Blog-Profile', 'activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo \esc_url( admin_url( 'options-general.php?page=activitypub&tab=followers' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['followers'] ); ?>">
|
||||
<?php \esc_html_e( 'Followers', 'activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</nav>
|
||||
</div>
|
||||
<hr class="wp-header-end">
|
||||
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub settings template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="activitypub-settings activitypub-settings-page hide-if-no-js">
|
||||
<form method="post" action="options.php">
|
||||
<?php \settings_fields( 'activitypub_advanced' ); ?>
|
||||
<?php \do_settings_sections( 'activitypub_advanced_settings' ); ?>
|
||||
<?php \submit_button(); ?>
|
||||
</form>
|
||||
</div>
|
@ -5,14 +5,6 @@
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'followers' => 'active',
|
||||
)
|
||||
);
|
||||
|
||||
$table = new \Activitypub\Table\Followers();
|
||||
$follower_count = $table->get_user_count();
|
||||
// translators: The follower count.
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub Blog JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$user = new \Activitypub\Model\Blog();
|
||||
|
||||
/**
|
||||
* Action triggered prior to the ActivityPub profile being created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_pre', $user->get__id() );
|
||||
|
||||
\header( 'Content-Type: application/activity+json' );
|
||||
echo $user->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_post', $user->get__id() );
|
@ -5,186 +5,12 @@
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'blog-profile' => 'active',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="activitypub-settings activitypub-settings-page hide-if-no-js">
|
||||
<form method="post" action="options.php">
|
||||
<?php \settings_fields( 'activitypub_blog' ); ?>
|
||||
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Blog-Profile', 'activitypub' ); ?></h3>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Manage Avatar', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ( \has_site_icon() ) : ?>
|
||||
<p><img src="<?php echo esc_url( get_site_icon_url( '50' ) ); ?>" /></p>
|
||||
<?php endif; ?>
|
||||
<p class="description">
|
||||
<?php
|
||||
echo \wp_kses(
|
||||
\sprintf(
|
||||
// translators: %s is a URL.
|
||||
\__( 'The ActivityPub plugin uses the WordPress Site Icon as Avatar for the Blog-Profile, you can change the Site Icon in the "<a href="%s">General Settings</a>" of WordPress.', 'activitypub' ),
|
||||
\esc_url( \admin_url( 'options-general.php' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<?php \esc_html_e( 'Manage Header Image', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$classes_for_upload_button = 'button upload-button button-add-media button-add-header-image';
|
||||
$classes_for_update_button = 'button';
|
||||
$classes_for_wrapper = '';
|
||||
|
||||
if ( (int) get_option( 'activitypub_header_image', 0 ) ) :
|
||||
$classes_for_wrapper .= ' has-header-image';
|
||||
$classes_for_button = $classes_for_update_button;
|
||||
$classes_for_button_on_change = $classes_for_upload_button;
|
||||
else :
|
||||
$classes_for_wrapper .= ' hidden';
|
||||
$classes_for_button = $classes_for_upload_button;
|
||||
$classes_for_button_on_change = $classes_for_update_button;
|
||||
endif;
|
||||
?>
|
||||
<div id="activitypub-header-image-preview-wrapper" class='<?php echo esc_attr( $classes_for_wrapper ); ?>'>
|
||||
<img id='activitypub-header-image-preview' src='<?php echo esc_url( wp_get_attachment_url( get_option( 'activitypub_header_image' ) ) ); ?>' style="max-width: 100%;" />
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
id="activitypub-choose-from-library-button"
|
||||
type="button"
|
||||
class="<?php echo esc_attr( $classes_for_button ); ?>"
|
||||
data-alt-classes="<?php echo esc_attr( $classes_for_button_on_change ); ?>"
|
||||
data-choose-text="<?php esc_attr_e( 'Choose a Header Image', 'activitypub' ); ?>"
|
||||
data-update-text="<?php esc_attr_e( 'Change Header Icon', 'activitypub' ); ?>"
|
||||
data-update="<?php esc_attr_e( 'Set as Header Image', 'activitypub' ); ?>"
|
||||
data-state="<?php echo esc_attr( (int) get_option( 'activitypub_header_image', 0 ) ); ?>">
|
||||
<?php if ( (int) get_option( 'activitypub_header_image', 0 ) ) : ?>
|
||||
<?php esc_html_e( 'Change Header Image', 'activitypub' ); ?>
|
||||
<?php else : ?>
|
||||
<?php esc_html_e( 'Choose a Header Image', 'activitypub' ); ?>
|
||||
<?php endif; ?>
|
||||
</button>
|
||||
<button
|
||||
id="activitypub-remove-header-image"
|
||||
type="button"
|
||||
<?php echo (int) get_option( 'activitypub_header_image', 0 ) ? 'class="button button-secondary reset"' : 'class="button button-secondary reset hidden"'; ?>>
|
||||
<?php esc_html_e( 'Remove Header Image', 'activitypub' ); ?>
|
||||
</button>
|
||||
<input type='hidden' name='activitypub_header_image' id='activitypub_header_image' value='<?php echo esc_attr( get_option( 'activitypub_header_image' ) ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Change profile ID', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label for="activitypub_blog_identifier">
|
||||
<input class="blog-user-identifier" name="activitypub_blog_identifier" id="activitypub_blog_identifier" type="text" value="<?php echo esc_attr( \get_option( 'activitypub_blog_identifier', \Activitypub\Model\Blog::get_default_username() ) ); ?>" />
|
||||
@<?php echo esc_html( \wp_parse_url( \home_url(), PHP_URL_HOST ) ); ?>
|
||||
</label>
|
||||
<p class="description">
|
||||
<?php \esc_html_e( 'This profile name will federate all posts written on your blog, regardless of the author who posted it.', 'activitypub' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<strong>
|
||||
<?php \esc_html_e( 'Please avoid using an existing author’s name as the blog profile ID. Fediverse platforms might use caching and this could break the functionality completely.', 'activitypub' ); ?>
|
||||
</strong>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Change Description', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<label for="activitypub_blog_description">
|
||||
<textarea
|
||||
class="blog-user-description large-text"
|
||||
rows="5"
|
||||
name="activitypub_blog_description"
|
||||
id="activitypub_blog_description"
|
||||
placeholder="<?php echo esc_attr( \get_bloginfo( 'description' ) ); ?>"
|
||||
><?php echo \esc_textarea( \get_option( 'activitypub_blog_description' ) ); ?></textarea>
|
||||
</label>
|
||||
<p class="description">
|
||||
<?php \esc_html_e( 'By default the ActivityPub plugin uses the WordPress tagline as a description for the blog profile.', 'activitypub' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr scope="row">
|
||||
<th>
|
||||
<label><?php \esc_html_e( 'Extra Fields', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<p class="description">
|
||||
<?php
|
||||
\esc_html_e( 'Your homepage, social profiles, pronouns, age, anything you want.', 'activitypub' );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<table class="widefat striped activitypub-extra-fields" role="presentation" style="margin: 15px 0;">
|
||||
<?php
|
||||
$extra_fields = \Activitypub\Collection\Extra_Fields::get_actor_fields( \Activitypub\Collection\Users::BLOG_USER_ID );
|
||||
|
||||
if ( empty( $extra_fields ) ) :
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php \esc_html_e( 'No extra fields found.', 'activitypub' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
foreach ( $extra_fields as $extra_field ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo \esc_html( $extra_field->post_title ); ?></td>
|
||||
<td><?php echo \wp_kses_post( \get_the_excerpt( $extra_field ) ); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo \esc_url( \get_edit_post_link( $extra_field->ID ) ); ?>" class="button">
|
||||
<?php \esc_html_e( 'Edit', 'activitypub' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=ap_extrafield_blog' ) ); ?>" class="button">
|
||||
<?php esc_html_e( 'Add new', 'activitypub' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=ap_extrafield_blog' ) ); ?>">
|
||||
<?php esc_html_e( 'Manage all', 'activitypub' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php \do_settings_sections( 'activitypub_blog_profile' ); ?>
|
||||
|
||||
<?php \do_settings_sections( 'activitypub_blog_settings' ); ?>
|
||||
<?php \submit_button(); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub Comment JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$comment = \get_comment( \get_query_var( 'c', null ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $comment );
|
||||
|
||||
if ( \is_wp_error( $transformer ) ) {
|
||||
\wp_die(
|
||||
\esc_html( $transformer->get_error_message() ),
|
||||
404
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action triggered prior to the ActivityPub profile being created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_comment_pre' );
|
||||
|
||||
\header( 'Content-Type: application/activity+json' );
|
||||
echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_comment_post' );
|
49
wp-content/plugins/activitypub/templates/emails/new-dm.php
Normal file
49
wp-content/plugins/activitypub/templates/emails/new-dm.php
Normal 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’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’s reaching out! Your blog just got a direct message from %s on the Fediverse. Here’s what they said:', 'activitypub' );
|
||||
else :
|
||||
/* translators: %s: The name of the person who sent the message. */
|
||||
$message = __( 'Looks like someone’s reaching out! You just got a direct message from %s on the Fediverse. Here’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';
|
159
wp-content/plugins/activitypub/templates/emails/new-follower.php
Normal file
159
wp-content/plugins/activitypub/templates/emails/new-follower.php
Normal 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’s newest follower, %s. Here’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’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';
|
@ -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’s talking about your blog! It was just mentioned by %s in a post on the Fediverse. Here’s what they said:', 'activitypub' );
|
||||
else :
|
||||
/* translators: %s: The name of the person who mentioned the user. */
|
||||
$message = __( 'Looks like someone’s talking about you! You were just mentioned by %s in a post on the Fediverse. Here’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';
|
@ -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 -->
|
@ -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">
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub Post JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$post = \get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $post );
|
||||
|
||||
if ( \is_wp_error( $transformer ) ) {
|
||||
\wp_die(
|
||||
esc_html( $transformer->get_error_message() ),
|
||||
404
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action triggered prior to the ActivityPub profile being created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_post_pre' );
|
||||
|
||||
\header( 'Content-Type: application/activity+json' );
|
||||
echo $transformer->to_object()->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_post_post' );
|
265
wp-content/plugins/activitypub/templates/post-preview.php
Normal file
265
wp-content/plugins/activitypub/templates/post-preview.php
Normal file
@ -0,0 +1,265 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub Post JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$post = \get_post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$transformer = \Activitypub\Transformer\Factory::get_transformer( $post );
|
||||
|
||||
if ( \is_wp_error( $transformer ) ) {
|
||||
\wp_die(
|
||||
esc_html( $transformer->get_error_message() ),
|
||||
404
|
||||
);
|
||||
}
|
||||
|
||||
$object = $transformer->to_object();
|
||||
$user = $transformer->get_actor_object();
|
||||
|
||||
?>
|
||||
<DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo esc_html( $object->get_name() ); ?></title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.columns {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin: 0 auto;
|
||||
max-width: 1200px;
|
||||
}
|
||||
.sidebar {
|
||||
flex: 1;
|
||||
padding: 1em;
|
||||
max-width: 285px;
|
||||
}
|
||||
.sidebar input[type="search"],
|
||||
.sidebar textarea {
|
||||
background-color: #f6f6f6;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
display: block;
|
||||
font-size: 1em;
|
||||
margin-bottom: 1em;
|
||||
padding: 0.5em;
|
||||
width: 100%;
|
||||
}
|
||||
.sidebar > div,
|
||||
main address {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
margin-bottom: 1em;
|
||||
font-style: normal;
|
||||
}
|
||||
main address .name,
|
||||
main address .webfinger {
|
||||
color: #000;
|
||||
}
|
||||
.name {
|
||||
color: #ccc;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
.webfinger {
|
||||
color: #ccc;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
address img, .sidebar .fake-image {
|
||||
border-radius: 8px;
|
||||
margin-right: 1em;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background-color: #333;
|
||||
}
|
||||
main {
|
||||
flex: 1;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
margin: 1em;
|
||||
max-width: 600px;
|
||||
}
|
||||
main p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.sidebar h1 {
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 0;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
background-color: #6364ff;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
}
|
||||
hr {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
flex: 0 0 auto;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.sidebar ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
.sidebar ul li {
|
||||
padding: 5px;
|
||||
color: #ccc;
|
||||
}
|
||||
main article {
|
||||
padding: 1em;
|
||||
}
|
||||
main .content {
|
||||
margin: 1em 0;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
main .content h2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
main .attachments {
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: auto;
|
||||
margin: 20px 0;
|
||||
min-height: 64px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
main .attachments img {
|
||||
max-width: 100%;
|
||||
height: 100%;
|
||||
margin: 1em 0;
|
||||
display: inline-block;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
main .tags a {
|
||||
background-color: #f6f6f6;
|
||||
border-radius: 4px;
|
||||
color: #333;
|
||||
display: inline-block;
|
||||
margin-right: 0.5em;
|
||||
padding: 0.5em;
|
||||
text-decoration: none;
|
||||
}
|
||||
main .tags a:hover {
|
||||
background-color: #e6e6e6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
main .column-header {
|
||||
font-size: 1.5em;
|
||||
margin: 0;
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="columns">
|
||||
<aside class="sidebar">
|
||||
<input type="search" disabled="disabled" placeholder="<?php esc_html_e( 'Search', 'activitypub' ); ?>" />
|
||||
<div>
|
||||
<div class="fake-image"></div>
|
||||
<div>
|
||||
<div class="name">
|
||||
████ ██████
|
||||
</div>
|
||||
<div class="webfinger">
|
||||
@█████@██████
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<textarea rows="10" cols="50" disabled="disabled" placeholder="<?php esc_html_e( 'What\'s up', 'activitypub' ); ?>"></textarea>
|
||||
</aside>
|
||||
<main>
|
||||
<h1 class="column-header">
|
||||
Home
|
||||
</h1>
|
||||
<article>
|
||||
<address>
|
||||
<img src="<?php echo esc_url( $user->get_icon()['url'] ); ?>" alt="<?php echo esc_attr( $user->get_name() ); ?>" />
|
||||
<div>
|
||||
<div class="name">
|
||||
<?php echo esc_html( $user->get_name() ); ?>
|
||||
</div>
|
||||
<div class="webfinger">
|
||||
<?php echo esc_html( '@' . $user->get_webfinger() ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</address>
|
||||
<div class="content">
|
||||
<?php if ( 'Article' === $object->get_type() && $object->get_name() ) : ?>
|
||||
<h2><?php echo esc_html( $object->get_name() ); ?></h2>
|
||||
<?php endif; ?>
|
||||
<?php echo wp_kses( 'Article' === $object->get_type() ? $object->get_summary() : $object->get_content(), ACTIVITYPUB_MASTODON_HTML_SANITIZER ); ?>
|
||||
</div>
|
||||
<?php if ( $object->get_attachment() ) : ?>
|
||||
<div class="attachments">
|
||||
<?php foreach ( $object->get_attachment() as $attachment ) : ?>
|
||||
<?php if ( 'Image' === $attachment['type'] ) : ?>
|
||||
<img src="<?php echo esc_url( $attachment['url'] ); ?>" alt="<?php echo esc_attr( $attachment['name'] ?? '' ); ?>" />
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( $object->get_tag() ) : ?>
|
||||
<div class="tags">
|
||||
<?php foreach ( $object->get_tag() as $hashtag ) : ?>
|
||||
<?php if ( 'Hashtag' === $hashtag['type'] ) : ?>
|
||||
<a href="<?php echo esc_url( $hashtag['href'] ); ?>"><?php echo esc_html( $hashtag['name'] ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</main>
|
||||
<aside class="sidebar">
|
||||
<h1>⁂ Fediverse</h1>
|
||||
<ul>
|
||||
<li>████████</li>
|
||||
<li>███████████</li>
|
||||
<li>██████████</li>
|
||||
<li>█████████</li>
|
||||
<li>███████</li>
|
||||
<li>████████</li>
|
||||
<li>████████████</li>
|
||||
<li>████████████</li>
|
||||
<li>██████████</li>
|
||||
<li>████████████</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<ul>
|
||||
<li>███████████</li>
|
||||
<li>██████████████</li>
|
||||
<li>█████████</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<ul>
|
||||
<li>██████████</li>
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
81
wp-content/plugins/activitypub/templates/reply-embed.php
Normal file
81
wp-content/plugins/activitypub/templates/reply-embed.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Reply embed template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
/* @var array $args Template arguments. */
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
'avatar_url' => '',
|
||||
'author_name' => '',
|
||||
'author_url' => '',
|
||||
'title' => '',
|
||||
'content' => '',
|
||||
'image' => '',
|
||||
'published' => '',
|
||||
'url' => '',
|
||||
'boosts' => null,
|
||||
'favorites' => null,
|
||||
'webfinger' => '',
|
||||
)
|
||||
);
|
||||
|
||||
\wp_enqueue_style( 'activitypub-embed', ACTIVITYPUB_PLUGIN_URL . 'assets/css/activitypub-embed.css', array(), ACTIVITYPUB_PLUGIN_VERSION );
|
||||
?>
|
||||
|
||||
<div class="activitypub-embed u-in-reply-to h-cite">
|
||||
<div class="activitypub-embed-header p-author h-card">
|
||||
<?php if ( $args['avatar_url'] ) : ?>
|
||||
<img class="u-photo" src="<?php echo \esc_url( $args['avatar_url'] ); ?>" alt="" />
|
||||
<?php endif; ?>
|
||||
<div class="activitypub-embed-header-text">
|
||||
<h2 class="p-name"><?php echo \esc_html( $args['author_name'] ); ?></h2>
|
||||
<?php if ( $args['author_url'] ) : ?>
|
||||
<a href="<?php echo \esc_url( $args['author_url'] ); ?>" class="ap-account u-url"><?php echo \esc_html( $args['webfinger'] ?? $args['author_url'] ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="activitypub-embed-content">
|
||||
<?php if ( $args['title'] ) : ?>
|
||||
<h3 class="ap-title p-name"><?php echo \esc_html( $args['title'] ); ?></h3>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $args['content'] ) : ?>
|
||||
<div class="ap-subtitle p-summary e-content"><?php echo \wp_kses_post( $args['content'] ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $args['image'] ) : ?>
|
||||
<div class="ap-preview">
|
||||
<img class="u-photo u-featured" src="<?php echo \esc_url( $args['image'] ); ?>" alt="" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="activitypub-embed-meta">
|
||||
<?php if ( $args['published'] ) : ?>
|
||||
<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( \number_format_i18n( $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( \number_format_i18n( $args['favorites'] ) ) . '</strong>' );
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
@ -5,262 +5,12 @@
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'settings' => 'active',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="activitypub-settings activitypub-settings-page hide-if-no-js">
|
||||
<form method="post" action="options.php">
|
||||
<?php \settings_fields( 'activitypub' ); ?>
|
||||
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Profiles', 'activitypub' ); ?></h3>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Enable profiles by type', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" name="activitypub_enable_users" id="activitypub_enable_users" value="1" <?php echo \checked( '1', \get_option( 'activitypub_enable_users', '1' ) ); ?> />
|
||||
<?php \esc_html_e( 'Enable Author-Profiles', 'activitypub' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p class="description">
|
||||
<?php echo \wp_kses( \__( 'Every author on this blog (with the <code>activitypub</code> capability) gets their own ActivityPub profile.', 'activitypub' ), array( 'code' => array() ) ); ?>
|
||||
<?php // translators: %s is a URL. ?>
|
||||
<strong><?php echo \wp_kses( sprintf( \__( 'You can add/remove the capability in the <a href="%s">user settings.</a>', 'activitypub' ), admin_url( '/users.php' ) ), array( 'a' => array( 'href' => array() ) ) ); ?></strong>
|
||||
<?php echo \wp_kses( \__( 'Select all the users you want to update, choose the method from the drop-down list and click on the "Apply" button.', 'activitypub' ), array( 'code' => array() ) ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" name="activitypub_enable_blog_user" id="activitypub_enable_blog_user" value="1" <?php echo \checked( '1', \get_option( 'activitypub_enable_blog_user', '0' ) ); ?> />
|
||||
<?php \esc_html_e( 'Enable Blog-Profile', 'activitypub' ); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p class="description">
|
||||
<?php \esc_html_e( 'Your blog becomes an ActivityPub profile.', 'activitypub' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php \do_settings_fields( 'activitypub', 'user' ); ?>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Activities', 'activitypub' ); ?></h3>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Activity-Object-Type', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label for="activitypub_object_type_note">
|
||||
<input type="radio" name="activitypub_object_type" id="activitypub_object_type_note" value="note" <?php echo \checked( 'note', \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ); ?> />
|
||||
<?php \esc_html_e( 'Note (default)', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Should work with most platforms.', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input type="radio" name="activitypub_object_type" id="activitypub_object_type" value="wordpress-post-format" <?php echo \checked( 'wordpress-post-format', \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ); ?> />
|
||||
<?php \esc_html_e( 'WordPress Post-Format', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Maps the WordPress Post-Format to the ActivityPub Object Type.', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr <?php echo 'wordpress-post-format' === \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ? 'style="display: none"' : ''; ?>>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Post content', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p><strong><?php \esc_html_e( 'These settings only apply if you use the "Note" Object-Type setting above.', 'activitypub' ); ?></strong></p>
|
||||
<p>
|
||||
<label for="activitypub_post_content_type_title_link">
|
||||
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_title_link" value="title" <?php echo \checked( 'title', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> />
|
||||
<?php \esc_html_e( 'Title and link', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Only the title and a link.', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_post_content_type_excerpt">
|
||||
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_excerpt" value="excerpt" <?php echo \checked( 'excerpt', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> />
|
||||
<?php \esc_html_e( 'Excerpt', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'A content summary without markup (truncated if no excerpt is provided).', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_post_content_type_content">
|
||||
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_content" value="content" <?php echo \checked( 'content', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> />
|
||||
<?php \esc_html_e( 'Content (default)', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'The full content.', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub_post_content_type_custom">
|
||||
<input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_custom" value="custom" <?php echo \checked( 'custom', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> />
|
||||
<?php \esc_html_e( 'Custom', 'activitypub' ); ?>
|
||||
-
|
||||
<span class="description">
|
||||
<?php \esc_html_e( 'Use the text area below, to customize your activities.', 'activitypub' ); ?>
|
||||
</span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<textarea name="activitypub_custom_post_content" id="activitypub_custom_post_content" rows="10" cols="50" class="large-text" placeholder="<?php echo wp_kses( ACTIVITYPUB_CUSTOM_POST_CONTENT, 'post' ); ?>"><?php echo esc_textarea( wp_kses( \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ), 'post' ) ); ?></textarea>
|
||||
<details>
|
||||
<summary><?php esc_html_e( 'See a list of ActivityPub Template Tags.', 'activitypub' ); ?></summary>
|
||||
<div class="description">
|
||||
<ul>
|
||||
<li><code>[ap_title]</code> - <?php \esc_html_e( 'The post’s title.', 'activitypub' ); ?></li>
|
||||
<li><code>[ap_content]</code> - <?php \esc_html_e( 'The post’s content.', 'activitypub' ); ?></li>
|
||||
<li><code>[ap_excerpt]</code> - <?php \esc_html_e( 'The post’s excerpt (may be truncated).', 'activitypub' ); ?></li>
|
||||
<li><code>[ap_permalink]</code> - <?php \esc_html_e( 'The post’s permalink.', 'activitypub' ); ?></li>
|
||||
<li><code>[ap_shortlink]</code> - <?php echo \wp_kses( \__( 'The pos’s shortlink. I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>.', 'activitypub' ), 'default' ); ?></li>
|
||||
<li><code>[ap_hashtags]</code> - <?php \esc_html_e( 'The post’s tags as hashtags.', 'activitypub' ); ?></li>
|
||||
</ul>
|
||||
<p><?php \esc_html_e( 'You can find the full list with all possible attributes in the help section on the top-right of the screen.', 'activitypub' ); ?></p>
|
||||
</div>
|
||||
</details>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Media attachments', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<input value="<?php echo esc_attr( \get_option( 'activitypub_max_image_attachments', ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS ) ); ?>" name="activitypub_max_image_attachments" id="activitypub_max_image_attachments" type="number" min="0" />
|
||||
<p class="description">
|
||||
<?php
|
||||
echo \wp_kses(
|
||||
\sprintf(
|
||||
// translators: %s is a number.
|
||||
\__( 'The number of media (images, audio, video) to attach to posts. Default: <code>%s</code>', 'activitypub' ),
|
||||
\esc_html( ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="description">
|
||||
<em>
|
||||
<?php
|
||||
esc_html_e( 'Note: audio and video attachments are only supported from Block Editor.', 'activitypub' );
|
||||
?>
|
||||
</em>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php \esc_html_e( 'Supported post types', 'activitypub' ); ?></th>
|
||||
<td>
|
||||
<fieldset>
|
||||
<?php \esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
$post_types = \get_post_types( array( 'public' => true ), 'objects' );
|
||||
$supported_post_types = (array) \get_option( 'activitypub_support_post_types', array( 'post' ) );
|
||||
|
||||
foreach ( $post_types as $_post_type ) :
|
||||
?>
|
||||
<li>
|
||||
<input type="checkbox" id="activitypub_support_post_type_<?php echo \esc_attr( $_post_type->name ); ?>" name="activitypub_support_post_types[]" value="<?php echo \esc_attr( $_post_type->name ); ?>" <?php echo \checked( \in_array( $_post_type->name, $supported_post_types, true ) ); ?> />
|
||||
<label for="activitypub_support_post_type_<?php echo \esc_attr( $_post_type->name ); ?>"><?php echo \esc_html( $_post_type->label ); ?></label>
|
||||
<span class="description">
|
||||
<?php echo \esc_html( \Activitypub\get_post_type_description( $_post_type ) ); ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Hashtags', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label><input type="checkbox" name="activitypub_use_hashtags" id="activitypub_use_hashtags" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_hashtags', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag link.', 'activitypub' ), 'default' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php \do_settings_fields( 'activitypub', 'activity' ); ?>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'General', 'activitypub' ); ?></h3>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'OpenGraph', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<label><input type="checkbox" name="activitypub_use_opengraph" id="activitypub_use_opengraph" value="1" <?php echo \checked( '1', \get_option( 'activitypub_use_opengraph', '1' ) ); ?> /> <?php echo wp_kses( \__( 'Automatically add <code><meta name="fediverse:creator" /></code> tags for Authors and the Blog-User. You can read more about the feature on the <a href="https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/" target="_blank">Mastodon Blog</a>.', 'activitypub' ), 'post' ); ?></label>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php \esc_html_e( 'Blocklist', 'activitypub' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<?php
|
||||
echo \wp_kses(
|
||||
\sprintf(
|
||||
// translators: %s is a URL.
|
||||
\__( 'To block servers, add the host of the server to the "<a href="%s">Disallowed Comment Keys</a>" list.', 'activitypub' ),
|
||||
\esc_url( \admin_url( 'options-discussion.php#disallowed_keys' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php \do_settings_fields( 'activitypub', 'general' ); ?>
|
||||
<?php \do_settings_fields( 'activitypub', 'server' ); ?>
|
||||
</div>
|
||||
<?php \do_settings_sections( 'activitypub' ); ?>
|
||||
|
||||
<?php \do_settings_sections( 'activitypub_settings' ); ?>
|
||||
<?php \submit_button(); ?>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@
|
||||
?>
|
||||
|
||||
<div class="card activitypub" id="activitypub">
|
||||
<h2><?php esc_html_e( '⁂ Fediverse Bookmarklet', 'activitypub' ); ?></h2>
|
||||
<h2><?php esc_html_e( 'Fediverse Bookmarklet ⁂', 'activitypub' ); ?></h2>
|
||||
<p>
|
||||
<?php esc_html_e( 'This lightweight bookmarklet makes it simple to reply to content on any webpage that supports ActivityPub, enhancing your interaction on the fediverse.', 'activitypub' ); ?>
|
||||
</p>
|
||||
@ -16,7 +16,7 @@
|
||||
<h3><?php esc_html_e( 'Install Bookmarklet', 'activitypub' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Drag and drop this button to your browser’s bookmark bar or save this bookmarklet to reply to posts on other websites from your blog! When visiting a post on another site, click the bookmarklet to start a reply.', 'activitypub' ); ?></p>
|
||||
<p class="activitypub-bookmarklet-wrapper">
|
||||
<a class="activitypub-bookmarklet button" onclick="return false;" href="<?php echo esc_url( \Activitypub\get_reply_intent_uri() ); ?>" style="cursor: grab;">
|
||||
<a class="activitypub-bookmarklet button" onclick="return false;" href="<?php echo esc_attr( \Activitypub\get_reply_intent_js() ); ?>" style="cursor: grab;">
|
||||
<?php // translators: The host (domain) of the Blog. ?>
|
||||
<?php printf( esc_html__( 'Reply from %s', 'activitypub' ), esc_attr( \wp_parse_url( \home_url(), PHP_URL_HOST ) ) ); ?>
|
||||
</a>
|
||||
@ -26,7 +26,7 @@
|
||||
<?php esc_html_e( 'Or copy the following code and create a new bookmark. Paste the code into the new bookmark’s URL field.', 'activitypub' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<textarea id="activitypub-bookmarklet-code" class="large-text activitypub-code" rows="5" readonly="readonly" aria-labelledby="activitypub-code-desc"><?php echo esc_textarea( \Activitypub\get_reply_intent_uri() ); ?></textarea>
|
||||
<textarea id="activitypub-bookmarklet-code" class="large-text activitypub-code" rows="5" readonly="readonly" aria-labelledby="activitypub-code-desc"><?php echo esc_textarea( \Activitypub\get_reply_intent_js() ); ?></textarea>
|
||||
</p>
|
||||
<p><span class="dashicons dashicons-clipboard"></span> <a href="javascript:;" class="copy-activitypub-bookmarklet-code" style="cursor: copy;"><?php esc_html_e( 'Copy to clipboard', 'activitypub' ); ?></a></p>
|
||||
</div>
|
||||
@ -68,6 +68,10 @@
|
||||
<td>in_reply_to</td>
|
||||
<td><?php esc_html_e( 'The URL of the content you want to reply to.', 'activitypub' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>post_type</td>
|
||||
<td><?php esc_html_e( 'The Post-Type you want to use for replies.', 'activitypub' ); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><?php esc_html_e( 'There might be more query parameters in the future.', 'activitypub' ); ?></p>
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub User JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$user = \Activitypub\Collection\Users::get_by_id( \get_the_author_meta( 'ID' ) );
|
||||
|
||||
/**
|
||||
* Action triggered prior to the ActivityPub profile being created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_pre', $user->get__id() );
|
||||
|
||||
\header( 'Content-Type: application/activity+json' );
|
||||
echo $user->to_json(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_post', $user->get__id() );
|
@ -1,140 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ActivityPub User Settings template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
/* @var array $args Template arguments. */
|
||||
$args = wp_parse_args( $args, array( 'description' => '' ) );
|
||||
|
||||
$user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
||||
<h2 id="activitypub"><?php \esc_html_e( 'ActivityPub', 'activitypub' ); ?></h2>
|
||||
|
||||
<p><?php esc_html_e( 'Define what others can see on your public Fediverse profile and next to your posts. With a profile picture and a fully completed profile, you are more likely to gain interactions and followers.', 'activitypub' ); ?></p>
|
||||
|
||||
<p><?php esc_html_e( 'The ActivityPub plugin tries to take as much information as possible from your profile settings. However, the following settings are not supported by WordPress or should be adjusted independently of the WordPress settings.', 'activitypub' ); ?></p>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label><?php \esc_html_e( 'Profile URL', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<p>
|
||||
<code><?php echo \esc_html( $user->get_webfinger() ); ?></code> or
|
||||
<code><?php echo \esc_url( $user->get_url() ); ?></code>
|
||||
</p>
|
||||
<?php // translators: the webfinger resource. ?>
|
||||
<p class="description"><?php \printf( \esc_html__( 'Follow "@%s" by searching for it on Mastodon, Friendica, etc.', 'activitypub' ), \esc_html( $user->get_webfinger() ) ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="activitypub-description-wrap">
|
||||
<th>
|
||||
<label for="activitypub_description"><?php \esc_html_e( 'Biography', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<textarea name="activitypub_description" id="activitypub_description" rows="5" cols="30" placeholder="<?php echo \esc_attr( get_user_meta( \get_current_user_id(), 'description', true ) ); ?>"><?php echo \esc_html( $args['description'] ); ?></textarea>
|
||||
<p class="description"><?php \esc_html_e( 'If you wish to use different biographical info for the fediverse, enter your alternate bio here.', 'activitypub' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr scope="row">
|
||||
<th>
|
||||
<label><?php \esc_html_e( 'Header Image', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$classes_for_upload_button = 'button upload-button button-add-media button-add-header-image';
|
||||
$classes_for_update_button = 'button';
|
||||
$classes_for_wrapper = '';
|
||||
|
||||
$header_image = \get_user_option( 'activitypub_header_image', \get_current_user_id() );
|
||||
|
||||
if ( (int) $header_image ) :
|
||||
$classes_for_wrapper .= ' has-header-image';
|
||||
$classes_for_button = $classes_for_update_button;
|
||||
$classes_for_button_on_change = $classes_for_upload_button;
|
||||
else :
|
||||
$classes_for_wrapper .= ' hidden';
|
||||
$classes_for_button = $classes_for_upload_button;
|
||||
$classes_for_button_on_change = $classes_for_update_button;
|
||||
endif;
|
||||
?>
|
||||
<div id="activitypub-header-image-preview-wrapper" class='<?php echo esc_attr( $classes_for_wrapper ); ?>'>
|
||||
<img id='activitypub-header-image-preview' src='<?php echo \esc_url( \wp_get_attachment_url( $header_image ) ); ?>' style="max-width: 100%;" alt="" />
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
id="activitypub-choose-from-library-button"
|
||||
type="button"
|
||||
class="<?php echo \esc_attr( $classes_for_button ); ?>"
|
||||
data-alt-classes="<?php echo \esc_attr( $classes_for_button_on_change ); ?>"
|
||||
data-choose-text="<?php \esc_attr_e( 'Choose a Header Image', 'activitypub' ); ?>"
|
||||
data-update-text="<?php \esc_attr_e( 'Change Header Icon', 'activitypub' ); ?>"
|
||||
data-update="<?php \esc_attr_e( 'Set as Header Image', 'activitypub' ); ?>"
|
||||
<?php
|
||||
// We only need to constrain the user_id for users who can't edit others' posts.
|
||||
if ( ! \current_user_can( 'edit_others_posts' ) ) :
|
||||
printf( 'data-user-id="%s"', esc_attr( \get_current_user_id() ) );
|
||||
endif;
|
||||
?>
|
||||
data-state="<?php echo \esc_attr( (int) $header_image ); ?>">
|
||||
<?php if ( (int) $header_image ) : ?>
|
||||
<?php \esc_html_e( 'Change Header Image', 'activitypub' ); ?>
|
||||
<?php else : ?>
|
||||
<?php \esc_html_e( 'Choose a Header Image', 'activitypub' ); ?>
|
||||
<?php endif; ?>
|
||||
</button>
|
||||
<button
|
||||
id="activitypub-remove-header-image"
|
||||
type="button"
|
||||
<?php echo (int) $header_image ? 'class="button button-secondary reset"' : 'class="button button-secondary reset hidden"'; ?>>
|
||||
<?php esc_html_e( 'Remove Header Image', 'activitypub' ); ?>
|
||||
</button>
|
||||
<input type='hidden' name='activitypub_header_image' id='activitypub_header_image' value='<?php echo esc_attr( $header_image ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr scope="row">
|
||||
<th>
|
||||
<label><?php \esc_html_e( 'Extra Fields', 'activitypub' ); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<p class="description">
|
||||
<?php
|
||||
\esc_html_e( 'Your homepage, social profiles, pronouns, age, anything you want.', 'activitypub' );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<table class="widefat striped activitypub-extra-fields" role="presentation" style="margin: 15px 0;">
|
||||
<?php
|
||||
$extra_fields = \Activitypub\Collection\Extra_Fields::get_actor_fields( \get_current_user_id() );
|
||||
|
||||
foreach ( $extra_fields as $extra_field ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo \esc_html( $extra_field->post_title ); ?></td>
|
||||
<td><?php echo \wp_kses_post( \get_the_excerpt( $extra_field ) ); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo \esc_url( \get_edit_post_link( $extra_field->ID ) ); ?>" class="button">
|
||||
<?php \esc_html_e( 'Edit', 'activitypub' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=ap_extrafield' ) ); ?>" class="button">
|
||||
<?php esc_html_e( 'Add new', 'activitypub' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=ap_extrafield' ) ); ?>">
|
||||
<?php esc_html_e( 'Manage all', 'activitypub' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php wp_nonce_field( 'activitypub-user-settings', '_apnonce' ); ?>
|
@ -5,191 +5,8 @@
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'welcome' => 'active',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="activitypub-settings activitypub-welcome-page hide-if-no-js">
|
||||
<div class="box">
|
||||
<h2><?php \esc_html_e( 'Welcome', 'activitypub' ); ?></h2>
|
||||
|
||||
<p><?php echo wp_kses( \__( 'Enter the fediverse with <strong>ActivityPub</strong>, broadcasting your blog to a wider audience. Attract followers, deliver updates, and receive comments from a diverse user base on <strong>Mastodon</strong>, <strong>Friendica</strong>, <strong>Pleroma</strong>, <strong>Pixelfed</strong>, and all <strong>ActivityPub</strong>-compliant platforms.', 'activitypub' ), array( 'strong' => array() ) ); ?></p>
|
||||
</div>
|
||||
|
||||
<?php if ( \Activitypub\site_supports_blocks() ) : ?>
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Bookmarklet', 'activitypub' ); ?></h3>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
$bookmarklet_url = \Activitypub\get_reply_intent_uri();
|
||||
|
||||
/* translators: %s is the domain of this site */
|
||||
$reply_from_template = __( 'Reply from %s', 'activitypub' );
|
||||
$button = sprintf(
|
||||
'<a href="%s" class="button">%s</a>',
|
||||
esc_url( $bookmarklet_url ), // Need to escape quotes for the bookmarklet.
|
||||
sprintf( $reply_from_template, \wp_parse_url( \home_url(), PHP_URL_HOST ) )
|
||||
);
|
||||
/* translators: %s is where the button HTML will be rendered. */
|
||||
$button_and_explanation_template = \__(
|
||||
'%s Save this bookmarklet to reply to posts on other sites from your own blog! When visiting a post on another site, click the bookmarklet to start a reply.',
|
||||
'activitypub'
|
||||
);
|
||||
|
||||
printf( $button_and_explanation_template, $button ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
printf( ' <a href="%s">%s</a>', esc_url( \admin_url( 'tools.php#activitypub' ) ), esc_html__( 'For additional information, please visit the Tools page.', 'activitypub' ) );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( ! \Activitypub\is_user_disabled( \Activitypub\Collection\Users::BLOG_USER_ID ) ) :
|
||||
$blog_user = new \Activitypub\Model\Blog();
|
||||
?>
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Blog profile', 'activitypub' ); ?></h3>
|
||||
<p>
|
||||
<?php \esc_html_e( 'People can follow your blog by using:', 'activitypub' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub-blog-identifier"><?php \esc_html_e( 'Username', 'activitypub' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" class="regular-text" id="activitypub-blog-identifier" value="<?php echo \esc_attr( $blog_user->get_webfinger() ); ?>" readonly />
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub-blog-url"><?php \esc_html_e( 'Profile URL', 'activitypub' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" class="regular-text" id="activitypub-blog-url" value="<?php echo \esc_attr( $blog_user->get_url() ); ?>" readonly />
|
||||
</p>
|
||||
<p>
|
||||
<?php \esc_html_e( 'This blog profile will federate all posts written on your blog, regardless of the author who posted it.', 'activitypub' ); ?>
|
||||
<p>
|
||||
<p>
|
||||
<a href="<?php echo \esc_url_raw( \admin_url( '/options-general.php?page=activitypub&tab=blog-profile ' ) ); ?>">
|
||||
<?php \esc_html_e( 'Customize the blog profile', 'activitypub' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if ( ! \Activitypub\is_user_disabled( get_current_user_id() ) ) :
|
||||
$user = \Activitypub\Collection\Users::get_by_id( wp_get_current_user()->ID );
|
||||
?>
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Author profile', 'activitypub' ); ?></h3>
|
||||
<p>
|
||||
<?php \esc_html_e( 'People can follow you by using your author name:', 'activitypub' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub-user-identifier"><?php \esc_html_e( 'Username', 'activitypub' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" class="regular-text" id="activitypub-user-identifier" value="<?php echo \esc_attr( $user->get_webfinger() ); ?>" readonly />
|
||||
</p>
|
||||
<p>
|
||||
<label for="activitypub-user-url"><?php \esc_html_e( 'Profile URL', 'activitypub' ); ?></label>
|
||||
</p>
|
||||
<p>
|
||||
<input type="text" class="regular-text" id="activitypub-user-url" value="<?php echo \esc_attr( $user->get_url() ); ?>" readonly />
|
||||
</p>
|
||||
<p>
|
||||
<?php \esc_html_e( 'Authors who can not access this settings page will find their username on the "Edit Profile" page.', 'activitypub' ); ?>
|
||||
<p>
|
||||
<p>
|
||||
<a href="<?php echo \esc_url_raw( \admin_url( '/profile.php#activitypub' ) ); ?>">
|
||||
<?php \esc_html_e( 'Customize username on "Edit Profile" page.', 'activitypub' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="box">
|
||||
<h3><?php \esc_html_e( 'Troubleshooting', 'activitypub' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
\sprintf(
|
||||
/* translators: the placeholder is the Site Health URL */
|
||||
\__(
|
||||
'If you have problems using this plugin, please check the <a href="%s">Site Health</a> page to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).',
|
||||
'activitypub'
|
||||
),
|
||||
\esc_url( admin_url( 'site-health.php' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php if ( ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS ) : ?>
|
||||
<div class="box plugin-recommendations">
|
||||
<h3><?php \esc_html_e( 'Recommended Plugins', 'activitypub' ); ?></h3>
|
||||
|
||||
<p><?php \esc_html_e( 'ActivityPub works as is and there is no need for you to install additional plugins, nevertheless there are some plugins that extends the functionality of ActivityPub.', 'activitypub' ); ?></p>
|
||||
</div>
|
||||
<div class="activitypub-settings-accordion">
|
||||
<?php if ( ! \defined( 'FRIENDS_VERSION' ) ) : ?>
|
||||
<h4 class="activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="true" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-friends-plugin" type="button">
|
||||
<span class="title"><?php \esc_html_e( 'Following Others', 'activitypub' ); ?></span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="activitypub-settings-accordion-block-friends-plugin" class="activitypub-settings-accordion-panel plugin-card-friends">
|
||||
<p><?php \esc_html_e( 'To follow people on Mastodon or similar platforms using your own WordPress, you can use the Friends Plugin for WordPress which uses this plugin to receive posts and display them on your own WordPress, thus making your own WordPress a Fediverse instance of its own.', 'activitypub' ); ?></p>
|
||||
<p><a href="<?php echo \esc_url( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=friends&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the Friends Plugin', 'activitypub' ); ?></a></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! \class_exists( 'Hum' ) ) : ?>
|
||||
<h4 class="activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-hum-plugin" type="button">
|
||||
<span class="title"><?php \esc_html_e( 'Add a URL Shortener', 'activitypub' ); ?></span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="activitypub-settings-accordion-block-activitypub-hum-plugin" class="activitypub-settings-accordion-panel plugin-card-hum" hidden="hidden">
|
||||
<p><?php \esc_html_e( 'Hum is a personal URL shortener for WordPress, designed to provide short URLs to your personal content, both hosted on WordPress and elsewhere.', 'activitypub' ); ?></p>
|
||||
<p><a href="<?php echo \esc_url( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=hum&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the Hum Plugin', 'activitypub' ); ?></a></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! \class_exists( 'Webfinger' ) ) : ?>
|
||||
<h4 class="activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-webfinger-plugin" type="button">
|
||||
<span class="title"><?php \esc_html_e( 'Advanced WebFinger Support', 'activitypub' ); ?></span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="activitypub-settings-accordion-block-activitypub-webfinger-plugin" class="activitypub-settings-accordion-panel plugin-card-webfinger" hidden="hidden">
|
||||
<p><?php \esc_html_e( 'WebFinger is a protocol that allows for discovery of information about people and things identified by a URI. Information about a person might be discovered via an "acct:" URI, for example, which is a URI that looks like an email address.', 'activitypub' ); ?></p>
|
||||
<p><?php \esc_html_e( 'The ActivityPub plugin comes with basic WebFinger support, if you need more configuration options and compatibility with other Fediverse/IndieWeb plugins, please install the WebFinger plugin.', 'activitypub' ); ?></p>
|
||||
<p><a href="<?php echo \esc_url( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=webfinger&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the WebFinger Plugin', 'activitypub' ); ?></a></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! \function_exists( 'nodeinfo_init' ) ) : ?>
|
||||
<h4 class="activitypub-settings-accordion-heading">
|
||||
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-nodeinfo-plugin" type="button">
|
||||
<span class="title"><?php \esc_html_e( 'Provide Enhanced Information about Your Blog', 'activitypub' ); ?></span>
|
||||
<span class="icon"></span>
|
||||
</button>
|
||||
</h4>
|
||||
<div id="activitypub-settings-accordion-block-activitypub-nodeinfo-plugin" class="activitypub-settings-accordion-panel plugin-card-nodeinfo" hidden="hidden">
|
||||
<p><?php \esc_html_e( 'NodeInfo is an effort to create a standardized way of exposing metadata about a server running one of the distributed social networks. The two key goals are being able to get better insights into the user base of distributed social networking and the ability to build tools that allow users to choose the best fitting software and server for their needs.', 'activitypub' ); ?></p>
|
||||
<p><?php \esc_html_e( 'The ActivityPub plugin comes with a simple NodeInfo endpoint. If you need more configuration options and compatibility with other Fediverse plugins, please install the NodeInfo plugin.', 'activitypub' ); ?></p>
|
||||
<p><a href="<?php echo \esc_url( \admin_url( 'plugin-install.php?tab=plugin-information&plugin=nodeinfo&TB_iframe=true' ) ); ?>" class="thickbox open-plugin-details-modal button install-now" target="_blank"><?php \esc_html_e( 'Install the NodeInfo Plugin', 'activitypub' ); ?></a></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php do_settings_sections( 'activitypub_welcome' ); ?>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user