PluginProbe
ActivityPub / 5.7.0
ActivityPub v5.7.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/collection/class-extra-fields.php +17 -21 8.2.15.7.0 View file →
@@ -7,9 +7,8 @@
7 7
8 8 namespace Activitypub\Collection;
9 9
10 10 use Activitypub\Link;
11 -use Activitypub\Sanitize;
12 11
13 12 use function Activitypub\site_supports_blocks;
14 13
15 14 /**
@@ -39,19 +38,8 @@
39 38 if ( ! $is_blog ) {
40 39 $args['author'] = $user_id;
41 40 }
42 41
43 - // Limit to 20 fields to prevent response size issues.
44 - if ( ! is_admin() ) {
45 - /**
46 - * Filters the number of extra fields to retrieve for an ActivityPub actor.
47 - *
48 - * @param int $limit The number of extra fields to retrieve. Default 20.
49 - */
50 - $args['posts_per_page'] = apply_filters( 'activitypub_actor_extra_fields_limit', 20 );
51 - $args['nopaging'] = false;
52 - }
53 -
54 42 $query = new \WP_Query( $args );
55 43 $fields = $query->posts ?? array();
56 44
57 45 /**
@@ -81,11 +69,12 @@
81 69 }
82 70 $content = \wptexturize( $content );
83 71 $content = \wp_filter_content_tags( $content );
84 72
73 + // Replace script and style elements.
74 + $content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
85 75 $content = \strip_shortcodes( $content );
86 - $content = Sanitize::clean_html( $content );
87 - $content = Sanitize::strip_whitespace( $content );
76 + $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
88 77
89 78 /**
90 79 * Filters the content of an extra field.
91 80 *
@@ -106,14 +95,17 @@
106 95 $attachments = array();
107 96 \add_filter( 'activitypub_link_rel', array( self::class, 'add_rel_me' ) );
108 97
109 98 foreach ( $fields as $post ) {
110 - $title = \html_entity_decode( \get_the_title( $post ), \ENT_QUOTES, 'UTF-8' );
111 99 $content = self::get_formatted_content( $post );
112 100 $attachments[] = array(
113 101 'type' => 'PropertyValue',
114 - 'name' => $title,
115 - 'value' => \html_entity_decode( $content, \ENT_QUOTES, 'UTF-8' ),
102 + 'name' => \get_the_title( $post ),
103 + 'value' => \html_entity_decode(
104 + $content,
105 + \ENT_QUOTES,
106 + 'UTF-8'
107 + ),
116 108 );
117 109
118 110 $attachment = false;
119 111
@@ -130,9 +122,9 @@
130 122
131 123 if ( 'A' === $tags->get_tag() ) {
132 124 $attachment = array(
133 125 'type' => 'Link',
134 - 'name' => $title,
126 + 'name' => \get_the_title( $post ),
135 127 'href' => \esc_url( $tags->get_attribute( 'href' ) ),
136 128 );
137 129
138 130 $rel = $tags->get_attribute( 'rel' );
@@ -145,10 +137,14 @@
145 137
146 138 if ( ! $attachment ) {
147 139 $attachment = array(
148 140 'type' => 'Note',
149 - 'name' => $title,
150 - 'content' => \html_entity_decode( $content, \ENT_QUOTES, 'UTF-8' ),
141 + 'name' => \get_the_title( $post ),
142 + 'content' => \html_entity_decode(
143 + $content,
144 + \ENT_QUOTES,
145 + 'UTF-8'
146 + ),
151 147 );
152 148 }
153 149
154 150 $attachments[] = $attachment;
@@ -216,9 +212,9 @@
216 212 }
217 213
218 214 \add_filter(
219 215 'activitypub_link_rel',
220 - static function ( $rel ) {
216 + function ( $rel ) {
221 217 $rel .= ' me';
222 218
223 219 return $rel;
224 220 }