PluginProbe
ActivityPub / 9.2.1
ActivityPub v9.2.1
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/transformer/class-comment.php +11 -11 8.2.1 → 9.2.1 View file →
@@ -122,13 +122,13 @@
122 122 $content = $comment->comment_content;
123 123 $mentions = '';
124 124
125 125 foreach ( $this->extract_reply_context() as $acct => $url ) {
126 - $mentions .= sprintf(
126 + $mentions .= \sprintf(
127 127 '<a rel="mention" class="u-url mention" href="%1$s" title="%2$s">%3$s</a> ',
128 - esc_url( $url ),
129 - esc_attr( $acct ),
130 - esc_html( '@' . strtok( $acct, '@' ) )
128 + \esc_url( $url ),
129 + \esc_attr( $acct ),
130 + \esc_html( '@' . \strtok( $acct, '@' ) )
131 131 );
132 132 }
133 133 $content = $mentions . $content;
134 134
@@ -214,9 +214,9 @@
214 214 }
215 215
216 216 $user = Actors::get_by_id( $this->item->user_id );
217 217
218 - if ( $user && ! is_wp_error( $user ) ) {
218 + if ( $user && ! \is_wp_error( $user ) ) {
219 219 $this->actor_object = $user;
220 220 return $user;
221 221 }
222 222
@@ -239,9 +239,9 @@
239 239 * @param \WP_Comment $comment The comment object.
240 240 *
241 241 * @return array The filtered list of mentions.
242 242 */
243 - return apply_filters( 'activitypub_extract_mentions', array(), $this->item->comment_content, $this->item );
243 + return \apply_filters( 'activitypub_extract_mentions', array(), $this->item->comment_content, $this->item );
244 244 }
245 245
246 246 /**
247 247 * Gets the ancestors of the comment, but only the ones that are ActivityPub comments.
@@ -251,9 +251,9 @@
251 251 protected function get_comment_ancestors() {
252 252 $ancestors = get_comment_ancestors( $this->item );
253 253
254 254 // Now that we have the full tree of ancestors, only return the ones received from the fediverse.
255 - return array_filter(
255 + return \array_filter(
256 256 $ancestors,
257 257 static function ( $comment_id ) {
258 258 return \get_comment_meta( $comment_id, 'protocol', true ) === 'activitypub';
259 259 }
@@ -269,9 +269,9 @@
269 269 * @return array The list of all Repliers.
270 270 */
271 271 public function extract_reply_context( $mentions = array() ) {
272 272 // Check if `$this->item` is a WP_Comment.
273 - if ( 'WP_Comment' !== get_class( $this->item ) ) {
273 + if ( 'WP_Comment' !== \get_class( $this->item ) ) {
274 274 return $mentions;
275 275 }
276 276
277 277 $ancestors = $this->get_comment_ancestors();
@@ -282,10 +282,10 @@
282 282 foreach ( $ancestors as $comment_id ) {
283 283 $comment = \get_comment( $comment_id );
284 284 if ( $comment && ! empty( $comment->comment_author_url ) ) {
285 285 $acct = Webfinger::uri_to_acct( $comment->comment_author_url );
286 - if ( $acct && ! is_wp_error( $acct ) ) {
287 - $acct = str_replace( 'acct:', '@', $acct );
286 + if ( $acct && ! \is_wp_error( $acct ) ) {
287 + $acct = \str_replace( 'acct:', '@', $acct );
288 288 $mentions[ $acct ] = $comment->comment_author_url;
289 289 }
290 290 }
291 291 }
@@ -344,9 +344,9 @@
344 344 * @return string The context of the post.
345 345 */
346 346 protected function get_context() {
347 347 if ( $this->item->comment_post_ID ) {
348 - return get_rest_url_by_path( sprintf( 'posts/%d/context', $this->item->comment_post_ID ) );
348 + return get_rest_url_by_path( \sprintf( 'posts/%d/context', $this->item->comment_post_ID ) );
349 349 }
350 350
351 351 return null;
352 352 }