mirror of
https://github.com/Automattic/wordpress-activitypub
synced 2024-10-18 12:23:32 +00:00
PHPCS: Include all files by default (#930)
* PHPCS: Include all files by default * simplify menu highlighting * Update includes/transformer/class-factory.php Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com> --------- Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
This commit is contained in:
parent
f8cd515b05
commit
ef666772ec
25 changed files with 250 additions and 164 deletions
|
@ -42,15 +42,15 @@ class Notification {
|
|||
/**
|
||||
* Notification constructor.
|
||||
*
|
||||
* @param string $type The type of the notification.
|
||||
* @param string $actor The actor URL.
|
||||
* @param array $object The Activity object.
|
||||
* @param int $target The WordPress User-Id.
|
||||
* @param string $type The type of the notification.
|
||||
* @param string $actor The actor URL.
|
||||
* @param array $activity The Activity object.
|
||||
* @param int $target The WordPress User-Id.
|
||||
*/
|
||||
public function __construct( $type, $actor, $object, $target ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
|
||||
public function __construct( $type, $actor, $activity, $target ) {
|
||||
$this->type = $type;
|
||||
$this->actor = $actor;
|
||||
$this->object = $object;
|
||||
$this->object = $activity;
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ class Signature {
|
|||
|
||||
$signature = null;
|
||||
\openssl_sign( $signed_string, $signature, $key, \OPENSSL_ALGO_SHA256 );
|
||||
$signature = \base64_encode( $signature ); // phpcs:ignore
|
||||
$signature = \base64_encode( $signature ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
|
||||
|
||||
$key_id = $user->get_url() . '#main-key';
|
||||
|
||||
|
@ -345,7 +345,7 @@ class Signature {
|
|||
);
|
||||
}
|
||||
if ( isset( $actor['publicKey']['publicKeyPem'] ) ) {
|
||||
return \rtrim( $actor['publicKey']['publicKeyPem'] ); // phpcs:ignore
|
||||
return \rtrim( $actor['publicKey']['publicKeyPem'] );
|
||||
}
|
||||
return new WP_Error(
|
||||
'activitypub_no_remote_key_found',
|
||||
|
@ -400,7 +400,7 @@ class Signature {
|
|||
$parsed_header['headers'] = \explode( ' ', trim( $matches[1] ) );
|
||||
}
|
||||
if ( \preg_match( '/signature="(.*?)"/ism', $signature, $matches ) ) {
|
||||
$parsed_header['signature'] = \base64_decode( preg_replace( '/\s+/', '', trim( $matches[1] ) ) ); // phpcs:ignore
|
||||
$parsed_header['signature'] = \base64_decode( preg_replace( '/\s+/', '', trim( $matches[1] ) ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
|
||||
}
|
||||
|
||||
if ( ( $parsed_header['signature'] ) && ( $parsed_header['algorithm'] ) && ( ! $parsed_header['headers'] ) ) {
|
||||
|
|
|
@ -94,7 +94,7 @@ class Followers {
|
|||
public static function get_follower( $user_id, $actor ) {
|
||||
global $wpdb;
|
||||
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$post_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT DISTINCT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->postmeta pm ON p.ID = pm.post_id WHERE p.post_type = %s AND pm.meta_key = 'activitypub_user_id' AND pm.meta_value = %d AND p.guid = %s",
|
||||
|
@ -119,12 +119,12 @@ class Followers {
|
|||
*
|
||||
* @param string $actor The Actor URL.
|
||||
*
|
||||
* @return Follower|null The Follower object or null.
|
||||
* @return \Activitypub\Activity\Base_Object|WP_Error|null
|
||||
*/
|
||||
public static function get_follower_by_actor( $actor ) {
|
||||
global $wpdb;
|
||||
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$post_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM $wpdb->posts WHERE guid=%s",
|
||||
|
|
|
@ -1012,8 +1012,7 @@ function get_enclosures( $post_id ) {
|
|||
function get_comment_ancestors( $comment ) {
|
||||
$comment = \get_comment( $comment );
|
||||
|
||||
// phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
|
||||
if ( ! $comment || empty( $comment->comment_parent ) || $comment->comment_parent == $comment->comment_ID ) {
|
||||
if ( ! $comment || empty( $comment->comment_parent ) || (int) $comment->comment_parent === (int) $comment->comment_ID ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,27 +33,25 @@ class Announce {
|
|||
/**
|
||||
* Handles "Announce" requests.
|
||||
*
|
||||
* @param array $array The activity-object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param \Activitypub\Activity\Activity $activity The activity object.
|
||||
*
|
||||
* @return void
|
||||
* @param array $announcement The activity-object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param \Activitypub\Activity\Activity $activity The activity object.
|
||||
*/
|
||||
public static function handle_announce( $array, $user_id, $activity = null ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
|
||||
public static function handle_announce( $announcement, $user_id, $activity = null ) {
|
||||
// Check if Activity is public or not.
|
||||
if ( ! is_activity_public( $array ) ) {
|
||||
if ( ! is_activity_public( $announcement ) ) {
|
||||
// @todo maybe send email
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! ACTIVITYPUB_DISABLE_REACTIONS ) {
|
||||
self::maybe_save_announce( $array, $user_id, $activity );
|
||||
self::maybe_save_announce( $announcement, $user_id );
|
||||
}
|
||||
|
||||
if ( is_string( $array['object'] ) ) {
|
||||
$object = Http::get_remote_object( $array['object'] );
|
||||
if ( is_string( $announcement['object'] ) ) {
|
||||
$object = Http::get_remote_object( $announcement['object'] );
|
||||
} else {
|
||||
$object = $array['object'];
|
||||
$object = $announcement['object'];
|
||||
}
|
||||
|
||||
if ( ! $object || is_wp_error( $object ) ) {
|
||||
|
@ -66,21 +64,33 @@ class Announce {
|
|||
|
||||
$type = \strtolower( $object['type'] );
|
||||
|
||||
/**
|
||||
* Fires after an Announce has been received.
|
||||
*
|
||||
* @param array $object The object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param array $activity The activity object.
|
||||
*/
|
||||
\do_action( 'activitypub_inbox', $object, $user_id, $type, $activity );
|
||||
|
||||
/**
|
||||
* Fires after an Announce of a specific type has been received.
|
||||
*
|
||||
* @param array $object The object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param array $activity The activity object.
|
||||
*/
|
||||
\do_action( "activitypub_inbox_{$type}", $object, $user_id, $activity );
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to save the Announce.
|
||||
*
|
||||
* @param array $array The activity-object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param \Activitypub\Activity\Activity $activity The activity object.
|
||||
*
|
||||
* @return void
|
||||
* @param array $activity The activity-object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
*/
|
||||
public static function maybe_save_announce( $array, $user_id, $activity ) { // phpcs:ignore
|
||||
$url = object_to_uri( $array['object'] );
|
||||
public static function maybe_save_announce( $activity, $user_id ) {
|
||||
$url = object_to_uri( $activity['object'] );
|
||||
|
||||
if ( empty( $url ) ) {
|
||||
return;
|
||||
|
@ -91,13 +101,21 @@ class Announce {
|
|||
return;
|
||||
}
|
||||
|
||||
$state = Interactions::add_reaction( $array );
|
||||
$state = Interactions::add_reaction( $activity );
|
||||
$reaction = null;
|
||||
|
||||
if ( $state && ! is_wp_error( $state ) ) {
|
||||
$reaction = get_comment( $state );
|
||||
}
|
||||
|
||||
do_action( 'activitypub_handled_announce', $array, $user_id, $state, $reaction );
|
||||
/**
|
||||
* Fires after an Announce has been saved.
|
||||
*
|
||||
* @param array $activity The activity-object.
|
||||
* @param int $user_id The id of the local blog-user.
|
||||
* @param mixed $state The state of the reaction.
|
||||
* @param mixed $reaction The reaction.
|
||||
*/
|
||||
do_action( 'activitypub_handled_announce', $activity, $user_id, $state, $reaction );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,18 +31,15 @@ class Like {
|
|||
/**
|
||||
* Handles "Like" requests.
|
||||
*
|
||||
* @param array $array The Activity array.
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
* @param \Activitypub\Activity\Activity $activity The Activity object.
|
||||
*
|
||||
* @return void
|
||||
* @param array $like The Activity array.
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
*/
|
||||
public static function handle_like( $array, $user_id, $activity = null ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound,VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable,Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
|
||||
public static function handle_like( $like, $user_id ) {
|
||||
if ( ACTIVITYPUB_DISABLE_INCOMING_INTERACTIONS ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = object_to_uri( $array['object'] );
|
||||
$url = object_to_uri( $like['object'] );
|
||||
|
||||
if ( empty( $url ) ) {
|
||||
return;
|
||||
|
@ -53,13 +50,21 @@ class Like {
|
|||
return;
|
||||
}
|
||||
|
||||
$state = Interactions::add_reaction( $array );
|
||||
$state = Interactions::add_reaction( $like );
|
||||
$reaction = null;
|
||||
|
||||
if ( $state && ! is_wp_error( $state ) ) {
|
||||
$reaction = get_comment( $state );
|
||||
}
|
||||
|
||||
do_action( 'activitypub_handled_like', $array, $user_id, $state, $reaction );
|
||||
/**
|
||||
* Fires after a Like has been handled.
|
||||
*
|
||||
* @param array $like The Activity array.
|
||||
* @param int $user_id The ID of the local blog user.
|
||||
* @param mixed $state The state of the reaction.
|
||||
* @param mixed $reaction The reaction object.
|
||||
*/
|
||||
do_action( 'activitypub_handled_like', $like, $user_id, $state, $reaction );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ class Follower extends Actor {
|
|||
if ( ! $this->get__id() ) {
|
||||
global $wpdb;
|
||||
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$post_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM $wpdb->posts WHERE guid=%s",
|
||||
|
|
|
@ -102,7 +102,7 @@ class Outbox {
|
|||
$json->next = \add_query_arg( 'page', $page + 1, $json->partOf );
|
||||
}
|
||||
|
||||
if ( $page && ( $page > 1 ) ) { // phpcs:ignore
|
||||
if ( $page && ( $page > 1 ) ) {
|
||||
$json->prev = \add_query_arg( 'page', $page - 1, $json->partOf );
|
||||
}
|
||||
// phpcs:enable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
|
||||
|
|
|
@ -92,26 +92,22 @@ class Followers extends WP_List_Table {
|
|||
|
||||
$args = array();
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['orderby'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$args['orderby'] = sanitize_text_field( wp_unslash( $_GET['orderby'] ) );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['order'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$args['order'] = sanitize_text_field( wp_unslash( $_GET['order'] ) );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( isset( $_GET['s'] ) && isset( $_REQUEST['_wpnonce'] ) ) {
|
||||
$nonce = sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) );
|
||||
if ( wp_verify_nonce( $nonce, 'bulk-' . $this->_args['plural'] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$args['s'] = sanitize_text_field( wp_unslash( $_GET['s'] ) );
|
||||
}
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
$followers_with_count = FollowerCollection::get_followers_with_count( $this->user_id, $per_page, $page_num, $args );
|
||||
$followers = $followers_with_count['followers'];
|
||||
|
@ -219,7 +215,7 @@ class Followers extends WP_List_Table {
|
|||
return;
|
||||
}
|
||||
|
||||
$followers = $_REQUEST['followers']; // phpcs:ignore
|
||||
$followers = $_REQUEST['followers']; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
|
||||
if ( $this->current_action() === 'delete' ) {
|
||||
if ( ! is_array( $followers ) ) {
|
||||
|
|
|
@ -10,21 +10,22 @@ namespace Activitypub\Transformer;
|
|||
use WP_Error;
|
||||
|
||||
/**
|
||||
* Transformer Factory
|
||||
* Transformer Factory.
|
||||
*/
|
||||
class Factory {
|
||||
/**
|
||||
* Get the transformer for a given object.
|
||||
*
|
||||
* @param mixed $object The object to transform.
|
||||
* @param mixed $data The object to transform.
|
||||
*
|
||||
* @return Base|WP_Error The transformer to use, or an error.
|
||||
*/
|
||||
public static function get_transformer( $object ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
|
||||
if ( ! \is_object( $object ) ) {
|
||||
public static function get_transformer( $data ) {
|
||||
if ( ! \is_object( $data ) ) {
|
||||
return new WP_Error( 'invalid_object', __( 'Invalid object', 'activitypub' ) );
|
||||
}
|
||||
|
||||
$class = \get_class( $object );
|
||||
$class = \get_class( $data );
|
||||
|
||||
/**
|
||||
* Filter the transformer for a given object.
|
||||
|
@ -50,12 +51,12 @@ class Factory {
|
|||
* }, 10, 3 );
|
||||
*
|
||||
* @param Base $transformer The transformer to use.
|
||||
* @param mixed $object The object to transform.
|
||||
* @param mixed $data The object to transform.
|
||||
* @param string $object_class The class of the object to transform.
|
||||
*
|
||||
* @return mixed The transformer to use.
|
||||
*/
|
||||
$transformer = \apply_filters( 'activitypub_transformer', null, $object, $class );
|
||||
$transformer = \apply_filters( 'activitypub_transformer', null, $data, $class );
|
||||
|
||||
if ( $transformer ) {
|
||||
if (
|
||||
|
@ -71,12 +72,12 @@ class Factory {
|
|||
// Use default transformer.
|
||||
switch ( $class ) {
|
||||
case 'WP_Post':
|
||||
if ( 'attachment' === $object->post_type ) {
|
||||
return new Attachment( $object );
|
||||
if ( 'attachment' === $data->post_type ) {
|
||||
return new Attachment( $data );
|
||||
}
|
||||
return new Post( $object );
|
||||
return new Post( $data );
|
||||
case 'WP_Comment':
|
||||
return new Comment( $object );
|
||||
return new Comment( $data );
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -868,8 +868,8 @@ class Post extends Base {
|
|||
$template = "[ap_content]\n\n[ap_permalink type=\"html\"]\n\n[ap_hashtags]";
|
||||
break;
|
||||
default:
|
||||
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
|
||||
$template = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ) ?: ACTIVITYPUB_CUSTOM_POST_CONTENT;
|
||||
$content = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );
|
||||
$template = empty( $content ) ? ACTIVITYPUB_CUSTOM_POST_CONTENT : $content;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,14 +79,13 @@ function plugin_init() {
|
|||
if ( \defined( 'SSP_VERSION' ) ) {
|
||||
add_filter(
|
||||
'activitypub_transformer',
|
||||
// phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
|
||||
function ( $transformer, $object, $object_class ) {
|
||||
function ( $transformer, $data, $object_class ) {
|
||||
if (
|
||||
'WP_Post' === $object_class &&
|
||||
\get_post_meta( $object->ID, 'audio_file', true )
|
||||
\get_post_meta( $data->ID, 'audio_file', true )
|
||||
) {
|
||||
require_once __DIR__ . '/class-seriously-simple-podcasting.php';
|
||||
return new Seriously_Simple_Podcasting( $object );
|
||||
return new Seriously_Simple_Podcasting( $data );
|
||||
}
|
||||
return $transformer;
|
||||
},
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name="WordPress ActivityPub">
|
||||
<description>WordPress ActivityPub Standards</description>
|
||||
<file>./activitypub.php</file>
|
||||
<file>./includes/</file>
|
||||
<file>./integration/</file>
|
||||
<file>./build/</file>
|
||||
<file>.</file>
|
||||
|
||||
<exclude-pattern>*\.(inc|css|js|svg)</exclude-pattern>
|
||||
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||
<exclude-pattern>*/node_modules/*</exclude-pattern>
|
||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||
<exclude-pattern>*.asset.php</exclude-pattern>
|
||||
|
||||
<arg value="ps"/>
|
||||
|
|
|
@ -5,6 +5,16 @@
|
|||
* @package Activitypub
|
||||
*/
|
||||
|
||||
/* @var array $args Template arguments. */
|
||||
$args = wp_parse_args(
|
||||
$args,
|
||||
array(
|
||||
'welcome' => '',
|
||||
'settings' => '',
|
||||
'blog-profile' => '',
|
||||
'followers' => '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
<div class="activitypub-settings-header">
|
||||
<div class="activitypub-settings-title-section">
|
||||
|
@ -12,21 +22,21 @@
|
|||
</div>
|
||||
|
||||
<nav class="activitypub-settings-tabs-wrapper" aria-label="<?php \esc_attr_e( 'Secondary menu', 'activitypub' ); ?>">
|
||||
<a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>">
|
||||
<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>
|
||||
|
||||
<a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub&tab=settings' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>">
|
||||
<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>
|
||||
|
||||
<?php if ( ! \Activitypub\is_user_disabled( \Activitypub\Collection\Users::BLOG_USER_ID ) ) : ?>
|
||||
|
||||
<a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub&tab=blog-profile' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['blog-profile'] ); ?>">
|
||||
<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_raw( admin_url( 'options-general.php?page=activitypub&tab=followers' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['followers'] ); ?>">
|
||||
<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>
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Blog Followers List template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'settings' => '',
|
||||
'welcome' => '',
|
||||
'followers' => 'active',
|
||||
'blog-profile' => '',
|
||||
'followers' => 'active',
|
||||
)
|
||||
);
|
||||
$table = new \Activitypub\Table\Followers();
|
||||
|
||||
$table = new \Activitypub\Table\Followers();
|
||||
$follower_count = $table->get_user_count();
|
||||
// translators: The follower count.
|
||||
$followers_template = _n( 'Your blog profile currently has %s follower.', 'Your blog profile currently has %s followers.', $follower_count, 'activitypub' );
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Blog JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$user = new \Activitypub\Model\Blog();
|
||||
|
||||
/*
|
||||
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
||||
/**
|
||||
* 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 triggerd after the ActivityPub profile has been created and sent to the client
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_post', $user->get__id() );
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Blog Settings template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'settings' => '',
|
||||
'welcome' => '',
|
||||
'blog-profile' => 'active',
|
||||
'followers' => '',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
@ -33,7 +36,7 @@
|
|||
\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_attr( \admin_url( 'options-general.php' ) )
|
||||
\esc_url( \admin_url( 'options-general.php' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
|
@ -51,15 +54,15 @@
|
|||
$classes_for_update_button = 'button';
|
||||
$classes_for_wrapper = '';
|
||||
|
||||
if ( (int) get_option( 'activitypub_header_image', 0 ) ) {
|
||||
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 {
|
||||
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%;" />
|
||||
|
@ -120,7 +123,7 @@
|
|||
name="activitypub_blog_description"
|
||||
id="activitypub_blog_description"
|
||||
placeholder="<?php echo esc_attr( \get_bloginfo( 'description' ) ); ?>"
|
||||
><?php echo \esc_html( \get_option( 'activitypub_blog_description' ) ); ?></textarea>
|
||||
><?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' ); ?>
|
||||
|
@ -142,7 +145,7 @@
|
|||
<?php
|
||||
$extra_fields = \Activitypub\Collection\Extra_Fields::get_actor_fields( \Activitypub\Collection\Users::BLOG_USER_ID );
|
||||
|
||||
if ( empty( $extra_fields ) ) {
|
||||
if ( empty( $extra_fields ) ) :
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
|
@ -150,8 +153,9 @@
|
|||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
foreach ( $extra_fields as $extra_field ) {
|
||||
endif;
|
||||
|
||||
foreach ( $extra_fields as $extra_field ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo \esc_html( $extra_field->post_title ); ?></td>
|
||||
|
@ -162,7 +166,7 @@
|
|||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<?php
|
||||
$comment = \get_comment( \get_query_var( 'c', null ) ); // phpcs:ignore
|
||||
/**
|
||||
* 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 ) ) {
|
||||
|
@ -9,15 +15,15 @@ if ( \is_wp_error( $transformer ) ) {
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
||||
/**
|
||||
* 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 triggerd after the ActivityPub profile has been created and sent to the client
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_comment_post' );
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?php
|
||||
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
$post = \get_post();
|
||||
/**
|
||||
* 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 ) ) {
|
||||
|
@ -11,15 +16,15 @@ if ( \is_wp_error( $transformer ) ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
||||
/**
|
||||
* 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 triggerd after the ActivityPub profile has been created and sent to the client
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_post_post' );
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub settings template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'settings' => 'active',
|
||||
'welcome' => '',
|
||||
'followers' => '',
|
||||
'blog-profile' => '',
|
||||
'settings' => 'active',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
@ -85,8 +88,7 @@
|
|||
|
||||
</td>
|
||||
</tr>
|
||||
<?php // phpcs:ignore Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace ?>
|
||||
<tr <?php if ( 'wordpress-post-format' === \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ) { echo 'style="display: none"'; } ?>>
|
||||
<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>
|
||||
|
@ -138,12 +140,12 @@
|
|||
<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 post\'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>
|
||||
<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>
|
||||
|
@ -161,7 +163,7 @@
|
|||
<?php
|
||||
echo \wp_kses(
|
||||
\sprintf(
|
||||
// translators:
|
||||
// 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 )
|
||||
),
|
||||
|
@ -184,19 +186,21 @@
|
|||
<fieldset>
|
||||
<?php \esc_html_e( 'Automatically publish items of the selected post types to the fediverse:', 'activitypub' ); ?>
|
||||
|
||||
<?php $post_types = \get_post_types( array( 'public' => true ), 'objects' ); ?>
|
||||
<?php $support_post_types = \get_option( 'activitypub_support_post_types', array( 'post' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post' ) ) : array(); ?>
|
||||
<ul>
|
||||
<?php // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?>
|
||||
<?php foreach ( $post_types as $post_type ) { ?>
|
||||
<?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, $support_post_types, true ) ); ?> />
|
||||
<label for="activitypub_support_post_type_<?php echo \esc_attr( $post_type->name ); ?>"><?php echo \esc_html( $post_type->label ); ?></label>
|
||||
<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 ) ); ?>
|
||||
<?php echo \esc_html( \Activitypub\get_post_type_description( $_post_type ) ); ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</td>
|
||||
|
@ -242,7 +246,7 @@
|
|||
\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_attr( \admin_url( 'options-discussion.php#disallowed_keys' ) )
|
||||
\esc_url( \admin_url( 'options-discussion.php#disallowed_keys' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* Toolbox template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="card activitypub" id="activitypub">
|
||||
<h2><?php esc_html_e( '⁂ Fediverse Bookmarklet', 'activitypub' ); ?></h2>
|
||||
<p>
|
||||
|
@ -7,8 +16,8 @@
|
|||
<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_html( \Activitypub\get_reply_intent_uri() ); ?>" style="cursor: grab;">
|
||||
<?php // translators: The host (domain) of the Blog ?>
|
||||
<a class="activitypub-bookmarklet button" onclick="return false;" href="<?php echo esc_url( \Activitypub\get_reply_intent_uri() ); ?>" 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>
|
||||
</p>
|
||||
|
@ -17,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_html( \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_uri() ); ?></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>
|
||||
|
@ -25,14 +34,14 @@
|
|||
jQuery( document ).ready( function( $ ) {
|
||||
var $copyActivitypubBookmarkletCode = $( '.copy-activitypub-bookmarklet-code' );
|
||||
$copyActivitypubBookmarkletCode.on( 'click', function( event ) {
|
||||
// Get the text field
|
||||
// Get the text field.
|
||||
var copyText = document.getElementById("activitypub-bookmarklet-code");
|
||||
|
||||
// Select the text field
|
||||
// Select the text field.
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); // For mobile devices
|
||||
copyText.setSelectionRange(0, 99999); // For mobile devices.
|
||||
|
||||
// Copy the text inside the text field
|
||||
// Copy the text inside the text field.
|
||||
navigator.clipboard.writeText(copyText.value);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub User Followers List template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$follower_count = \Activitypub\Collection\Followers::count_followers( \get_current_user_id() );
|
||||
// translators: The follower count.
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub User JSON template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$user = \Activitypub\Collection\Users::get_by_id( \get_the_author_meta( 'ID' ) );
|
||||
|
||||
/*
|
||||
* Action triggerd prior to the ActivityPub profile being created and sent to the client
|
||||
/**
|
||||
* 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 triggerd after the ActivityPub profile has been created and sent to the client
|
||||
/**
|
||||
* Action triggered after the ActivityPub profile has been created and sent to the client
|
||||
*/
|
||||
\do_action( 'activitypub_json_author_post', $user->get__id() );
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<?php
|
||||
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
||||
/**
|
||||
* 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>
|
||||
|
||||
|
@ -18,7 +26,7 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
<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 ?>
|
||||
<?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>
|
||||
|
@ -27,7 +35,7 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
<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_html( get_user_meta( \get_current_user_id(), 'description', true ) ); ?>"><?php echo \esc_html( $args['description'] ); ?></textarea>
|
||||
<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>
|
||||
|
@ -43,18 +51,18 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
|
||||
$header_image = \get_user_option( 'activitypub_header_image', \get_current_user_id() );
|
||||
|
||||
if ( (int) $header_image ) {
|
||||
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 {
|
||||
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%;" />
|
||||
<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"
|
||||
|
@ -67,9 +75,9 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
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' ) ) {
|
||||
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 ) : ?>
|
||||
|
@ -102,7 +110,7 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
<?php
|
||||
$extra_fields = \Activitypub\Collection\Extra_Fields::get_actor_fields( \get_current_user_id() );
|
||||
|
||||
foreach ( $extra_fields as $extra_field ) {
|
||||
foreach ( $extra_fields as $extra_field ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo \esc_html( $extra_field->post_title ); ?></td>
|
||||
|
@ -113,7 +121,7 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* ActivityPub Welcome template.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\load_template(
|
||||
__DIR__ . '/admin-header.php',
|
||||
true,
|
||||
array(
|
||||
'settings' => '',
|
||||
'welcome' => 'active',
|
||||
'blog-profile' => '',
|
||||
'followers' => '',
|
||||
'welcome' => 'active',
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
@ -28,9 +31,9 @@
|
|||
|
||||
/* translators: %s is the domain of this site */
|
||||
$reply_from_template = __( 'Reply from %s', 'activitypub' );
|
||||
$button = sprintf(
|
||||
$button = sprintf(
|
||||
'<a href="%s" class="button">%s</a>',
|
||||
esc_attr( $bookmarklet_url ), // need to escape quotes for the bookmarklet
|
||||
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. */
|
||||
|
@ -122,7 +125,7 @@
|
|||
'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_raw( admin_url( 'site-health.php' ) )
|
||||
\esc_url( admin_url( 'site-health.php' ) )
|
||||
),
|
||||
'default'
|
||||
);
|
||||
|
@ -146,7 +149,7 @@
|
|||
</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_raw( \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>
|
||||
<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' ) ) : ?>
|
||||
|
@ -158,7 +161,7 @@
|
|||
</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_raw( \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>
|
||||
<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' ) ) : ?>
|
||||
|
@ -171,7 +174,7 @@
|
|||
<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_raw( \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>
|
||||
<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' ) ) : ?>
|
||||
|
@ -184,7 +187,7 @@
|
|||
<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_raw( \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>
|
||||
<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>
|
||||
|
|
Loading…
Reference in a new issue