1515 * Initialize the ActivityPub integrations.
1616 */
1717function 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+
1829 /**
1930 * Adds Classic Editor support.
2031 *
@@ -27,26 +38,6 @@ function plugin_init() {
2738 Classic_Editor::init ();
2839 }
2940
30- /**
31- * Adds WebFinger (plugin) support.
32- *
33- * This class handles the compatibility with the WebFinger plugin
34- * and coordinates the internal WebFinger implementation.
35- *
36- * @see https://wordpress.org/plugins/webfinger/
37- */
38- Webfinger::init ();
39-
40- /**
41- * Adds NodeInfo (plugin) support.
42- *
43- * This class handles the compatibility with the NodeInfo plugin
44- * and coordinates the internal NodeInfo implementation.
45- *
46- * @see https://wordpress.org/plugins/nodeinfo/
47- */
48- Nodeinfo::init ();
49-
5041 /**
5142 * Adds Enable Mastodon Apps support.
5243 *
@@ -58,17 +49,6 @@ function plugin_init() {
5849 Enable_Mastodon_Apps::init ();
5950 }
6051
61- /**
62- * Adds OpenGraph support.
63- *
64- * This class handles the compatibility with the OpenGraph plugin.
65- *
66- * @see https://wordpress.org/plugins/opengraph/
67- */
68- if ( '1 ' === \get_option ( 'activitypub_use_opengraph ' , '1 ' ) ) {
69- Opengraph::init ();
70- }
71-
7252 /**
7353 * Adds Jetpack support.
7454 *
@@ -81,15 +61,13 @@ function plugin_init() {
8161 }
8262
8363 /**
84- * Adds Akismet support.
64+ * Adds LiteSpeed Cache support.
8565 *
86- * This class handles the compatibility with the Akismet plugin .
66+ * The check for whether LiteSpeed Cache is loaded and initialized happens inside Litespeed_Cache::init() .
8767 *
88- * @see https://wordpress.org/plugins/akismet /
68+ * @see https://wordpress.org/plugins/litespeed-cache /
8969 */
90- if ( \defined ( 'AKISMET_VERSION ' ) ) {
91- Akismet::init ();
92- }
70+ Litespeed_Cache::init ();
9371
9472 /**
9573 * Adds Multisite Language Switcher support.
@@ -102,6 +80,27 @@ function plugin_init() {
10280 Multisite_Language_Switcher::init ();
10381 }
10482
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+
105104 /**
106105 * Adds Seriously Simple Podcasting support.
107106 *
@@ -127,48 +126,65 @@ function ( $transformer, $data, $object_class ) {
127126 }
128127
129128 /**
130- * Adds WPML Multilingual CMS (plugin) support.
129+ * Adds Stream support.
131130 *
132- * This class handles the compatibility with the WPML plugin.
131+ * This class handles the compatibility with the Stream plugin.
133132 *
134- * @see https://wpml .org/
133+ * @see https://wordpress .org/plugins/stream /
135134 */
136- if ( \defined ( 'ICL_SITEPRESS_VERSION ' ) ) {
137- WPML ::init ();
138- }
135+ Stream \Stream::init ();
139136
140- if ( \class_exists ( 'WP_Rest_Cache_Plugin\Includes\Plugin ' ) ) {
141- WP_Rest_Cache::init ();
142- }
137+ /**
138+ * Adds Surge support.
139+ *
140+ * Only load code that needs Surge to run once Surge is loaded and initialized.
141+ *
142+ * @see https://wordpress.org/plugins/surge/
143+ */
144+ Surge::init ();
143145
144146 /**
145- * Adds Yoast SEO support.
147+ * Adds WebFinger (plugin) support.
146148 *
147- * This class handles the compatibility with Yoast SEO.
149+ * This class handles the compatibility with the WebFinger plugin
150+ * and coordinates the internal WebFinger implementation.
148151 *
149- * @see https://wordpress.org/plugins/wordpress-seo /
152+ * @see https://wordpress.org/plugins/webfinger /
150153 */
151- if ( \defined ( 'WPSEO_VERSION ' ) ) {
152- Yoast_Seo::init ();
154+ Webfinger::init ();
155+
156+ /**
157+ * Adds WP REST Cache support.
158+ *
159+ * This class handles the compatibility with the WP REST Cache plugin.
160+ *
161+ * @see https://wordpress.org/plugins/wp-rest-cache/
162+ */
163+ if ( \class_exists ( 'WP_Rest_Cache_Plugin\Includes\Plugin ' ) ) {
164+ WP_Rest_Cache::init ();
153165 }
154166
155167 /**
156- * Load the Surge integration .
168+ * Adds WPML Multilingual CMS (plugin) support .
157169 *
158- * Only load code that needs Surge to run once Surge is loaded and initialized .
170+ * This class handles the compatibility with the WPML plugin .
159171 *
160- * @see https://wordpress .org/plugins/surge /
172+ * @see https://wpml .org/
161173 */
162- Surge::init ();
174+ if ( \defined ( 'ICL_SITEPRESS_VERSION ' ) ) {
175+ WPML ::init ();
176+ }
163177
164178 /**
165- * Load the LiteSpeed Cache integration .
179+ * Adds Yoast SEO support .
166180 *
167- * The check for whether LiteSpeed Cache is loaded and initialized happens inside Litespeed_Cache::init() .
181+ * This class handles the compatibility with Yoast SEO .
168182 *
169- * @see https://wordpress.org/plugins/litespeed-cache /
183+ * @see https://wordpress.org/plugins/wordpress-seo /
170184 */
171- Litespeed_Cache::init ();
185+ if ( \defined ( 'WPSEO_VERSION ' ) ) {
186+ Yoast_Seo::init ();
187+ }
172188}
173189\add_action ( 'plugins_loaded ' , __NAMESPACE__ . '\plugin_init ' );
174190
@@ -180,43 +196,11 @@ function ( $transformer, $data, $object_class ) {
180196\register_activation_hook ( ACTIVITYPUB_PLUGIN_FILE , array ( __NAMESPACE__ . '\LiteSpeed_Cache ' , 'add_htaccess_rules ' ) );
181197\register_deactivation_hook ( ACTIVITYPUB_PLUGIN_FILE , array ( __NAMESPACE__ . '\LiteSpeed_Cache ' , 'remove_htaccess_rules ' ) );
182198
183-
184- /**
185- * Register the Stream Connector for ActivityPub.
186- *
187- * @param array $classes The Stream connectors.
188- *
189- * @return array The Stream connectors with the ActivityPub connector.
190- */
191- function register_stream_connector ( $ classes ) {
192- $ class = new Stream_Connector ();
193-
194- if ( method_exists ( $ class , 'is_dependency_satisfied ' ) && $ class ->is_dependency_satisfied () ) {
195- $ classes [] = $ class ;
196- }
197-
198- return $ classes ;
199- }
200- add_filter ( 'wp_stream_connectors ' , __NAMESPACE__ . '\register_stream_connector ' );
201-
202- // Excluded ActivityPub post types from the Stream.
203- add_filter (
204- 'wp_stream_posts_exclude_post_types ' ,
205- function ( $ post_types ) {
206- $ post_types [] = 'ap_actor ' ;
207- $ post_types [] = 'ap_extrafield ' ;
208- $ post_types [] = 'ap_extrafield_blog ' ;
209- $ post_types [] = 'ap_post ' ;
210-
211- return $ post_types ;
212- }
213- );
214-
215199/**
216200 * Load the BuddyPress integration.
217201 *
218202 * Only load code that needs BuddyPress to run once BP is loaded and initialized.
219203 *
220204 * @see https://buddypress.org/
221205 */
222- add_action ( 'bp_include ' , array ( __NAMESPACE__ . '\Buddypress ' , 'init ' ), 0 );
206+ \ add_action ( 'bp_include ' , array ( __NAMESPACE__ . '\Buddypress ' , 'init ' ), 0 );
0 commit comments