PluginProbe
ActivityPub / 4.2.0
ActivityPub v4.2.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 / load.php

load.php in ActivityPub 4.2.0, at integration/load.php

156 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Load the ActivityPub integrations.
4 *
5 * @package Activitypub
6 */
7
8 namespace Activitypub\Integration;
9
10 /**
11 * Initialize the ActivityPub integrations.
12 */
13 function plugin_init() {
14 /**
15 * Adds WebFinger (plugin) support.
16 *
17 * This class handles the compatibility with the WebFinger plugin
18 * and coordinates the internal WebFinger implementation.
19 *
20 * @see https://wordpress.org/plugins/webfinger/
21 */
22 require_once __DIR__ . '/class-webfinger.php';
23 Webfinger::init();
24
25 /**
26 * Adds NodeInfo (plugin) support.
27 *
28 * This class handles the compatibility with the NodeInfo plugin
29 * and coordinates the internal NodeInfo implementation.
30 *
31 * @see https://wordpress.org/plugins/nodeinfo/
32 */
33 require_once __DIR__ . '/class-nodeinfo.php';
34 Nodeinfo::init();
35
36 /**
37 * Adds Enable Mastodon Apps support.
38 *
39 * This class handles the compatibility with the Enable Mastodon Apps plugin.
40 *
41 * @see https://wordpress.org/plugins/enable-mastodon-apps/
42 */
43 if ( \defined( 'ENABLE_MASTODON_APPS_VERSION' ) ) {
44 require_once __DIR__ . '/class-enable-mastodon-apps.php';
45 Enable_Mastodon_Apps::init();
46 }
47
48 /**
49 * Adds OpenGraph support.
50 *
51 * This class handles the compatibility with the OpenGraph plugin.
52 *
53 * @see https://wordpress.org/plugins/opengraph/
54 */
55 if ( '1' === \get_option( 'activitypub_use_opengraph', '1' ) ) {
56 require_once __DIR__ . '/class-opengraph.php';
57 Opengraph::init();
58 }
59
60 /**
61 * Adds Jetpack support.
62 *
63 * This class handles the compatibility with Jetpack.
64 *
65 * @see https://jetpack.com/
66 */
67 if ( \defined( 'JETPACK__VERSION' ) && ! \defined( 'IS_WPCOM' ) ) {
68 require_once __DIR__ . '/class-jetpack.php';
69 Jetpack::init();
70 }
71
72 /**
73 * Adds Seriously Simple Podcasting support.
74 *
75 * This class handles the compatibility with Seriously Simple Podcasting.
76 *
77 * @see https://wordpress.org/plugins/seriously-simple-podcasting/
78 */
79 if ( \defined( 'SSP_VERSION' ) ) {
80 add_filter(
81 'activitypub_transformer',
82 function ( $transformer, $data, $object_class ) {
83 if (
84 'WP_Post' === $object_class &&
85 \get_post_meta( $data->ID, 'audio_file', true )
86 ) {
87 require_once __DIR__ . '/class-seriously-simple-podcasting.php';
88 return new Seriously_Simple_Podcasting( $data );
89 }
90 return $transformer;
91 },
92 10,
93 3
94 );
95 }
96 }
97 \add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
98
99 /**
100 * Register the Stream Connector for ActivityPub.
101 *
102 * @param array $classes The Stream connectors.
103 *
104 * @return array The Stream connectors with the ActivityPub connector.
105 */
106 function register_stream_connector( $classes ) {
107 require plugin_dir_path( __FILE__ ) . '/class-stream-connector.php';
108
109 $class_name = '\Activitypub\Integration\Stream_Connector';
110
111 if ( ! class_exists( $class_name ) ) {
112 return;
113 }
114
115 wp_stream_get_instance();
116 $class = new $class_name();
117
118 if ( ! method_exists( $class, 'is_dependency_satisfied' ) ) {
119 return;
120 }
121
122 if ( $class->is_dependency_satisfied() ) {
123 $classes[] = $class;
124 }
125
126 return $classes;
127 }
128 add_filter( 'wp_stream_connectors', __NAMESPACE__ . '\register_stream_connector' );
129
130 // Excluded ActivityPub post types from the Stream.
131 add_filter(
132 'wp_stream_posts_exclude_post_types',
133 function ( $post_types ) {
134 $post_types[] = 'ap_follower';
135 $post_types[] = 'ap_extrafield';
136 $post_types[] = 'ap_extrafield_blog';
137 return $post_types;
138 }
139 );
140
141 /**
142 * Load the BuddyPress integration.
143 *
144 * Only load code that needs BuddyPress to run once BP is loaded and initialized.
145 *
146 * @see https://buddypress.org/
147 */
148 add_action(
149 'bp_include',
150 function () {
151 require_once __DIR__ . '/class-buddypress.php';
152 Buddypress::init();
153 },
154 0
155 );
156