diff --git a/includes/class-activitypub-admin.php b/includes/class-activitypub-admin.php index bf14d73..179ca12 100644 --- a/includes/class-activitypub-admin.php +++ b/includes/class-activitypub-admin.php @@ -29,7 +29,26 @@ class Activitypub_Admin { * Register PubSubHubbub settings */ public static function register_settings() { - register_setting( 'activitypub', 'activitypub_feed_use_excerpt' ); + register_setting( + 'activitypub', 'activitypub_add_summary', array( + 'type' => 'boolean', + 'description' => __( 'Adds a "summary" to the Activity-Objects', 'activitypub' ), + 'show_in_rest' => true, + 'default' => 0, + ) + ); + register_setting( + 'activitypub', 'activitypub_object_type', array( + 'type' => 'string', + 'description' => __( 'The Activity-Object-Type', 'activitypub' ), + 'show_in_rest' => array( + 'schema' => array( + 'enum' => array( 'note', 'article', 'wordpress-post-format' ) + ), + ), + 'default' => 'note', + ) + ); } public static function add_help_tab() { diff --git a/includes/class-activitypub-post.php b/includes/class-activitypub-post.php index cd4c181..1d7bbad 100644 --- a/includes/class-activitypub-post.php +++ b/includes/class-activitypub-post.php @@ -27,7 +27,7 @@ class Activitypub_Post { 'type' => $this->get_object_type(), 'published' => date( 'Y-m-d\TH:i:s\Z', strtotime( $post->post_date ) ), 'attributedTo' => get_author_posts_url( $post->post_author ), - 'summary' => apply_filters( 'the_excerpt', activitypub_get_the_excerpt( $post->ID, 400 ) ), + 'summary' => get_option( 'activitypub_add_summary', false ) ? apply_filters( 'the_excerpt', activitypub_get_the_excerpt( $post->ID, 400 ) ) : null, 'inReplyTo' => null, 'content' => apply_filters( 'the_content', get_post_field( 'post_content', $post->ID ) ), 'contentMap' => array( @@ -120,7 +120,7 @@ class Activitypub_Post { $tag = array( "type" => "Hashtag", "href" => get_tag_link( $post_tag->term_id ), - "name" => '#' . $post_tag->name, + "name" => '#' . $post_tag->slug, ); $tags[] = $tag; } @@ -138,6 +138,10 @@ class Activitypub_Post { * @return string the object-type */ public function get_object_type() { + if ( get_option( 'activitypub_object_type', 'note' ) !== "wordpress-post-format" ) { + return ucfirst( get_option( 'activitypub_object_type', 'note' ) ); + } + $post_type = get_post_type( $this->post ); switch ( $post_type ) { case 'post': diff --git a/templates/settings-page.php b/templates/settings-page.php index d7cc110..d48d45d 100644 --- a/templates/settings-page.php +++ b/templates/settings-page.php @@ -6,6 +6,42 @@
+

+ +

+ + + + + + + + + + + + +
+ + + /> + +
+ + +

+

+

+

+

+

+
+ + +

@@ -55,7 +91,7 @@ - +