2024-06-27 12:10:38 +00:00
|
|
|
<?php
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Jetpack integration file.
|
|
|
|
*
|
|
|
|
* @package Activitypub
|
|
|
|
*/
|
|
|
|
|
2024-06-27 12:10:38 +00:00
|
|
|
namespace Activitypub\Integration;
|
|
|
|
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Jetpack integration class.
|
|
|
|
*/
|
2024-06-27 12:10:38 +00:00
|
|
|
class Jetpack {
|
|
|
|
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Initialize the class, registering WordPress hooks.
|
|
|
|
*/
|
2024-06-27 12:10:38 +00:00
|
|
|
public static function init() {
|
2024-10-09 12:44:17 +00:00
|
|
|
\add_filter( 'jetpack_sync_post_meta_whitelist', array( self::class, 'add_sync_meta' ) );
|
2024-06-27 12:10:38 +00:00
|
|
|
}
|
|
|
|
|
2024-10-09 12:44:17 +00:00
|
|
|
/**
|
|
|
|
* Add ActivityPub meta keys to the Jetpack sync allow list.
|
|
|
|
*
|
|
|
|
* @param array $allow_list The Jetpack sync allow list.
|
|
|
|
*
|
|
|
|
* @return array The Jetpack sync allow list with ActivityPub meta keys.
|
|
|
|
*/
|
|
|
|
public static function add_sync_meta( $allow_list ) {
|
|
|
|
if ( ! is_array( $allow_list ) ) {
|
|
|
|
return $allow_list;
|
2024-06-27 12:10:38 +00:00
|
|
|
}
|
2024-10-09 12:44:17 +00:00
|
|
|
$activitypub_meta_keys = array(
|
2024-06-27 12:10:38 +00:00
|
|
|
'activitypub_user_id',
|
|
|
|
'activitypub_inbox',
|
|
|
|
'activitypub_actor_json',
|
2024-10-09 12:44:17 +00:00
|
|
|
);
|
|
|
|
return \array_merge( $allow_list, $activitypub_meta_keys );
|
2024-06-27 12:10:38 +00:00
|
|
|
}
|
|
|
|
}
|