updated plugin ActivityPub version 2.0.1

This commit is contained in:
2024-02-08 12:31:25 +00:00
committed by Gitium
parent 6e1c54f7ba
commit 50bf15833c
58 changed files with 1772 additions and 543 deletions

View File

@ -38,6 +38,15 @@ class Application_User extends Blog_User {
return get_rest_url_by_path( 'application' );
}
/**
* Returns the User-URL with @-Prefix for the username.
*
* @return string The User-URL with @-Prefix for the username.
*/
public function get_alternate_url() {
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() );
}
public function get_name() {
return 'application';
}
@ -69,4 +78,8 @@ class Application_User extends Blog_User {
public function get_indexable() {
return false;
}
public function get_type() {
return $this->type;
}
}

View File

@ -100,12 +100,12 @@ class Blog_User extends User {
}
/**
* Returns the User-URL with @-Prefix for the username.
* Get blog's homepage URL.
*
* @return string The User-URL with @-Prefix for the username.
* @return string The User-Url.
*/
public function get_at_url() {
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() );
public function get_alternate_url() {
return \esc_url( \trailingslashit( get_home_url() ) );
}
/**

View File

@ -1,6 +1,7 @@
<?php
namespace Activitypub\Model;
use Activitypub\Collection\Users;
use Activitypub\Transformer\Post as Post_Transformer;
/**
@ -61,7 +62,7 @@ class Post {
* @return string The URL of the Actor.
*/
public function get_actor() {
$user = User_Factory::get_by_id( $this->get_user_id() );
$user = Users::get_by_id( $this->get_user_id() );
return $user->get_url();
}

View File

@ -64,7 +64,7 @@ class User extends Actor {
*
* @var string<url>
*/
protected $resource;
protected $webfinger;
/**
* Restrict posting to mods
@ -135,8 +135,8 @@ class User extends Actor {
*
* @return string The User-URL with @-Prefix for the username.
*/
public function get_at_url() {
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_username() );
public function get_alternate_url() {
return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() );
}
public function get_preferred_username() {
@ -226,6 +226,18 @@ class User extends Actor {
return get_rest_url_by_path( sprintf( 'users/%d/collections/featured', $this->get__id() ) );
}
public function get_endpoints() {
$endpoints = null;
if ( ACTIVITYPUB_SHARED_INBOX_FEATURE ) {
$endpoints = array(
'sharedInbox' => get_rest_url_by_path( 'inbox' ),
);
}
return $endpoints;
}
/**
* Extend the User-Output with Attachments.
*
@ -274,10 +286,14 @@ class User extends Actor {
*
* @return string The Webfinger-Identifier.
*/
public function get_resource() {
public function get_webfinger() {
return $this->get_preferred_username() . '@' . \wp_parse_url( \home_url(), \PHP_URL_HOST );
}
public function get_resource() {
return $this->get_webfinger();
}
public function get_canonical_url() {
return $this->get_url();
}