added profile fields

This commit is contained in:
Matthias Pfefferle 2018-11-04 21:38:11 +01:00
parent 64a5128e1e
commit f5e9c265d2
4 changed files with 49 additions and 14 deletions

View file

@ -23,11 +23,12 @@ If you want to have a **decentralized social network**, please use [Mastodon](ht
## Changelog ## ## Changelog ##
### 0.0.2 ### ### 0.0.2 ###
* refactorins * refactorins
* functional inbox * functional inbox
* nicer profile views
### 0.0.1 ### ### 0.0.1 ###

View file

@ -4,7 +4,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ActivityPub 0.0.2\n" "Project-Id-Version: ActivityPub 0.0.2\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\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" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
@ -13,11 +13,11 @@ msgstr ""
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"X-Generator: grunt-wp-i18n1.0.2\n" "X-Generator: grunt-wp-i18n1.0.2\n"
#: includes/class-activitypub-inbox.php:41 #: includes/class-activitypub-inbox.php:47
msgid "Invalid payload" msgid "Invalid payload"
msgstr "" msgstr ""
#: includes/class-activitypub-inbox.php:56 #: includes/class-activitypub-inbox.php:62
msgid "This method is not yet implemented" msgid "This method is not yet implemented"
msgstr "" msgstr ""
@ -26,6 +26,18 @@ msgstr ""
msgid "User not found" msgid "User not found"
msgstr "" 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 #. Plugin Name of the plugin/theme
msgid "ActivityPub" msgid "ActivityPub"
msgstr "" msgstr ""

View file

@ -23,11 +23,12 @@ If you want to have a **decentralized social network**, please use [Mastodon](ht
== Changelog == == Changelog ==
= 0.0.2 = = 0.0.2 =
* refactorins * refactorins
* functional inbox * functional inbox
* nicer profile views
= 0.0.1 = = 0.0.1 =

View file

@ -7,7 +7,7 @@ $json->{'@context'} = get_activitypub_context();
$json->id = get_author_posts_url( $author_id ); $json->id = get_author_posts_url( $author_id );
$json->type = 'Person'; $json->type = 'Person';
$json->name = get_the_author_meta( 'display_name', $author_id ); $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->preferredUsername = get_the_author_meta( 'login', $author_id ); // phpcs:ignore
$json->url = get_author_posts_url( $author_id ); $json->url = get_author_posts_url( $author_id );
$json->icon = array( $json->icon = array(
@ -38,6 +38,27 @@ $json->publicKey = array(
$json->tag = array(); $json->tag = array();
$json->attachment = array(); $json->attachment = array();
$json->attachment[] = array(
'type' => 'PropertyValue',
'name' => __( 'Blog', 'activitypub' ),
'value' => esc_html( '<a rel="me" title="' . esc_attr( home_url( '/' ) ) . '" target="_blank" href="' . home_url( '/' ) . '">' . wp_parse_url( home_url( '/' ), PHP_URL_HOST ) . '</a>' ),
);
$json->attachment[] = array(
'type' => 'PropertyValue',
'name' => __( 'Profile', 'activitypub' ),
'value' => esc_html( '<a rel="me" title="' . esc_attr( get_author_posts_url( $author_id ) ) . '" target="_blank" href="' . get_author_posts_url( $author_id ) . '">' . wp_parse_url( get_author_posts_url( $author_id ), PHP_URL_HOST ) . '</a>' ),
);
if ( get_the_author_meta( 'user_url', $author_id ) ) {
$json->attachment[] = array(
'type' => 'PropertyValue',
'name' => __( 'Website', 'activitypub' ),
'value' => esc_html( '<a rel="me" title="' . esc_attr( get_the_author_meta( 'user_url', $author_id ) ) . '" target="_blank" href="' . get_the_author_meta( 'user_url', $author_id ) . '">' . wp_parse_url( get_the_author_meta( 'user_url', $author_id ), PHP_URL_HOST ) . '</a>' ),
);
}
//$json->endpoints = array( //$json->endpoints = array(
// 'sharedInbox' => get_rest_url( null, '/activitypub/1.0/inbox' ), // 'sharedInbox' => get_rest_url( null, '/activitypub/1.0/inbox' ),
//); //);