updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
|
||||
namespace Activitypub\Integration;
|
||||
|
||||
use function Activitypub\site_supports_blocks;
|
||||
|
||||
\Activitypub\Autoloader::register_path( __NAMESPACE__, __DIR__ );
|
||||
|
||||
/**
|
||||
@ -14,24 +16,27 @@ namespace Activitypub\Integration;
|
||||
*/
|
||||
function plugin_init() {
|
||||
/**
|
||||
* Adds WebFinger (plugin) support.
|
||||
* Adds Akismet support.
|
||||
*
|
||||
* This class handles the compatibility with the WebFinger plugin
|
||||
* and coordinates the internal WebFinger implementation.
|
||||
* This class handles the compatibility with the Akismet plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/webfinger/
|
||||
* @see https://wordpress.org/plugins/akismet/
|
||||
*/
|
||||
Webfinger::init();
|
||||
if ( \defined( 'AKISMET_VERSION' ) ) {
|
||||
Akismet::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds NodeInfo (plugin) support.
|
||||
* Adds Classic Editor support.
|
||||
*
|
||||
* This class handles the compatibility with the NodeInfo plugin
|
||||
* and coordinates the internal NodeInfo implementation.
|
||||
* This class handles the compatibility with the Classic Editor plugin
|
||||
* and sites without block editor support.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/nodeinfo/
|
||||
* @see https://wordpress.org/plugins/classic-editor/
|
||||
*/
|
||||
Nodeinfo::init();
|
||||
if ( \class_exists( '\Classic_Editor' ) || \function_exists( 'classicpress_version' ) || ! site_supports_blocks() ) {
|
||||
Classic_Editor::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Enable Mastodon Apps support.
|
||||
@ -44,17 +49,6 @@ function plugin_init() {
|
||||
Enable_Mastodon_Apps::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds OpenGraph support.
|
||||
*
|
||||
* This class handles the compatibility with the OpenGraph plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/opengraph/
|
||||
*/
|
||||
if ( '1' === \get_option( 'activitypub_use_opengraph', '1' ) ) {
|
||||
Opengraph::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Jetpack support.
|
||||
*
|
||||
@ -62,20 +56,18 @@ function plugin_init() {
|
||||
*
|
||||
* @see https://jetpack.com/
|
||||
*/
|
||||
if ( \defined( 'JETPACK__VERSION' ) && ! \defined( 'IS_WPCOM' ) ) {
|
||||
if ( \defined( 'JETPACK__VERSION' ) ) {
|
||||
Jetpack::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Akismet support.
|
||||
* Adds LiteSpeed Cache support.
|
||||
*
|
||||
* This class handles the compatibility with the Akismet plugin.
|
||||
* The check for whether LiteSpeed Cache is loaded and initialized happens inside Litespeed_Cache::init().
|
||||
*
|
||||
* @see https://wordpress.org/plugins/akismet/
|
||||
* @see https://wordpress.org/plugins/litespeed-cache/
|
||||
*/
|
||||
if ( \defined( 'AKISMET_VERSION' ) ) {
|
||||
Akismet::init();
|
||||
}
|
||||
Litespeed_Cache::init();
|
||||
|
||||
/**
|
||||
* Adds Multisite Language Switcher support.
|
||||
@ -88,6 +80,55 @@ function plugin_init() {
|
||||
Multisite_Language_Switcher::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds NodeInfo (plugin) support.
|
||||
*
|
||||
* This class handles the compatibility with the NodeInfo plugin
|
||||
* and coordinates the internal NodeInfo implementation.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/nodeinfo/
|
||||
*/
|
||||
Nodeinfo::init();
|
||||
|
||||
/**
|
||||
* Adds OpenGraph support.
|
||||
*
|
||||
* This class handles the compatibility with the OpenGraph plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/opengraph/
|
||||
*/
|
||||
if ( '1' === \get_option( 'activitypub_use_opengraph', '1' ) ) {
|
||||
Opengraph::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Podlove Podcast Publisher support.
|
||||
*
|
||||
* This class handles the compatibility with Podlove Podcast Publisher.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/podlove-podcasting-plugin-for-wordpress/
|
||||
*/
|
||||
if ( \defined( 'Podlove\PLUGIN_FILE' ) ) {
|
||||
// Enable ActivityPub support for the podcast post type.
|
||||
\add_post_type_support( 'podcast', 'activitypub' );
|
||||
|
||||
\add_filter(
|
||||
'activitypub_transformer',
|
||||
static function ( $transformer, $data, $object_class ) {
|
||||
if (
|
||||
'WP_Post' === $object_class &&
|
||||
'podcast' === $data->post_type &&
|
||||
\Podlove\Model\Episode::find_one_by_post_id( $data->ID )
|
||||
) {
|
||||
return new Podlove_Podcast_Publisher( $data );
|
||||
}
|
||||
return $transformer;
|
||||
},
|
||||
10,
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Seriously Simple Podcasting support.
|
||||
*
|
||||
@ -98,7 +139,7 @@ function plugin_init() {
|
||||
if ( \defined( 'SSP_VERSION' ) ) {
|
||||
add_filter(
|
||||
'activitypub_transformer',
|
||||
function ( $transformer, $data, $object_class ) {
|
||||
static function ( $transformer, $data, $object_class ) {
|
||||
if (
|
||||
'WP_Post' === $object_class &&
|
||||
\get_post_meta( $data->ID, 'audio_file', true )
|
||||
@ -112,6 +153,45 @@ function plugin_init() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Stream support.
|
||||
*
|
||||
* This class handles the compatibility with the Stream plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/stream/
|
||||
*/
|
||||
Stream\Stream::init();
|
||||
|
||||
/**
|
||||
* Adds Surge support.
|
||||
*
|
||||
* Only load code that needs Surge to run once Surge is loaded and initialized.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/surge/
|
||||
*/
|
||||
Surge::init();
|
||||
|
||||
/**
|
||||
* Adds WebFinger (plugin) support.
|
||||
*
|
||||
* This class handles the compatibility with the WebFinger plugin
|
||||
* and coordinates the internal WebFinger implementation.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/webfinger/
|
||||
*/
|
||||
Webfinger::init();
|
||||
|
||||
/**
|
||||
* Adds WP REST Cache support.
|
||||
*
|
||||
* This class handles the compatibility with the WP REST Cache plugin.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/wp-rest-cache/
|
||||
*/
|
||||
if ( \class_exists( 'WP_Rest_Cache_Plugin\Includes\Plugin' ) ) {
|
||||
WP_Rest_Cache::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds WPML Multilingual CMS (plugin) support.
|
||||
*
|
||||
@ -122,37 +202,27 @@ function plugin_init() {
|
||||
if ( \defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
||||
WPML::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Yoast SEO support.
|
||||
*
|
||||
* This class handles the compatibility with Yoast SEO.
|
||||
*
|
||||
* @see https://wordpress.org/plugins/wordpress-seo/
|
||||
*/
|
||||
if ( \defined( 'WPSEO_VERSION' ) ) {
|
||||
Yoast_Seo::init();
|
||||
}
|
||||
}
|
||||
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
|
||||
|
||||
/**
|
||||
* Register the Stream Connector for ActivityPub.
|
||||
*
|
||||
* @param array $classes The Stream connectors.
|
||||
*
|
||||
* @return array The Stream connectors with the ActivityPub connector.
|
||||
*/
|
||||
function register_stream_connector( $classes ) {
|
||||
$class = new Stream_Connector();
|
||||
// Register activation and deactivation hooks for Surge integration.
|
||||
\register_activation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\Surge', 'add_cache_config' ) );
|
||||
\register_deactivation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\Surge', 'remove_cache_config' ) );
|
||||
|
||||
if ( method_exists( $class, 'is_dependency_satisfied' ) && $class->is_dependency_satisfied() ) {
|
||||
$classes[] = $class;
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
add_filter( 'wp_stream_connectors', __NAMESPACE__ . '\register_stream_connector' );
|
||||
|
||||
// Excluded ActivityPub post types from the Stream.
|
||||
add_filter(
|
||||
'wp_stream_posts_exclude_post_types',
|
||||
function ( $post_types ) {
|
||||
$post_types[] = 'ap_follower';
|
||||
$post_types[] = 'ap_extrafield';
|
||||
$post_types[] = 'ap_extrafield_blog';
|
||||
return $post_types;
|
||||
}
|
||||
);
|
||||
// Register activation and deactivation hooks for LiteSpeed Cache integration.
|
||||
\register_activation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'add_htaccess_rules' ) );
|
||||
\register_deactivation_hook( ACTIVITYPUB_PLUGIN_FILE, array( __NAMESPACE__ . '\LiteSpeed_Cache', 'remove_htaccess_rules' ) );
|
||||
|
||||
/**
|
||||
* Load the BuddyPress integration.
|
||||
@ -161,4 +231,4 @@ add_filter(
|
||||
*
|
||||
* @see https://buddypress.org/
|
||||
*/
|
||||
add_action( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );
|
||||
\add_action( 'bp_include', array( __NAMESPACE__ . '\Buddypress', 'init' ), 0 );
|
||||
|
||||
Reference in New Issue
Block a user