PluginProbe
ActivityPub / 5.7.0
ActivityPub v5.7.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 / integration / class-jetpack.php

class-jetpack.php in ActivityPub 5.7.0, at integration/class-jetpack.php

55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Jetpack integration file.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\Integration;
9
10 use Activitypub\Comment;
11
12 /**
13 * Jetpack integration class.
14 */
15 class Jetpack {
16
17 /**
18 * Initialize the class, registering WordPress hooks.
19 */
20 public static function init() {
21 \add_filter( 'jetpack_sync_post_meta_whitelist', array( self::class, 'add_sync_meta' ) );
22 \add_filter( 'jetpack_json_api_comment_types', array( self::class, 'add_comment_types' ) );
23 \add_filter( 'jetpack_api_include_comment_types_count', array( self::class, 'add_comment_types' ) );
24 }
25
26 /**
27 * Add ActivityPub meta keys to the Jetpack sync allow list.
28 *
29 * @param array $allow_list The Jetpack sync allow list.
30 *
31 * @return array The Jetpack sync allow list with ActivityPub meta keys.
32 */
33 public static function add_sync_meta( $allow_list ) {
34 if ( ! is_array( $allow_list ) ) {
35 return $allow_list;
36 }
37 $activitypub_meta_keys = array(
38 '_activitypub_user_id',
39 '_activitypub_inbox',
40 '_activitypub_actor_json',
41 );
42 return \array_merge( $allow_list, $activitypub_meta_keys );
43 }
44
45 /**
46 * Add custom comment types to the list of comment types.
47 *
48 * @param array $comment_types Default comment types.
49 * @return array
50 */
51 public static function add_comment_types( $comment_types ) {
52 return array_unique( \array_merge( $comment_types, Comment::get_comment_type_slugs() ) );
53 }
54 }
55