PluginProbe
ActivityPub / 9.0.1
ActivityPub v9.0.1
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 / stream / class-stream.php

class-stream.php in ActivityPub 9.0.1, at integration/stream/class-stream.php

59 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 * Stream integration file.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\Integration\Stream;
9
10 /**
11 * Stream integration.
12 *
13 * This class handles the compatibility with the Stream plugin.
14 *
15 * @see https://wordpress.org/plugins/stream/
16 */
17 class Stream {
18 /**
19 * Initialize the Stream integration.
20 */
21 public static function init() {
22 \add_filter( 'wp_stream_connectors', array( self::class, 'register_connector' ) );
23 \add_filter( 'wp_stream_posts_exclude_post_types', array( self::class, 'exclude_post_types' ) );
24 }
25
26 /**
27 * Register the Stream Connector for ActivityPub.
28 *
29 * @param array $classes The Stream connectors.
30 *
31 * @return array The Stream connectors with the ActivityPub connector.
32 */
33 public static function register_connector( $classes ) {
34 $class = new Connector();
35
36 if ( \method_exists( $class, 'is_dependency_satisfied' ) && $class->is_dependency_satisfied() ) {
37 $classes[] = $class;
38 }
39
40 return $classes;
41 }
42
43 /**
44 * Exclude ActivityPub post types from the Stream.
45 *
46 * @param array $post_types The post types to exclude.
47 *
48 * @return array The post types to exclude with ActivityPub post types.
49 */
50 public static function exclude_post_types( $post_types ) {
51 $post_types[] = 'ap_actor';
52 $post_types[] = 'ap_extrafield';
53 $post_types[] = 'ap_extrafield_blog';
54 $post_types[] = 'ap_post';
55
56 return $post_types;
57 }
58 }
59