updated plugin ActivityPub version 9.1.0

This commit is contained in:
2026-07-28 15:03:10 +00:00
committed by Gitium
parent bf428f0e45
commit ff806e1811
217 changed files with 6098 additions and 3025 deletions

View File

@ -123,11 +123,11 @@ class Comment extends Base {
$mentions = '';
foreach ( $this->extract_reply_context() as $acct => $url ) {
$mentions .= sprintf(
$mentions .= \sprintf(
'<a rel="mention" class="u-url mention" href="%1$s" title="%2$s">%3$s</a> ',
esc_url( $url ),
esc_attr( $acct ),
esc_html( '@' . strtok( $acct, '@' ) )
\esc_url( $url ),
\esc_attr( $acct ),
\esc_html( '@' . \strtok( $acct, '@' ) )
);
}
$content = $mentions . $content;
@ -215,7 +215,7 @@ class Comment extends Base {
$user = Actors::get_by_id( $this->item->user_id );
if ( $user && ! is_wp_error( $user ) ) {
if ( $user && ! \is_wp_error( $user ) ) {
$this->actor_object = $user;
return $user;
}
@ -240,7 +240,7 @@ class Comment extends Base {
*
* @return array The filtered list of mentions.
*/
return apply_filters( 'activitypub_extract_mentions', array(), $this->item->comment_content, $this->item );
return \apply_filters( 'activitypub_extract_mentions', array(), $this->item->comment_content, $this->item );
}
/**
@ -252,7 +252,7 @@ class Comment extends Base {
$ancestors = get_comment_ancestors( $this->item );
// Now that we have the full tree of ancestors, only return the ones received from the fediverse.
return array_filter(
return \array_filter(
$ancestors,
static function ( $comment_id ) {
return \get_comment_meta( $comment_id, 'protocol', true ) === 'activitypub';
@ -270,7 +270,7 @@ class Comment extends Base {
*/
public function extract_reply_context( $mentions = array() ) {
// Check if `$this->item` is a WP_Comment.
if ( 'WP_Comment' !== get_class( $this->item ) ) {
if ( 'WP_Comment' !== \get_class( $this->item ) ) {
return $mentions;
}
@ -283,8 +283,8 @@ class Comment extends Base {
$comment = \get_comment( $comment_id );
if ( $comment && ! empty( $comment->comment_author_url ) ) {
$acct = Webfinger::uri_to_acct( $comment->comment_author_url );
if ( $acct && ! is_wp_error( $acct ) ) {
$acct = str_replace( 'acct:', '@', $acct );
if ( $acct && ! \is_wp_error( $acct ) ) {
$acct = \str_replace( 'acct:', '@', $acct );
$mentions[ $acct ] = $comment->comment_author_url;
}
}
@ -345,7 +345,7 @@ class Comment extends Base {
*/
protected function get_context() {
if ( $this->item->comment_post_ID ) {
return get_rest_url_by_path( sprintf( 'posts/%d/context', $this->item->comment_post_ID ) );
return get_rest_url_by_path( \sprintf( 'posts/%d/context', $this->item->comment_post_ID ) );
}
return null;