| @@ -27,9 +27,12 @@ | ||
| 27 | 27 | * |
| 28 | 28 | * @return array Rhe activity object array. |
| 29 | 29 | */ |
| 30 | 30 | public static function filter_activity_object( $activity ) { |
| 31 | - if ( ! empty( $activity['summary'] ) && is_actor( $activity ) ) { | |
| 31 | + /* phpcs:ignore Squiz.PHP.CommentedOutCode.Found | |
| 32 | + Only changed it for Person and Group as long is not merged: https://github.com/mastodon/mastodon/pull/28629 | |
| 33 | + */ | |
| 34 | + if ( ! empty( $activity['summary'] ) && in_array( $activity['type'], array( 'Person', 'Group' ), true ) ) { | |
| 32 | 35 | $activity['summary'] = self::the_content( $activity['summary'] ); |
| 33 | 36 | } |
| 34 | 37 | |
| 35 | 38 | if ( ! empty( $activity['content'] ) ) { |
| @@ -59,12 +62,12 @@ | ||
| 59 | 62 | * |
| 60 | 63 | * @return string The final string. |
| 61 | 64 | */ |
| 62 | 65 | public static function replace_with_links( $result ) { |
| 63 | - if ( 'www.' === \substr( $result[0], 0, 4 ) ) { | |
| 66 | + if ( 'www.' === substr( $result[0], 0, 4 ) ) { | |
| 64 | 67 | $result[0] = 'https://' . $result[0]; |
| 65 | 68 | } |
| 66 | - $parsed_url = \wp_parse_url( \html_entity_decode( $result[0] ) ); | |
| 69 | + $parsed_url = \wp_parse_url( html_entity_decode( $result[0] ) ); | |
| 67 | 70 | if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { |
| 68 | 71 | return $result[0]; |
| 69 | 72 | } |
| 70 | 73 | |
| @@ -83,10 +86,10 @@ | ||
| 83 | 86 | $invisible_prefix .= '@'; |
| 84 | 87 | } |
| 85 | 88 | |
| 86 | 89 | $text_url = $parsed_url['host']; |
| 87 | - if ( 'www.' === \substr( $text_url, 0, 4 ) ) { | |
| 88 | - $text_url = \substr( $text_url, 4 ); | |
| 90 | + if ( 'www.' === substr( $text_url, 0, 4 ) ) { | |
| 91 | + $text_url = substr( $text_url, 4 ); | |
| 89 | 92 | $invisible_prefix .= 'www.'; |
| 90 | 93 | } |
| 91 | 94 | if ( ! empty( $parsed_url['port'] ) ) { |
| 92 | 95 | $text_url .= ':' . $parsed_url['port']; |
| @@ -113,17 +116,17 @@ | ||
| 113 | 116 | * Filters the rel attribute for ActivityPub links. |
| 114 | 117 | * |
| 115 | 118 | * @param string $rel The rel attribute string. Default 'nofollow noopener noreferrer'. |
| 116 | 119 | */ |
| 117 | - $rel = \apply_filters( 'activitypub_link_rel', 'nofollow noopener noreferrer' ); | |
| 120 | + $rel = apply_filters( 'activitypub_link_rel', 'nofollow noopener noreferrer' ); | |
| 118 | 121 | |
| 119 | 122 | return \sprintf( |
| 120 | 123 | '<a href="%s" target="_blank" rel="%s" translate="no"><span class="invisible">%s</span><span class="%s">%s</span><span class="invisible">%s</span></a>', |
| 121 | - \esc_url( $result[0] ), | |
| 124 | + esc_url( $result[0] ), | |
| 122 | 125 | $rel, |
| 123 | - \esc_html( $invisible_prefix ), | |
| 126 | + esc_html( $invisible_prefix ), | |
| 124 | 127 | $display_class, |
| 125 | - \esc_html( $display ), | |
| 126 | - \esc_html( $invisible_suffix ) | |
| 128 | + esc_html( $display ), | |
| 129 | + esc_html( $invisible_suffix ) | |
| 127 | 130 | ); |
| 128 | 131 | } |
| 129 | 132 | } |