2023-11-24 15:36:51 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2024-10-02 20:09:37 +02:00
|
|
|
* Plugin Name: ActivityPub Event Bridge
|
2024-10-02 20:21:10 +02:00
|
|
|
* Description: Integrating popular event plugins with the ActivityPub plugin.
|
2024-09-11 00:41:37 +02:00
|
|
|
* Plugin URI: https://event-federation.eu/
|
|
|
|
* Version: 0.1.0
|
|
|
|
* Author: André Menrath
|
|
|
|
* Author URI: https://graz.social/@linos
|
2024-10-02 20:09:37 +02:00
|
|
|
* Text Domain: activitypub-event-bridge
|
2024-09-11 00:41:37 +02:00
|
|
|
* License: AGPL-3.0-or-later
|
|
|
|
* License URI: https://www.gnu.org/licenses/agpl-3.0.de.html
|
|
|
|
* Requires PHP: 8.1
|
2023-11-24 15:36:51 +01:00
|
|
|
*
|
2024-09-11 13:55:37 +02:00
|
|
|
* Requires at least ActivityPub plugin with version >= 3.2.2. ActivityPub plugin tested up to: 3.2.2.
|
2024-07-05 13:29:13 +02:00
|
|
|
*
|
2024-10-02 20:09:37 +02:00
|
|
|
* @package ActivityPub_Event_Bridge
|
2023-12-04 19:27:57 +01:00
|
|
|
* @license AGPL-3.0-or-later
|
2023-11-24 15:36:51 +01:00
|
|
|
*/
|
|
|
|
|
2024-07-05 13:29:13 +02:00
|
|
|
// Exit if accessed directly.
|
|
|
|
defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore
|
2023-11-24 15:36:51 +01:00
|
|
|
|
2024-10-02 20:09:37 +02:00
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_VERSION', current( get_file_data( __FILE__, array( 'Version' ), 'plugin' ) ) );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_DOMAIN', 'activitypub-event-bridge' );
|
|
|
|
define( 'ACTIVITYPUB_EVENT_BRIDGE_ACTIVITYPUB_PLUGIN_MIN_VERSION', '3.2.2' );
|
2024-07-05 13:29:13 +02:00
|
|
|
|
|
|
|
// Include and register the autoloader class for automatic loading of plugin classes.
|
2024-10-02 20:09:37 +02:00
|
|
|
require_once ACTIVITYPUB_EVENT_BRIDGE_PLUGIN_DIR . '/includes/class-autoloader.php';
|
|
|
|
ActivityPub_Event_Bridge\Autoloader::register();
|
2024-07-05 13:29:13 +02:00
|
|
|
|
|
|
|
// Initialize the plugin.
|
2024-10-02 20:09:37 +02:00
|
|
|
ActivityPub_Event_Bridge\Setup::get_instance();
|
2024-03-08 15:56:54 +01:00
|
|
|
|
2024-09-21 11:00:33 +02:00
|
|
|
// BeforeFirstRelease: Remove everything after this after here.
|
2024-01-04 11:25:29 +01:00
|
|
|
|
2024-01-03 19:31:01 +01:00
|
|
|
/**
|
|
|
|
* Add a filter for http_request_host_is_external
|
|
|
|
*
|
2024-09-21 11:00:33 +02:00
|
|
|
* BeforeFirstRelease: Remove this for release.
|
2024-01-03 19:31:01 +01:00
|
|
|
*/
|
2024-10-02 20:09:37 +02:00
|
|
|
add_filter( 'http_request_host_is_external', 'activitypub_event_bridge_custom_http_request_host_is_external', 10, 3 );
|
2023-12-12 17:27:43 +01:00
|
|
|
|
2024-07-05 13:29:13 +02:00
|
|
|
/**
|
|
|
|
* Add a filter for http_request_host_is_external
|
|
|
|
*
|
2024-09-21 11:00:33 +02:00
|
|
|
* BeforeFirstRelease: Remove this for release.
|
2024-07-05 13:29:13 +02:00
|
|
|
*
|
2024-08-27 21:13:37 +02:00
|
|
|
* @param bool $is_external Whether the request is external.
|
2024-07-05 13:29:13 +02:00
|
|
|
*/
|
2024-10-02 20:09:37 +02:00
|
|
|
function activitypub_event_bridge_custom_http_request_host_is_external( $is_external ) {
|
2024-01-03 19:31:01 +01:00
|
|
|
$is_external = true;
|
2023-12-12 17:27:43 +01:00
|
|
|
|
2024-01-03 19:31:01 +01:00
|
|
|
return $is_external;
|
|
|
|
}
|
2023-12-12 17:27:43 +01:00
|
|
|
|
2024-01-03 19:31:01 +01:00
|
|
|
/**
|
|
|
|
* Don't verify ssl certs for testing.
|
|
|
|
*
|
2024-09-21 11:00:33 +02:00
|
|
|
* BeforeFirstRelease: Remove this for release.
|
2024-01-03 19:31:01 +01:00
|
|
|
*/
|
2024-10-02 20:09:37 +02:00
|
|
|
add_filter( 'https_ssl_verify', 'activitypub_event_bridge_dont_verify_local_dev_https', 10, 3 );
|
2023-12-12 17:27:43 +01:00
|
|
|
|
2024-08-27 21:13:37 +02:00
|
|
|
/**
|
2024-09-21 11:00:33 +02:00
|
|
|
* BeforeFirstRelease: remove it.
|
2024-08-27 21:13:37 +02:00
|
|
|
*/
|
2024-10-02 20:09:37 +02:00
|
|
|
function activitypub_event_bridge_dont_verify_local_dev_https() {
|
2024-01-03 19:31:01 +01:00
|
|
|
return false;
|
|
|
|
}
|