This commit is contained in:
Matthias Pfefferle 2019-02-24 13:01:28 +01:00
parent 1828c88d73
commit a6d97f8ba7
14 changed files with 73 additions and 7 deletions

View file

@ -8,6 +8,7 @@
* Author URI: https://notiz.blog/ * Author URI: https://notiz.blog/
* License: MIT * License: MIT
* License URI: http://opensource.org/licenses/MIT * License URI: http://opensource.org/licenses/MIT
* Requires PHP: 5.6
* Text Domain: activitypub * Text Domain: activitypub
* Domain Path: /languages * Domain Path: /languages
*/ */
@ -15,7 +16,7 @@
namespace Activitypub; namespace Activitypub;
/** /**
* Initialize pluginut * Initialize plugin
*/ */
function init() { function init() {
defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(^|\s|>)#([^\s<>]+)\b' ); defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(^|\s|>)#([^\s<>]+)\b' );

View file

@ -5,6 +5,8 @@ namespace Activitypub;
* ActivityPub Post Class * ActivityPub Post Class
* *
* @author Matthias Pfefferle * @author Matthias Pfefferle
*
* @see https://www.w3.org/TR/activitypub/
*/ */
class Activity { class Activity {
private $context = array( 'https://www.w3.org/ns/activitystreams' ); private $context = array( 'https://www.w3.org/ns/activitystreams' );

View file

@ -7,6 +7,9 @@ namespace Activitypub;
* @author Matthias Pfefferle * @author Matthias Pfefferle
*/ */
class Activitypub { class Activitypub {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 ); add_filter( 'template_include', array( '\Activitypub\Activitypub', 'render_json_template' ), 99 );
add_filter( 'query_vars', array( '\Activitypub\Activitypub', 'add_query_vars' ) ); add_filter( 'query_vars', array( '\Activitypub\Activitypub', 'add_query_vars' ) );

View file

@ -3,8 +3,13 @@ namespace Activitypub;
/** /**
* ActivityPub Admin Class * ActivityPub Admin Class
*
* @author Matthias Pfefferle
*/ */
class Admin { class Admin {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_action( 'admin_menu', array( '\Activitypub\Admin', 'admin_menu' ) ); add_action( 'admin_menu', array( '\Activitypub\Admin', 'admin_menu' ) );
add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) ); add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) );

View file

@ -3,8 +3,13 @@ namespace Activitypub;
/** /**
* ActivityPub Hashtag Class * ActivityPub Hashtag Class
*
* @author Matthias Pfefferle
*/ */
class Hashtag { class Hashtag {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_filter( 'wp_insert_post', array( '\Activitypub\Hashtag', 'insert_post' ), 99, 2 ); add_filter( 'wp_insert_post', array( '\Activitypub\Hashtag', 'insert_post' ), 99, 2 );
add_filter( 'the_content', array( '\Activitypub\Hashtag', 'the_content' ), 99, 2 ); add_filter( 'the_content', array( '\Activitypub\Hashtag', 'the_content' ), 99, 2 );

View file

@ -10,7 +10,7 @@ class Post {
private $post; private $post;
/** /**
* * Initialize the class, registering WordPress hooks
*/ */
public static function init() { public static function init() {
add_filter( 'activitypub_the_summary', array( '\Activitypub\Post', 'add_backlink' ), 10, 2 ); add_filter( 'activitypub_the_summary', array( '\Activitypub\Post', 'add_backlink' ), 10, 2 );

View file

@ -1,6 +1,11 @@
<?php <?php
namespace Activitypub; namespace Activitypub;
/**
* ActivityPub Signature Class
*
* @author Matthias Pfefferle
*/
class Signature { class Signature {
/** /**

View file

@ -1,6 +1,11 @@
<?php <?php
namespace Activitypub\Db; namespace Activitypub\Db;
/**
* ActivityPub Followers DB-Class
*
* @author Matthias Pfefferle
*/
class Followers { class Followers {
public static function get_followers( $author_id ) { public static function get_followers( $author_id ) {

View file

@ -1,7 +1,17 @@
<?php <?php
namespace Activitypub\Rest; namespace Activitypub\Rest;
/**
* ActivityPub Followers REST-Class
*
* @author Matthias Pfefferle
*
* @see https://www.w3.org/TR/activitypub/#followers
*/
class Followers { class Followers {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Followers', 'register_routes' ) ); add_action( 'rest_api_init', array( '\Activitypub\Rest\Followers', 'register_routes' ) );
} }

View file

@ -2,11 +2,16 @@
namespace Activitypub\Rest; namespace Activitypub\Rest;
/** /**
* ActivityPub Inbox Class * ActivityPub Inbox REST-Class
* *
* @author Matthias Pfefferle * @author Matthias Pfefferle
*
* @see https://www.w3.org/TR/activitypub/#inbox
*/ */
class Inbox { class Inbox {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Inbox', 'register_routes' ) ); add_action( 'rest_api_init', array( '\Activitypub\Rest\Inbox', 'register_routes' ) );
//add_filter( 'rest_pre_serve_request', array( '\Activitypub\Rest\Inbox', 'serve_request' ), 11, 4 ); //add_filter( 'rest_pre_serve_request', array( '\Activitypub\Rest\Inbox', 'serve_request' ), 11, 4 );

View file

@ -1,7 +1,17 @@
<?php <?php
namespace Activitypub\Rest; namespace Activitypub\Rest;
/**
* ActivityPub NodeInfo REST-Class
*
* @author Matthias Pfefferle
*
* @see http://nodeinfo.diaspora.software/
*/
class Nodeinfo { class Nodeinfo {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) ); add_action( 'rest_api_init', array( '\Activitypub\Rest\Nodeinfo', 'register_routes' ) );
add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 ); add_filter( 'nodeinfo_data', array( '\Activitypub\Rest\Nodeinfo', 'add_nodeinfo_discovery' ), 10, 2 );

View file

@ -2,15 +2,15 @@
namespace Activitypub\Rest; namespace Activitypub\Rest;
/** /**
* ActivityPub Outbox Class * ActivityPub Outbox REST-Class
* *
* @author Matthias Pfefferle * @author Matthias Pfefferle
*
* @see https://www.w3.org/TR/activitypub/#outbox
*/ */
class Outbox { class Outbox {
/** /**
* Undocumented function * Initialize the class, registering WordPress hooks
*
* @return void
*/ */
public static function init() { public static function init() {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Outbox', 'register_routes' ) ); add_action( 'rest_api_init', array( '\Activitypub\Rest\Outbox', 'register_routes' ) );

View file

@ -1,7 +1,17 @@
<?php <?php
namespace Activitypub\Rest; namespace Activitypub\Rest;
/**
* ActivityPub WebFinger REST-Class
*
* @author Matthias Pfefferle
*
* @see https://webfinger.net/
*/
class Webfinger { class Webfinger {
/**
* Initialize the class, registering WordPress hooks
*/
public static function init() { public static function init() {
add_action( 'rest_api_init', array( '\Activitypub\Rest\Webfinger', 'register_routes' ) ); add_action( 'rest_api_init', array( '\Activitypub\Rest\Webfinger', 'register_routes' ) );
add_action( 'webfinger_user_data', array( '\Activitypub\Rest\Webfinger', 'add_webfinger_discovery' ), 10, 3 ); add_action( 'webfinger_user_data', array( '\Activitypub\Rest\Webfinger', 'add_webfinger_discovery' ), 10, 3 );

View file

@ -55,6 +55,11 @@ To implement:
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
= 0.5.0 =
* complete refactoring
* fixed bug #30: Password-protected posts are federated.
= 0.4.4 = = 0.4.4 =
* show avatars * show avatars