PluginProbe
ActivityPub / 5.7.0
ActivityPub v5.7.0
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
← All changes | includes/model/class-application.php +41 -51 8.2.15.7.0 View file →
@@ -6,13 +6,14 @@
6 6 */
7 7
8 8 namespace Activitypub\Model;
9 9
10 +use WP_Query;
11 +use Activitypub\Signature;
10 12 use Activitypub\Activity\Actor;
11 13 use Activitypub\Collection\Actors;
12 14
13 15 use function Activitypub\get_rest_url_by_path;
14 -use function Activitypub\home_host;
15 16
16 17 /**
17 18 * Application class.
18 19 *
@@ -32,9 +33,9 @@
32 33 * @see https://docs.joinmastodon.org/spec/activitypub/#discoverable
33 34 *
34 35 * @context http://joinmastodon.org/ns#discoverable
35 36 *
36 - * @var bool
37 + * @var boolean
37 38 */
38 39 protected $discoverable = false;
39 40
40 41 /**
@@ -41,66 +42,36 @@
41 42 * Whether the Application is indexable.
42 43 *
43 44 * @context http://joinmastodon.org/ns#indexable
44 45 *
45 - * @var bool
46 + * @var boolean
46 47 */
47 48 protected $indexable = false;
48 49
49 50 /**
50 - * Whether the Application manually approves followers.
51 + * The WebFinger Resource.
51 52 *
52 - * @see https://docs.joinmastodon.org/spec/activitypub/#as
53 - *
54 - * @context as:manuallyApprovesFollowers
55 - *
56 - * @var bool
57 - */
58 - protected $manually_approves_followers = true;
59 -
60 - /**
61 - * List of software capabilities implemented by the Application.
62 - *
63 - * @see https://codeberg.org/silverpill/feps/src/branch/main/844e/fep-844e.md
64 - *
65 - * @var array
66 - */
67 - protected $implements = array(
68 - array(
69 - 'href' => 'https://datatracker.ietf.org/doc/html/rfc9421',
70 - 'name' => 'RFC-9421: HTTP Message Signatures',
71 - ),
72 - );
73 -
74 - /**
75 - * Set Application as invisible.
76 - *
77 - * @see https://litepub.social/
78 - *
79 - * @var bool
80 - */
81 - protected $invisible = true;
82 -
83 - /**
84 - * The type of the Actor.
85 - *
86 53 * @var string
87 54 */
88 - protected $type = 'Application';
55 + protected $webfinger;
89 56
90 57 /**
91 - * The Username.
58 + * Returns the type of the object.
92 59 *
93 - * @var string
60 + * @return string The type of the object.
94 61 */
95 - protected $name = 'application';
62 + public function get_type() {
63 + return 'Application';
64 + }
96 65
97 66 /**
98 - * The preferred username.
67 + * Returns whether the Application manually approves followers.
99 68 *
100 - * @var string
69 + * @return true Whether the Application manually approves followers.
101 70 */
102 - protected $preferred_username = 'application';
71 + public function get_manually_approves_followers() {
72 + return true;
73 + }
103 74
104 75 /**
105 76 * Returns the ID of the Application.
106 77 *
@@ -128,8 +99,26 @@
128 99 return $this->get_id();
129 100 }
130 101
131 102 /**
103 + * Get the Username.
104 + *
105 + * @return string The Username.
106 + */
107 + public function get_name() {
108 + return 'application';
109 + }
110 +
111 + /**
112 + * Get the preferred username.
113 + *
114 + * @return string The preferred username.
115 + */
116 + public function get_preferred_username() {
117 + return $this->get_name();
118 + }
119 +
120 + /**
132 121 * Get the User-Icon.
133 122 *
134 123 * @return string[] The User-Icon.
135 124 */
@@ -183,9 +172,9 @@
183 172 *
184 173 * @return string The published date.
185 174 */
186 175 public function get_published() {
187 - $first_post = new \WP_Query(
176 + $first_post = new WP_Query(
188 177 array(
189 178 'orderby' => 'date',
190 179 'order' => 'ASC',
191 180 'number' => 1,
@@ -236,9 +225,9 @@
236 225 public function get_public_key() {
237 226 return array(
238 227 'id' => $this->get_id() . '#main-key',
239 228 'owner' => $this->get_id(),
240 - 'publicKeyPem' => Actors::get_public_key( Actors::APPLICATION_USER_ID ),
229 + 'publicKeyPem' => Signature::get_public_key_for( Actors::APPLICATION_USER_ID ),
241 230 );
242 231 }
243 232
244 233 /**
@@ -246,12 +235,13 @@
246 235 *
247 236 * @return string The User description.
248 237 */
249 238 public function get_summary() {
250 - return sprintf(
251 - /* translators: %s: Domain of the site */
252 - __( 'This is the Application Actor for %s.', 'activitypub' ),
253 - home_host()
239 + return \wpautop(
240 + \wp_kses(
241 + \get_bloginfo( 'description' ),
242 + 'default'
243 + )
254 244 );
255 245 }
256 246
257 247 /**