diff --git a/.wordpress-org/banner-1544x500.png b/.wordpress-org/banner-1544x500.png new file mode 100644 index 0000000..cfecda9 Binary files /dev/null and b/.wordpress-org/banner-1544x500.png differ diff --git a/.wordpress-org/banner-772x250-v1.png b/.wordpress-org/banner-772x250-v1.png deleted file mode 100644 index 7006253..0000000 Binary files a/.wordpress-org/banner-772x250-v1.png and /dev/null differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png index bf84cb3..c27ea7b 100644 Binary files a/.wordpress-org/banner-772x250.png and b/.wordpress-org/banner-772x250.png differ diff --git a/.wordpress-org/icon-256x256.png b/.wordpress-org/icon-256x256.png index 377026b..8fdcb96 100644 Binary files a/.wordpress-org/icon-256x256.png and b/.wordpress-org/icon-256x256.png differ diff --git a/.wordpress-org/icon-512x512.png b/.wordpress-org/icon-512x512.png new file mode 100644 index 0000000..aea11ed Binary files /dev/null and b/.wordpress-org/icon-512x512.png differ diff --git a/README.md b/README.md index f259f92..34991a5 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 4.7 **Tested up to:** 6.3 -**Stable tag:** 1.0.2 +**Stable tag:** 1.0.5 **Requires PHP:** 5.6 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -105,6 +105,23 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub). +### 1.0.5 ### + +* Fixed: compatibility with WebFinger and NodeInfo plugin + +### 1.0.4 ### + +* Fixed: Constants were not loaded early enough, resulting in a race condition +* Fixed: Featured image was ignored when using the block editor + +### 1.0.3 ### + +* Fixed: compatibility with older WordPress/PHP versions +* Update: refactoring of the Plugin init process +* Update: better frontend UX and improved theme compat for blocks +* Compatibility: add a ACTIVITYPUB_DISABLE_REWRITES constant +* Compatibility: add pre-fetch hook to allow plugins to hang filters on + ### 1.0.2 ### * Updated: improved hashtag visibility in default template diff --git a/activitypub.php b/activitypub.php index 38a3d07..3ae2be9 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * 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. - * Version: 1.0.2 + * Version: 1.0.5 * Author: Matthias Pfefferle & Automattic * Author URI: https://automattic.com/ * License: MIT @@ -17,27 +17,26 @@ namespace Activitypub; use function Activitypub\site_supports_blocks; +require_once __DIR__ . '/includes/compat.php'; require_once __DIR__ . '/includes/functions.php'; /** * Initialize the plugin constants. */ -function define_constants() { - \defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' ); - \defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 ); - \defined( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS' ) || \define( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS', true ); - \defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 ); - \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=
)|(?<=
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
- \defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' );
- \defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "[ap_title]\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" );
- \defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) || \define( 'ACTIVITYPUB_AUTHORIZED_FETCH', false );
- \defined( 'ACTIVITYPUB_DISABLE_REWRITES' ) || \define( 'ACTIVITYPUB_DISABLE_REWRITES', false );
+\defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' );
+\defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 );
+\defined( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS' ) || \define( 'ACTIVITYPUB_SHOW_PLUGIN_RECOMMENDATIONS', true );
+\defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 );
+\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=
)|(?<=
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' );
+\defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' );
+\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "[ap_title]\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" );
+\defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) || \define( 'ACTIVITYPUB_AUTHORIZED_FETCH', false );
+\defined( 'ACTIVITYPUB_DISABLE_REWRITES' ) || \define( 'ACTIVITYPUB_DISABLE_REWRITES', false );
- \define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
- \define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
- \define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
- \define( 'ACTIVITYPUB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
-}
+\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
+\define( 'ACTIVITYPUB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
/**
* Initialize REST routes.
@@ -63,8 +62,6 @@ function rest_init() {
* Initialize plugin.
*/
function plugin_init() {
- define_constants();
-
\add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Activitypub', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Activity_Dispatcher', 'init' ) );
@@ -85,6 +82,12 @@ function plugin_init() {
require_once $debug_file;
Debug::init();
}
+
+ require_once __DIR__ . '/integration/class-webfinger.php';
+ Integration\Webfinger::init();
+
+ require_once __DIR__ . '/integration/class-nodeinfo.php';
+ Integration\Nodeinfo::init();
}
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
diff --git a/includes/compat.php b/includes/compat.php
new file mode 100644
index 0000000..4bee640
--- /dev/null
+++ b/includes/compat.php
@@ -0,0 +1,37 @@
+ID );
-
- $array['links'][] = array(
- 'rel' => 'self',
- 'type' => 'application/activity+json',
- 'href' => $user->get_url(),
- );
-
- return $array;
- }
-
- /**
- * Add WebFinger discovery links
- *
- * @param array $array the jrd array
- * @param string $resource the WebFinger resource
- * @param WP_User $user the WordPress user
- *
- * @return array the jrd array
- */
- public static function add_pseudo_user_discovery( $array, $resource ) {
- if ( $array ) {
- return $array;
- }
-
- return self::get_profile( $resource );
- }
-
/**
* Get the WebFinger profile.
*
diff --git a/includes/transformer/class-post.php b/includes/transformer/class-post.php
index 50f4cf7..eb2bd5a 100644
--- a/includes/transformer/class-post.php
+++ b/includes/transformer/class-post.php
@@ -229,7 +229,8 @@ class Post {
if ( $max_images > 0 ) {
// first try to get images that are actually in the post content
if ( site_supports_blocks() && \has_blocks( $this->wp_post->post_content ) ) {
- $image_ids = $this->get_block_image_ids( $max_images, $image_ids );
+ $block_image_ids = $this->get_block_image_ids( $max_images, $image_ids );
+ $image_ids = \array_merge( $image_ids, $block_image_ids );
} else {
// fallback to images attached to the post
$query = new \WP_Query(
diff --git a/integration/class-buddypress.php b/integration/class-buddypress.php
index e4ec40e..45cfc0d 100644
--- a/integration/class-buddypress.php
+++ b/integration/class-buddypress.php
@@ -1,7 +1,15 @@
= '2.0' ) {
+ $nodeinfo['protocols'][] = 'activitypub';
+ } else {
+ $nodeinfo['protocols']['inbound'][] = 'activitypub';
+ $nodeinfo['protocols']['outbound'][] = 'activitypub';
+ }
+
+ return $nodeinfo;
+ }
+
+ /**
+ * Extend NodeInfo2 data
+ *
+ * @param array $nodeinfo NodeInfo2 data
+ *
+ * @return array The extended array
+ */
+ public static function add_nodeinfo2_discovery( $nodeinfo ) {
+ $nodeinfo['protocols'][] = 'activitypub';
+
+ return $nodeinfo;
+ }
+}
diff --git a/integration/class-webfinger.php b/integration/class-webfinger.php
new file mode 100644
index 0000000..e7e3935
--- /dev/null
+++ b/integration/class-webfinger.php
@@ -0,0 +1,57 @@
+ID );
+
+ $array['links'][] = array(
+ 'rel' => 'self',
+ 'type' => 'application/activity+json',
+ 'href' => $user->get_url(),
+ );
+
+ return $array;
+ }
+
+ /**
+ * Add WebFinger discovery links
+ *
+ * @param array $array the jrd array
+ * @param string $resource the WebFinger resource
+ * @param WP_User $user the WordPress user
+ *
+ * @return array the jrd array
+ */
+ public static function add_pseudo_user_discovery( $array, $resource ) {
+ if ( $array ) {
+ return $array;
+ }
+
+ return self::get_profile( $resource );
+ }
+}
diff --git a/readme.txt b/readme.txt
index 8bd325b..7faed3d 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nur
Tags: OStatus, fediverse, activitypub, activitystream
Requires at least: 4.7
Tested up to: 6.3
-Stable tag: 1.0.2
+Stable tag: 1.0.5
Requires PHP: 5.6
License: MIT
License URI: http://opensource.org/licenses/MIT
@@ -105,6 +105,23 @@ Where 'blog' is the path to the subdirectory at which your blog resides.
Project maintained on GitHub at [automattic/wordpress-activitypub](https://github.com/automattic/wordpress-activitypub).
+= 1.0.5 =
+
+* Fixed: compatibility with WebFinger and NodeInfo plugin
+
+= 1.0.4 =
+
+* Fixed: Constants were not loaded early enough, resulting in a race condition
+* Fixed: Featured image was ignored when using the block editor
+
+= 1.0.3 =
+
+* Fixed: compatibility with older WordPress/PHP versions
+* Update: refactoring of the Plugin init process
+* Update: better frontend UX and improved theme compat for blocks
+* Compatibility: add a ACTIVITYPUB_DISABLE_REWRITES constant
+* Compatibility: add pre-fetch hook to allow plugins to hang filters on
+
= 1.0.2 =
* Updated: improved hashtag visibility in default template