updated plugin ActivityPub
version 3.3.3
This commit is contained in:
@ -1,7 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Update handler file.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
namespace Activitypub\Handler;
|
||||
|
||||
use WP_Error;
|
||||
use Activitypub\Collection\Interactions;
|
||||
|
||||
use function Activitypub\get_remote_metadata_by_actor;
|
||||
@ -11,7 +16,7 @@ use function Activitypub\get_remote_metadata_by_actor;
|
||||
*/
|
||||
class Update {
|
||||
/**
|
||||
* Initialize the class, registering WordPress hooks
|
||||
* Initialize the class, registering WordPress hooks.
|
||||
*/
|
||||
public static function init() {
|
||||
\add_action(
|
||||
@ -23,24 +28,30 @@ class Update {
|
||||
/**
|
||||
* Handle "Update" requests
|
||||
*
|
||||
* @param array $array The activity-object
|
||||
* @param int $user_id The id of the local blog-user
|
||||
* @param array $activity The activity-object.
|
||||
*/
|
||||
public static function handle_update( $array ) {
|
||||
$object_type = isset( $array['object']['type'] ) ? $array['object']['type'] : '';
|
||||
public static function handle_update( $activity ) {
|
||||
$object_type = isset( $activity['object']['type'] ) ? $activity['object']['type'] : '';
|
||||
|
||||
switch ( $object_type ) {
|
||||
// Actor Types
|
||||
// @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
|
||||
/*
|
||||
* Actor Types.
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
|
||||
*/
|
||||
case 'Person':
|
||||
case 'Group':
|
||||
case 'Organization':
|
||||
case 'Service':
|
||||
case 'Application':
|
||||
self::update_actor( $array );
|
||||
self::update_actor( $activity );
|
||||
break;
|
||||
// Object and Link Types
|
||||
// @see https://www.w3.org/TR/activitystreams-vocabulary/#object-types
|
||||
|
||||
/*
|
||||
* Object and Link Types.
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitystreams-vocabulary/#object-types
|
||||
*/
|
||||
case 'Note':
|
||||
case 'Article':
|
||||
case 'Image':
|
||||
@ -48,22 +59,23 @@ class Update {
|
||||
case 'Video':
|
||||
case 'Event':
|
||||
case 'Document':
|
||||
self::update_interaction( $array );
|
||||
self::update_interaction( $activity );
|
||||
break;
|
||||
// Minimal Activity
|
||||
// @see https://www.w3.org/TR/activitystreams-core/#example-1
|
||||
|
||||
/*
|
||||
* Minimal Activity.
|
||||
*
|
||||
* @see https://www.w3.org/TR/activitystreams-core/#example-1
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an Interaction
|
||||
* Update an Interaction.
|
||||
*
|
||||
* @param array $activity The activity-object
|
||||
* @param int $user_id The id of the local blog-user
|
||||
*
|
||||
* @return void
|
||||
* @param array $activity The activity-object.
|
||||
*/
|
||||
public static function update_interaction( $activity ) {
|
||||
$commentdata = Interactions::update_comment( $activity );
|
||||
@ -80,16 +92,14 @@ class Update {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an Actor
|
||||
* Update an Actor.
|
||||
*
|
||||
* @param array $activity The activity-object
|
||||
*
|
||||
* @return void
|
||||
* @param array $activity The activity-object.
|
||||
*/
|
||||
public static function update_actor( $activity ) {
|
||||
// update cache
|
||||
// Update cache.
|
||||
get_remote_metadata_by_actor( $activity['actor'], false );
|
||||
|
||||
// @todo maybe also update all interactions
|
||||
// @todo maybe also update all interactions.
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user