diff --git a/activitypub.php b/activitypub.php index 11e8be36..748fa095 100644 --- a/activitypub.php +++ b/activitypub.php @@ -29,6 +29,7 @@ require_once __DIR__ . '/includes/functions.php'; */ \defined( 'ACTIVITYPUB_REST_NAMESPACE' ) || \define( 'ACTIVITYPUB_REST_NAMESPACE', 'activitypub/1.0' ); \defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 ); +\defined( 'ACTIVITYPUB_NOTE_LENGTH' ) || \define( 'ACTIVITYPUB_NOTE_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:]]|$))' );
diff --git a/includes/rest/class-collection.php b/includes/rest/class-collection.php
index 02cc99bf..97f17676 100644
--- a/includes/rest/class-collection.php
+++ b/includes/rest/class-collection.php
@@ -218,7 +218,7 @@ class Collection {
if ( ! is_single_user() && User_Collection::BLOG_USER_ID === $user->get__id() ) {
$posts = array();
- } elseif ( $sticky_posts ) {
+ } elseif ( is_array( $sticky_posts ) ) {
$args = array(
'post__in' => $sticky_posts,
'ignore_sticky_posts' => 1,
diff --git a/includes/transformer/class-post.php b/includes/transformer/class-post.php
index f18693fb..2067677d 100644
--- a/includes/transformer/class-post.php
+++ b/includes/transformer/class-post.php
@@ -642,9 +642,15 @@ class Post extends Base {
return \ucfirst( $post_format_setting );
}
- $has_title = post_type_supports( $this->wp_object->post_type, 'title' );
+ $has_title = \post_type_supports( $this->wp_object->post_type, 'title' );
+ $content = \wp_strip_all_tags( $this->wp_object->post_content );
- if ( ! $has_title ) {
+ // Check if the post has a title.
+ if (
+ ! $has_title ||
+ ! $this->wp_object->post_title ||
+ \strlen( $content ) <= ACTIVITYPUB_NOTE_LENGTH
+ ) {
return 'Note';
}