updated plugin ActivityPub
version 2.3.0
This commit is contained in:
@ -75,9 +75,13 @@ class Comment {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$resource = \get_comment_meta( $comment_id, 'source_id', true );
|
||||
$comment_meta = \get_comment_meta( $comment_id );
|
||||
|
||||
if ( ! $resource ) {
|
||||
if ( ! empty( $comment_meta['source_id'][0] ) ) {
|
||||
$resource = $comment_meta['source_id'][0];
|
||||
} elseif ( ! empty( $comment_meta['source_url'][0] ) ) {
|
||||
$resource = $comment_meta['source_url'][0];
|
||||
} else {
|
||||
$resource = Comment_Utils::generate_id( $comment );
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ use Activitypub\Collection\Users as User_Collection;
|
||||
use Activitypub\Collection\Followers as Follower_Collection;
|
||||
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\get_masked_wp_version;
|
||||
|
||||
/**
|
||||
* ActivityPub Followers REST-Class
|
||||
@ -74,7 +75,7 @@ class Followers {
|
||||
$json->{'@context'} = \Activitypub\get_context();
|
||||
|
||||
$json->id = get_rest_url_by_path( sprintf( 'users/%d/followers', $user->get__id() ) );
|
||||
$json->generator = 'http://wordpress.org/?v=' . \get_bloginfo_rss( 'version' );
|
||||
$json->generator = 'http://wordpress.org/?v=' . get_masked_wp_version();
|
||||
$json->actor = $user->get_id();
|
||||
$json->type = 'OrderedCollectionPage';
|
||||
|
||||
|
@ -6,6 +6,7 @@ use Activitypub\Collection\Users as User_Collection;
|
||||
|
||||
use function Activitypub\is_single_user;
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\get_masked_wp_version;
|
||||
|
||||
/**
|
||||
* ActivityPub Following REST-Class
|
||||
@ -67,7 +68,7 @@ class Following {
|
||||
$json->{'@context'} = \Activitypub\get_context();
|
||||
|
||||
$json->id = get_rest_url_by_path( sprintf( 'users/%d/following', $user->get__id() ) );
|
||||
$json->generator = 'http://wordpress.org/?v=' . \get_bloginfo_rss( 'version' );
|
||||
$json->generator = 'http://wordpress.org/?v=' . get_masked_wp_version();
|
||||
$json->actor = $user->get_id();
|
||||
$json->type = 'OrderedCollectionPage';
|
||||
|
||||
|
@ -11,6 +11,7 @@ use function Activitypub\get_context;
|
||||
use function Activitypub\object_to_uri;
|
||||
use function Activitypub\url_to_authorid;
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\get_masked_wp_version;
|
||||
use function Activitypub\extract_recipients_from_activity;
|
||||
|
||||
/**
|
||||
@ -90,7 +91,7 @@ class Inbox {
|
||||
|
||||
$json->{'@context'} = get_context();
|
||||
$json->id = get_rest_url_by_path( sprintf( 'users/%d/inbox', $user->get__id() ) );
|
||||
$json->generator = 'http://wordpress.org/?v=' . \get_bloginfo_rss( 'version' );
|
||||
$json->generator = 'http://wordpress.org/?v=' . get_masked_wp_version();
|
||||
$json->type = 'OrderedCollectionPage';
|
||||
$json->partOf = get_rest_url_by_path( sprintf( 'users/%d/inbox', $user->get__id() ) ); // phpcs:ignore
|
||||
$json->totalItems = 0; // phpcs:ignore
|
||||
|
@ -6,6 +6,7 @@ use WP_REST_Response;
|
||||
use function Activitypub\get_total_users;
|
||||
use function Activitypub\get_active_users;
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\get_masked_wp_version;
|
||||
|
||||
/**
|
||||
* ActivityPub NodeInfo REST-Class
|
||||
@ -81,7 +82,7 @@ class Nodeinfo {
|
||||
$nodeinfo['version'] = '2.0';
|
||||
$nodeinfo['software'] = array(
|
||||
'name' => 'wordpress',
|
||||
'version' => \get_bloginfo( 'version' ),
|
||||
'version' => get_masked_wp_version(),
|
||||
);
|
||||
|
||||
$posts = \wp_count_posts();
|
||||
@ -134,7 +135,7 @@ class Nodeinfo {
|
||||
'baseUrl' => \home_url( '/' ),
|
||||
'name' => \get_bloginfo( 'name' ),
|
||||
'software' => 'wordpress',
|
||||
'version' => \get_bloginfo( 'version' ),
|
||||
'version' => get_masked_wp_version(),
|
||||
);
|
||||
|
||||
$posts = \wp_count_posts();
|
||||
|
@ -11,6 +11,7 @@ use Activitypub\Collection\Users as User_Collection;
|
||||
|
||||
use function Activitypub\get_context;
|
||||
use function Activitypub\get_rest_url_by_path;
|
||||
use function Activitypub\get_masked_wp_version;
|
||||
|
||||
/**
|
||||
* ActivityPub Outbox REST-Class
|
||||
@ -72,15 +73,20 @@ class Outbox {
|
||||
|
||||
$json->{'@context'} = get_context();
|
||||
$json->id = get_rest_url_by_path( sprintf( 'users/%d/outbox', $user_id ) );
|
||||
$json->generator = 'http://wordpress.org/?v=' . \get_bloginfo_rss( 'version' );
|
||||
$json->generator = 'http://wordpress.org/?v=' . get_masked_wp_version();
|
||||
$json->actor = $user->get_id();
|
||||
$json->type = 'OrderedCollectionPage';
|
||||
$json->partOf = get_rest_url_by_path( sprintf( 'users/%d/outbox', $user_id ) ); // phpcs:ignore
|
||||
$json->totalItems = 0; // phpcs:ignore
|
||||
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$count_posts = \wp_count_posts( $post_type );
|
||||
$json->totalItems += \intval( $count_posts->publish ); // phpcs:ignore
|
||||
if ( $user_id > 0 ) {
|
||||
$count_posts = \count_user_posts( $user_id, $post_types, true );
|
||||
$json->totalItems = \intval( $count_posts ); // phpcs:ignore
|
||||
} else {
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$count_posts = \wp_count_posts( $post_type );
|
||||
$json->totalItems += \intval( $count_posts->publish ); // phpcs:ignore
|
||||
}
|
||||
}
|
||||
|
||||
$json->first = \add_query_arg( 'page', 1, $json->partOf ); // phpcs:ignore
|
||||
@ -98,7 +104,7 @@ class Outbox {
|
||||
$posts = \get_posts(
|
||||
array(
|
||||
'posts_per_page' => 10,
|
||||
'author' => $user_id,
|
||||
'author' => $user_id > 0 ? $user_id : null,
|
||||
'paged' => $page,
|
||||
'post_type' => $post_types,
|
||||
)
|
||||
|
Reference in New Issue
Block a user