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 / load.php

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

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