PluginProbe
ActivityPub / 7.8.2
ActivityPub v7.8.2
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 7.8.2, at includes/class-notification.php

86 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Notification file.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub;
9
10 /**
11 * Notification class.
12 *
13 * @deprecated 7.5.0 Use action hooks like 'activitypub_handled_{type}' instead.
14 */
15 class Notification {
16 /**
17 * The type of the notification.
18 *
19 * @var string
20 */
21 public $type;
22
23 /**
24 * The actor URL.
25 *
26 * @var string
27 */
28 public $actor;
29
30 /**
31 * The Activity object.
32 *
33 * @var array
34 */
35 public $object;
36
37 /**
38 * The WordPress User-Id.
39 *
40 * @var int
41 */
42 public $target;
43
44 /**
45 * Notification constructor.
46 *
47 * @param string $type The type of the notification.
48 * @param string $actor The actor URL.
49 * @param array $activity The Activity object.
50 * @param int $target The WordPress User-Id.
51 */
52 public function __construct( $type, $actor, $activity, $target ) {
53 \_deprecated_class( __CLASS__, '7.5.0', 'Use action hooks like "activitypub_handled_{type}" instead.' );
54
55 $this->type = $type;
56 $this->actor = $actor;
57 $this->object = $activity;
58 $this->target = $target;
59 }
60
61 /**
62 * Send the notification.
63 */
64 public function send() {
65 $type = \strtolower( $this->type );
66
67 /**
68 * Action to send ActivityPub notifications.
69 *
70 * @deprecated 7.5.0 Use "activitypub_handled_{$type}" instead.
71 *
72 * @param Notification $instance The notification object.
73 */
74 \do_action_deprecated( 'activitypub_notification', array( $this ), '7.5.0', "activitypub_handled_{$type}" );
75
76 /**
77 * Type-specific action to send ActivityPub notifications.
78 *
79 * @deprecated 7.5.0 Use "activitypub_handled_{$type}" instead.
80 *
81 * @param Notification $instance The notification object.
82 */
83 \do_action_deprecated( "activitypub_notification_{$type}", array( $this ), '7.5.0', "activitypub_handled_{$type}" );
84 }
85 }
86