updated plugin ActivityPub version 5.8.0

This commit is contained in:
2025-04-29 21:19:06 +00:00
committed by Gitium
parent 19dfd317cc
commit fdfbf76539
166 changed files with 14119 additions and 7163 deletions

View File

@ -10,12 +10,14 @@ namespace Activitypub\Model;
use WP_Query;
use Activitypub\Signature;
use Activitypub\Activity\Actor;
use Activitypub\Collection\Users;
use Activitypub\Collection\Actors;
use function Activitypub\get_rest_url_by_path;
/**
* Application class.
*
* @method int get__id() Gets the internal user ID for the application (always returns APPLICATION_USER_ID).
*/
class Application extends Actor {
/**
@ -23,7 +25,7 @@ class Application extends Actor {
*
* @var int
*/
protected $_id = Users::APPLICATION_USER_ID; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
protected $_id = Actors::APPLICATION_USER_ID; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Whether the Application is discoverable.
@ -94,7 +96,7 @@ class Application extends Actor {
* @return string The User-URL with @-Prefix for the username.
*/
public function get_alternate_url() {
return $this->get_url();
return $this->get_id();
}
/**
@ -118,7 +120,7 @@ class Application extends Actor {
/**
* Get the User-Icon.
*
* @return array The User-Icon.
* @return string[] The User-Icon.
*/
public function get_icon() {
// Try site icon first.
@ -152,7 +154,7 @@ class Application extends Actor {
/**
* Get the User-Header-Image.
*
* @return array|null The User-Header-Image.
* @return string[]|null The User-Header-Image.
*/
public function get_header_image() {
if ( \has_header_image() ) {
@ -185,7 +187,7 @@ class Application extends Actor {
$time = \time();
}
return \gmdate( 'Y-m-d\TH:i:s\Z', $time );
return \gmdate( ACTIVITYPUB_DATE_TIME_RFC3339, $time );
}
/**
@ -218,13 +220,13 @@ class Application extends Actor {
/**
* Returns the public key.
*
* @return array The public key.
* @return string[] The public key.
*/
public function get_public_key() {
return array(
'id' => $this->get_id() . '#main-key',
'owner' => $this->get_id(),
'publicKeyPem' => Signature::get_public_key_for( Users::APPLICATION_USER_ID ),
'publicKeyPem' => Signature::get_public_key_for( Actors::APPLICATION_USER_ID ),
);
}