From f5e9c265d27d4bf3e4d3f05215f07b477b650aaf Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sun, 4 Nov 2018 21:38:11 +0100 Subject: [PATCH] added profile fields --- README.md | 11 ++++++----- languages/activitypub.pot | 18 +++++++++++++++--- readme.txt | 11 ++++++----- templates/json-author.php | 23 ++++++++++++++++++++++- 4 files changed, 49 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8adc07d..0ac0433 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,12 @@ If you want to have a **decentralized social network**, please use [Mastodon](ht ## Changelog ## - -### 0.0.2 ### - -* refactorins -* functional inbox + +### 0.0.2 ### + +* refactorins +* functional inbox +* nicer profile views ### 0.0.1 ### diff --git a/languages/activitypub.pot b/languages/activitypub.pot index ca41fa1..a26e0d2 100644 --- a/languages/activitypub.pot +++ b/languages/activitypub.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: ActivityPub 0.0.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n" -"POT-Creation-Date: 2018-09-30 20:50:08+00:00\n" +"POT-Creation-Date: 2018-11-04 20:21:26+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -13,11 +13,11 @@ msgstr "" "Language-Team: LANGUAGE \n" "X-Generator: grunt-wp-i18n1.0.2\n" -#: includes/class-activitypub-inbox.php:41 +#: includes/class-activitypub-inbox.php:47 msgid "Invalid payload" msgstr "" -#: includes/class-activitypub-inbox.php:56 +#: includes/class-activitypub-inbox.php:62 msgid "This method is not yet implemented" msgstr "" @@ -26,6 +26,18 @@ msgstr "" msgid "User not found" msgstr "" +#: templates/json-author.php:44 +msgid "Blog" +msgstr "" + +#: templates/json-author.php:50 +msgid "Profile" +msgstr "" + +#: templates/json-author.php:57 +msgid "Website" +msgstr "" + #. Plugin Name of the plugin/theme msgid "ActivityPub" msgstr "" diff --git a/readme.txt b/readme.txt index 437f7bd..8226c67 100644 --- a/readme.txt +++ b/readme.txt @@ -23,11 +23,12 @@ If you want to have a **decentralized social network**, please use [Mastodon](ht == Changelog == - -= 0.0.2 = - -* refactorins -* functional inbox + += 0.0.2 = + +* refactorins +* functional inbox +* nicer profile views = 0.0.1 = diff --git a/templates/json-author.php b/templates/json-author.php index 05b87f1..dce986b 100644 --- a/templates/json-author.php +++ b/templates/json-author.php @@ -7,7 +7,7 @@ $json->{'@context'} = get_activitypub_context(); $json->id = get_author_posts_url( $author_id ); $json->type = 'Person'; $json->name = get_the_author_meta( 'display_name', $author_id ); -$json->summary = wp_strip_all_tags( get_the_author_meta( 'description', $author_id ) ); +$json->summary = esc_html( get_the_author_meta( 'description', $author_id ) ); $json->preferredUsername = get_the_author_meta( 'login', $author_id ); // phpcs:ignore $json->url = get_author_posts_url( $author_id ); $json->icon = array( @@ -38,6 +38,27 @@ $json->publicKey = array( $json->tag = array(); $json->attachment = array(); + +$json->attachment[] = array( + 'type' => 'PropertyValue', + 'name' => __( 'Blog', 'activitypub' ), + 'value' => esc_html( '' . wp_parse_url( home_url( '/' ), PHP_URL_HOST ) . '' ), +); + +$json->attachment[] = array( + 'type' => 'PropertyValue', + 'name' => __( 'Profile', 'activitypub' ), + 'value' => esc_html( '' . wp_parse_url( get_author_posts_url( $author_id ), PHP_URL_HOST ) . '' ), +); + +if ( get_the_author_meta( 'user_url', $author_id ) ) { + $json->attachment[] = array( + 'type' => 'PropertyValue', + 'name' => __( 'Website', 'activitypub' ), + 'value' => esc_html( '' . wp_parse_url( get_the_author_meta( 'user_url', $author_id ), PHP_URL_HOST ) . '' ), + ); +} + //$json->endpoints = array( // 'sharedInbox' => get_rest_url( null, '/activitypub/1.0/inbox' ), //);