updated plugin ActivityPub version 8.3.0

This commit is contained in:
2026-06-03 21:28:46 +00:00
committed by Gitium
parent a4b78ec277
commit 6fe182458a
340 changed files with 43232 additions and 7568 deletions

View File

@ -8,6 +8,7 @@
namespace Activitypub\Collection;
use Activitypub\Link;
use Activitypub\Sanitize;
use function Activitypub\site_supports_blocks;
@ -39,6 +40,17 @@ class Extra_Fields {
$args['author'] = $user_id;
}
// Limit to 20 fields to prevent response size issues.
if ( ! is_admin() ) {
/**
* Filters the number of extra fields to retrieve for an ActivityPub actor.
*
* @param int $limit The number of extra fields to retrieve. Default 20.
*/
$args['posts_per_page'] = apply_filters( 'activitypub_actor_extra_fields_limit', 20 );
$args['nopaging'] = false;
}
$query = new \WP_Query( $args );
$fields = $query->posts ?? array();
@ -70,10 +82,9 @@ class Extra_Fields {
$content = \wptexturize( $content );
$content = \wp_filter_content_tags( $content );
// Replace script and style elements.
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
$content = \strip_shortcodes( $content );
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
$content = Sanitize::clean_html( $content );
$content = Sanitize::strip_whitespace( $content );
/**
* Filters the content of an extra field.
@ -96,15 +107,12 @@ class Extra_Fields {
\add_filter( 'activitypub_link_rel', array( self::class, 'add_rel_me' ) );
foreach ( $fields as $post ) {
$title = \html_entity_decode( \get_the_title( $post ), \ENT_QUOTES, 'UTF-8' );
$content = self::get_formatted_content( $post );
$attachments[] = array(
'type' => 'PropertyValue',
'name' => \get_the_title( $post ),
'value' => \html_entity_decode(
$content,
\ENT_QUOTES,
'UTF-8'
),
'name' => $title,
'value' => \html_entity_decode( $content, \ENT_QUOTES, 'UTF-8' ),
);
$attachment = false;
@ -123,7 +131,7 @@ class Extra_Fields {
if ( 'A' === $tags->get_tag() ) {
$attachment = array(
'type' => 'Link',
'name' => \get_the_title( $post ),
'name' => $title,
'href' => \esc_url( $tags->get_attribute( 'href' ) ),
);
@ -138,12 +146,8 @@ class Extra_Fields {
if ( ! $attachment ) {
$attachment = array(
'type' => 'Note',
'name' => \get_the_title( $post ),
'content' => \html_entity_decode(
$content,
\ENT_QUOTES,
'UTF-8'
),
'name' => $title,
'content' => \html_entity_decode( $content, \ENT_QUOTES, 'UTF-8' ),
);
}
@ -213,7 +217,7 @@ class Extra_Fields {
\add_filter(
'activitypub_link_rel',
function ( $rel ) {
static function ( $rel ) {
$rel .= ' me';
return $rel;