' . $username . ''; return \sprintf( '%s', $metadata['url'], $username ); } return $result[0]; } public static function extract_mentions( $mentions, \ActivityPub\Model\Post $post ) { \preg_match_all( '/@' . ACTIVITYPUB_USERNAME_REGEXP . '/i', $post->get_content(), $matches ); foreach ( $matches[0] as $match ) { $link = \Activitypub\Rest\Webfinger::resolve( $match ); if ( ! is_wp_error( $link ) ) { $mentions[ $match ] = $link; } } return $mentions; } }