PluginProbe
ActivityPub / 3.2.3
ActivityPub v3.2.3
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
activitypub / includes / class-notification.php

class-notification.php in ActivityPub 3.2.3, at includes/class-notification.php

62 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Activitypub;
4
5 /**
6 * Notification class.
7 */
8 class Notification {
9 /**
10 * The type of the notification.
11 *
12 * @var string
13 */
14 public $type;
15
16 /**
17 * The actor URL.
18 *
19 * @var string
20 */
21 public $actor;
22
23 /**
24 * The Activity object.
25 *
26 * @var array
27 */
28 public $object;
29
30 /**
31 * The WordPress User-Id.
32 *
33 * @var int
34 */
35 public $target;
36
37 /**
38 * Notification constructor.
39 *
40 * @param string $type The type of the notification.
41 * @param string $actor The actor URL.
42 * @param array $object The Activity object.
43 * @param int $target The WordPress User-Id.
44 */
45 public function __construct( $type, $actor, $object, $target ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.objectFound
46 $this->type = $type;
47 $this->actor = $actor;
48 $this->object = $object;
49 $this->target = $target;
50 }
51
52 /**
53 * Send the notification.
54 */
55 public function send() {
56 $type = \strtolower( $this->type );
57
58 do_action( 'activitypub_notification', $this );
59 do_action( "activitypub_notification_{$type}", $this );
60 }
61 }
62