PluginProbe
ActivityPub / 1.3.0
ActivityPub v1.3.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
activitypub / includes / handler / class-undo.php

class-undo.php in ActivityPub 1.3.0, at includes/handler/class-undo.php

32 lines 706 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Activitypub\Handler;
3
4 use Activitypub\Collection\Followers;
5
6 /**
7 * Handle Undo requests
8 */
9 class Undo {
10 /**
11 * Initialize the class, registering WordPress hooks
12 */
13 public static function init() {
14 \add_action( 'activitypub_inbox_undo', array( self::class, 'handle_undo' ), 10, 2 );
15 }
16
17 /**
18 * Handle "Unfollow" requests
19 *
20 * @param array $activity The JSON "Undo" Activity
21 * @param int $user_id The ID of the ID of the WordPress User
22 */
23 public static function handle_undo( $activity, $user_id ) {
24 if (
25 isset( $activity['object']['type'] ) &&
26 'Follow' === $activity['object']['type']
27 ) {
28 Followers::remove_follower( $user_id, $activity['actor'] );
29 }
30 }
31 }
32