2018-08-18 12:35:39 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Plugin Name: ActivityPub
|
|
|
|
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
|
|
|
|
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
2018-09-30 22:51:22 +02:00
|
|
|
* Version: 0.0.2
|
2018-08-18 12:35:39 +02:00
|
|
|
* Author: Matthias Pfefferle
|
|
|
|
* Author URI: https://notiz.blog/
|
|
|
|
* License: MIT
|
|
|
|
* License URI: http://opensource.org/licenses/MIT
|
|
|
|
* Text Domain: activitypub
|
|
|
|
* Domain Path: /languages
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize plugin
|
|
|
|
*/
|
|
|
|
function activitypub_init() {
|
2018-10-02 22:25:40 +02:00
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-activitypub-signature.php';
|
2018-09-30 22:51:22 +02:00
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-activitypub-post.php';
|
2018-12-08 00:02:18 +01:00
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-db-activitypub-actor.php';
|
2018-08-18 12:35:39 +02:00
|
|
|
require_once dirname( __FILE__ ) . '/includes/functions.php';
|
|
|
|
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-activitypub.php';
|
2018-09-27 22:28:02 +02:00
|
|
|
add_filter( 'template_include', array( 'Activitypub', 'render_json_template' ), 99 );
|
2018-09-05 22:03:57 +02:00
|
|
|
add_filter( 'query_vars', array( 'Activitypub', 'add_query_vars' ) );
|
|
|
|
add_action( 'init', array( 'Activitypub', 'add_rewrite_endpoint' ) );
|
|
|
|
|
|
|
|
// Configure the REST API route
|
2018-12-08 00:02:18 +01:00
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-rest-activitypub-outbox.php';
|
|
|
|
add_action( 'rest_api_init', array( 'Rest_Activitypub_Outbox', 'register_routes' ) );
|
|
|
|
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-rest-activitypub-inbox.php';
|
|
|
|
add_action( 'rest_api_init', array( 'Rest_Activitypub_Inbox', 'register_routes' ) );
|
|
|
|
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-rest-activitypub-followers.php';
|
|
|
|
add_action( 'rest_api_init', array( 'Rest_Activitypub_Followers', 'register_routes' ) );
|
|
|
|
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-rest-activitypub-webfinger.php';
|
|
|
|
add_action( 'webfinger_user_data', array( 'Rest_Activitypub_Webfinger', 'add_webfinger_discovery' ), 10, 3 );
|
|
|
|
|
|
|
|
// Configure activities
|
|
|
|
require_once dirname( __FILE__ ) . '/includes/class-activitypub-activities.php';
|
|
|
|
add_action( 'activitypub_inbox_follow', array( 'Activitypub_Activities', 'accept' ), 10, 2 );
|
|
|
|
add_action( 'activitypub_inbox_follow', array( 'Activitypub_Activities', 'follow' ), 10, 2 );
|
|
|
|
add_action( 'activitypub_inbox_unfollow', array( 'Activitypub_Activities', 'unfollow' ), 10, 2 );
|
2018-08-18 12:35:39 +02:00
|
|
|
}
|
|
|
|
add_action( 'plugins_loaded', 'activitypub_init' );
|