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 / integration / class-stream-connector.php

class-stream-connector.php in ActivityPub 3.2.3, at integration/class-stream-connector.php

79 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Activitypub\Integration;
3
4 /**
5 * Stream Connector for ActivityPub
6 *
7 * This class is a Stream Connector for the Stream plugin.
8 *
9 * @see https://wordpress.org/plugins/stream/
10 */
11 class Stream_Connector extends \WP_Stream\Connector {
12 /**
13 * Connector slug
14 *
15 * @var string
16 */
17 public $name = 'activitypub';
18
19 /**
20 * Actions registered for this connector
21 *
22 * @var array
23 */
24 public $actions = array(
25 'activitypub_notification_follow',
26 );
27
28 /**
29 * Return translated connector label
30 *
31 * @return string
32 */
33 public function get_label() {
34 return __( 'ActivityPub', 'activitypub' );
35 }
36
37 /**
38 * Return translated context labels
39 *
40 * @return array
41 */
42 public function get_context_labels() {
43 return array();
44 }
45
46 /**
47 * Return translated action labels
48 *
49 * @return array
50 */
51 public function get_action_labels() {
52 return array();
53 }
54
55 /**
56 * Callback for activitypub_notification_follow
57 *
58 * @param \Activitypub\Notification $notification The notification object
59 *
60 * @return void
61 */
62 public function callback_activitypub_notification_follow( $notification ) {
63 $this->log(
64 sprintf(
65 // translators: %s is a URL
66 __( 'New Follower: %s', 'activitypub' ),
67 $notification->actor
68 ),
69 array(
70 'notification' => \wp_json_encode( $notification, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ),
71 ),
72 null,
73 'notification',
74 $notification->type,
75 $notification->target
76 );
77 }
78 }
79