PluginProbe
ActivityPub / 9.0.2
ActivityPub v9.0.2
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 9.0.2, at integration/load.php

235 lines 5.9 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 use function Activitypub\site_supports_blocks;
11
12 \Activitypub\Autoloader::register_path( __NAMESPACE__, __DIR__ );
13
14 /**
15 * Initialize the ActivityPub integrations.
16 */
17 function plugin_init() {
18 /**
19 * Adds Akismet support.
20 *
21 * This class handles the compatibility with the Akismet plugin.
22 *
23 * @see https://wordpress.org/plugins/akismet/
24 */
25 if ( \defined( 'AKISMET_VERSION' ) ) {
26 Akismet::init();
27 }
28
29 /**
30 * Adds Classic Editor support.
31 *
32 * This class handles the compatibility with the Classic Editor plugin
33 * and sites without block editor support.
34 *
35 * @see https://wordpress.org/plugins/classic-editor/
36 */
37 if ( \class_exists( '\Classic_Editor' ) || \function_exists( 'classicpress_version' ) || ! site_supports_blocks() ) {
38 Classic_Editor::init();
39 }
40
41 /**
42 * Adds Enable Mastodon Apps support.
43 *
44 * This class handles the compatibility with the Enable Mastodon Apps plugin.
45 *
46 * @see https://wordpress.org/plugins/enable-mastodon-apps/
47 */
48 if ( \defined( 'ENABLE_MASTODON_APPS_VERSION' ) ) {
49 Enable_Mastodon_Apps::init();
50 }
51
52 /**
53 * Adds Jetpack support.
54 *
55 * This class handles the compatibility with Jetpack.
56 *
57 * @see https://jetpack.com/
58 */
59 if ( \defined( 'JETPACK__VERSION' ) ) {
60 Jetpack::init();
61 }
62
63 /**
64 * Adds LiteSpeed Cache support.
65 *
66 * The check for whether LiteSpeed Cache is loaded and initialized happens inside Litespeed_Cache::init().
67 *
68 * @see https://wordpress.org/plugins/litespeed-cache/
69 */
70 Litespeed_Cache::init();
71
72 /**
73 * Adds Multisite Language Switcher support.
74 *
75 * This class handles the compatibility with the Multisite Language Switcher plugin.
76 *
77 * @see https://wordpress.org/plugins/multisite-language-switcher/
78 */
79 if ( \defined( 'MSLS_PLUGIN_VERSION' ) ) {
80 Multisite_Language_Switcher::init();
81 }
82
83 /**
84 * Adds NodeInfo (plugin) support.
85 *
86 * This class handles the compatibility with the NodeInfo plugin
87 * and coordinates the internal NodeInfo implementation.
88 *
89 * @see https://wordpress.org/plugins/nodeinfo/
90 */
91 Nodeinfo::init();
92
93 /**
94 * Adds OpenGraph support.
95 *
96 * This class handles the compatibility with the OpenGraph plugin.
97 *
98 * @see https://wordpress.org/plugins/opengraph/
99 */
100 if ( '1' === \get_option( 'activitypub_use_opengraph', '1' ) ) {
101 Opengraph::init();
102 }
103
104 /**
105 * Adds Podlove Podcast Publisher support.
106 *
107 * This class handles the compatibility with Podlove Podcast Publisher.
108 *
109 * @see https://wordpress.org/plugins/podlove-podcasting-plugin-for-wordpress/
110 */
111 if ( \defined( 'Podlove\PLUGIN_FILE' ) ) {
112 // Enable ActivityPub support for the podcast post type.
113 \add_post_type_support( 'podcast', 'activitypub' );
114
115 \add_filter(
116 'activitypub_transformer',
117 static function ( $transformer, $data, $object_class ) {
118 if (
119 'WP_Post' === $object_class &&
120 'podcast' === $data->post_type &&
121 \Podlove\Model\Episode::find_one_by_post_id( $data->ID )
122 ) {
123 return new Podlove_Podcast_Publisher( $data );
124 }
125 return $transformer;
126 },
127 10,
128 3
129 );
130 }
131
132 /**
133 * Adds Seriously Simple Podcasting support.
134 *
135 * This class handles the compatibility with Seriously Simple Podcasting.
136 *
137 * @see https://wordpress.org/plugins/seriously-simple-podcasting/
138 */
139 if ( \defined( 'SSP_VERSION' ) ) {
140 add_filter(
141 'activitypub_transformer',
142 static function ( $transformer, $data, $object_class ) {
143 if (
144 'WP_Post' === $object_class &&
145 \get_post_meta( $data->ID, 'audio_file', true )
146 ) {
147 return new Seriously_Simple_Podcasting( $data );
148 }
149 return $transformer;
150 },
151 10,
152 3
153 );
154 }
155
156 /**
157 * Adds Stream support.
158 *
159 * This class handles the compatibility with the Stream plugin.
160 *
161 * @see https://wordpress.org/plugins/stream/
162 */
163 Stream\Stream::init();
164
165 /**
166 * Adds Surge support.
167 *
168 * Only load code that needs Surge to run once Surge is loaded and initialized.
169 *
170 * @see https://wordpress.org/plugins/surge/
171 */
172 Surge::init();
173
174 /**
175 * Adds WebFinger (plugin) support.
176 *
177 * This class handles the compatibility with the WebFinger plugin
178 * and coordinates the internal WebFinger implementation.
179 *
180 * @see https://wordpress.org/plugins/webfinger/
181 */
182 Webfinger::init();
183
184 /**
185 * Adds WP REST Cache support.
186 *
187 * This class handles the compatibility with the WP REST Cache plugin.
188 *
189 * @see https://wordpress.org/plugins/wp-rest-cache/
190 */
191 if ( \class_exists( 'WP_Rest_Cache_Plugin\Includes\Plugin' ) ) {
192 WP_Rest_Cache::init();
193 }
194
195 /**
196 * Adds WPML Multilingual CMS (plugin) support.
197 *
198 * This class handles the compatibility with the WPML plugin.
199 *
200 * @see https://wpml.org/
201 */
202 if ( \defined( 'ICL_SITEPRESS_VERSION' ) ) {
203 WPML::init();
204 }
205
206 /**
207 * Adds Yoast SEO support.
208 *
209 * This class handles the compatibility with Yoast SEO.
210 *
211 * @see https://wordpress.org/plugins/wordpress-seo/
212 */
213 if ( \defined( 'WPSEO_VERSION' ) ) {
214 Yoast_Seo::init();
215 }
216 }
217 \add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
218
219 // Register activation and deactivation hooks for Surge integration.
220 \register_activation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\Surge', 'add_cache_config' ) );
221 \register_deactivation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\Surge', 'remove_cache_config' ) );
222
223 // Register activation and deactivation hooks for LiteSpeed Cache integration.
224 \register_activation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'add_htaccess_rules' ) );
225 \register_deactivation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'remove_htaccess_rules' ) );
226
227 /**
228 * Load the BuddyPress integration.
229 *
230 * Only load code that needs BuddyPress to run once BP is loaded and initialized.
231 *
232 * @see https://buddypress.org/
233 */
234 \add_action( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );
235