PluginProbe
ActivityPub / 3.2.3
ActivityPub v3.2.3
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.3, at integration/load.php

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