PluginProbe
ActivityPub / 3.2.1
ActivityPub v3.2.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 / load.php

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

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