wordpress-activitypub/includes/class-webfinger.php
Matthias Pfefferle fba834b15d add some guidance
based on the feedback of users and the suggestion of @akirk
2022-11-15 18:22:08 +01:00

29 lines
608 B
PHP

<?php
namespace Activitypub;
/**
* ActivityPub WebFinger Class
*
* @author Matthias Pfefferle
*
* @see https://webfinger.net/
*/
class Webfinger {
/**
* Returns a users WebFinger "resource"
*
* @param int $user_id
*
* @return string The user-resource
*/
public static function get_resource( $user_id ) {
// use WebFinger plugin if installed
if ( \function_exists( '\get_webfinger_resource' ) ) {
return \get_webfinger_resource( $user_id, false );
}
$user = \get_user_by( 'id', $user_id );
return $user->user_login . '@' . \wp_parse_url( \home_url(), \PHP_URL_HOST );
}
}