PluginProbe
ActivityPub / 4.7.1
ActivityPub v4.7.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 4.7.1, at integration/load.php

143 lines 3.3 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 \add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
105
106 /**
107 * Register the Stream Connector for ActivityPub.
108 *
109 * @param array $classes The Stream connectors.
110 *
111 * @return array The Stream connectors with the ActivityPub connector.
112 */
113 function register_stream_connector( $classes ) {
114 $class = new Stream_Connector();
115
116 if ( method_exists( $class, 'is_dependency_satisfied' ) && $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( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );
143