diff --git a/README.md b/README.md index 38dbe4a..bd133f5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 4.7 **Tested up to:** 5.2.2 -**Stable tag:** 0.7.3 +**Stable tag:** 0.8.0 **Requires PHP:** 5.6 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -84,6 +84,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). +### 0.8.0 ### + +* Moved followers list to user-menu + ### 0.7.4 ### * added admin_email to metadata, to be able to "Manage your instance" on https://fediverse.network/manage/ diff --git a/activitypub.php b/activitypub.php index 9571e27..7082409 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: 0.7.4 + * Version: 0.8.0 * Author: Matthias Pfefferle * Author URI: https://notiz.blog/ * License: MIT @@ -21,6 +21,7 @@ namespace Activitypub; function init() { defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|^)#(\w*[A-Za-z_]+\w*)' ); + require_once dirname( __FILE__ ) . '/includes/table/followers-list.php'; require_once dirname( __FILE__ ) . '/includes/class-signature.php'; require_once dirname( __FILE__ ) . '/includes/class-activity.php'; require_once dirname( __FILE__ ) . '/includes/db/class-followers.php'; diff --git a/includes/class-admin.php b/includes/class-admin.php index e54d943..9de26c8 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -28,14 +28,25 @@ class Admin { array( '\Activitypub\Admin', 'settings_page' ) ); - add_action( 'load-' . $settings_page, array( '\Activitypub\Admin', 'add_help_tab' ) ); + add_action( 'load-' . $settings_page, array( '\Activitypub\Admin', 'add_settings_help_tab' ) ); + + $followers_list_page = add_users_page( __( 'Followers', 'activitypub' ), __( 'Followers (Fediverse)', 'activitypub' ), 'read', 'activitypub-followers-list', array( '\Activitypub\Admin', 'followers_list_page' ) ); + + add_action( 'load-' . $followers_list_page, array( '\Activitypub\Admin', 'add_followers_list_help_tab' ) ); } /** * Load settings page */ public static function settings_page() { - load_template( dirname( __FILE__ ) . '/../templates/settings-page.php' ); + load_template( dirname( __FILE__ ) . '/../templates/settings.php' ); + } + + /** + * Load user settings page + */ + public static function followers_list_page() { + load_template( dirname( __FILE__ ) . '/../templates/followers-list.php' ); } /** @@ -89,7 +100,7 @@ class Admin { ); } - public static function add_help_tab() { + public static function add_settings_help_tab() { get_current_screen()->add_help_tab( array( 'id' => 'overview', @@ -109,6 +120,10 @@ class Admin { ); } + public static function add_followers_list_help_tab() { + // todo + } + public static function add_fediverse_profile( $user ) { ?>

diff --git a/includes/db/class-followers.php b/includes/db/class-followers.php index cd1ed84..1981863 100644 --- a/includes/db/class-followers.php +++ b/includes/db/class-followers.php @@ -30,6 +30,12 @@ class Followers { return $followers; } + public static function count_followers( $author_id ) { + $followers = self::get_followers( $author_id ); + + return count( $followers ); + } + public static function add_follower( $actor, $author_id ) { $followers = get_user_option( 'activitypub_followers', $author_id ); diff --git a/includes/table/followers-list.php b/includes/table/followers-list.php new file mode 100644 index 0000000..6145acf --- /dev/null +++ b/includes/table/followers-list.php @@ -0,0 +1,36 @@ + __( 'Identifier', 'activitypub' ), + ); + } + + public function get_sortable_columns() { + return array(); + } + + public function prepare_items() { + $columns = $this->get_columns(); + $hidden = array(); + + $this->process_action(); + $this->_column_headers = array( $columns, $hidden, $this->get_sortable_columns() ); + + $this->items = array(); + + foreach ( \Activitypub\Db\Followers::get_followers( get_current_user_id() ) as $follower ) { + $this->items[]['identifier'] = esc_attr( $follower ); + } + } + + public function column_default( $item, $column_name ) { + return $item[ $column_name ]; + } +} diff --git a/languages/activitypub.pot b/languages/activitypub.pot index c576623..1b3666d 100644 --- a/languages/activitypub.pot +++ b/languages/activitypub.pot @@ -2,9 +2,10 @@ # This file is distributed under the MIT. msgid "" msgstr "" -"Project-Id-Version: ActivityPub 0.7.2\n" -"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n" -"POT-Creation-Date: 2019-07-28 20:11:43+00:00\n" +"Project-Id-Version: ActivityPub 0.8.0\n" +"Report-Msgid-Bugs-To: " +"https://wordpress.org/support/plugin/wordpress-activitypub\n" +"POT-Creation-Date: 2019-08-21 08:37:52+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -13,33 +14,41 @@ msgstr "" "Language-Team: LANGUAGE \n" "X-Generator: grunt-wp-i18n 1.0.3\n" -#: includes/class-admin.php:48 +#: includes/class-admin.php:33 +msgid "Followers" +msgstr "" + +#: includes/class-admin.php:33 templates/followers-list.php:2 +msgid "Followers (Fediverse)" +msgstr "" + +#: includes/class-admin.php:59 msgid "Use summary or full content" msgstr "" -#: includes/class-admin.php:60 +#: includes/class-admin.php:71 msgid "The Activity-Object-Type" msgstr "" -#: includes/class-admin.php:72 templates/settings-page.php:33 +#: includes/class-admin.php:83 templates/settings.php:33 msgid "Use the Shortlink instead of the permalink" msgstr "" -#: includes/class-admin.php:79 +#: includes/class-admin.php:90 msgid "" "Add hashtags in the content as native tags and replace the #tag with the " "tag-link" msgstr "" -#: includes/class-admin.php:86 +#: includes/class-admin.php:97 msgid "Add all tags as hashtags at the end of each activity" msgstr "" -#: includes/class-admin.php:96 +#: includes/class-admin.php:107 msgid "Overview" msgstr "" -#: includes/class-admin.php:98 +#: includes/class-admin.php:109 msgid "" "ActivityPub is a decentralized social networking protocol based on the " "ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended " @@ -49,33 +58,33 @@ msgid "" "subscribing to content." msgstr "" -#: includes/class-admin.php:103 +#: includes/class-admin.php:114 msgid "For more information:" msgstr "" -#: includes/class-admin.php:104 +#: includes/class-admin.php:115 msgid "Test Suite" msgstr "" -#: includes/class-admin.php:105 +#: includes/class-admin.php:116 msgid "W3C Spec" msgstr "" -#: includes/class-admin.php:106 +#: includes/class-admin.php:117 msgid "" "Give " "us feedback" msgstr "" -#: includes/class-admin.php:108 +#: includes/class-admin.php:119 msgid "Donate" msgstr "" -#: includes/class-admin.php:114 +#: includes/class-admin.php:129 msgid "Fediverse" msgstr "" -#: includes/db/class-followers.php:47 +#: includes/db/class-followers.php:53 msgid "Unknown Actor schema" msgstr "" @@ -106,7 +115,7 @@ msgstr "" #: includes/rest/class-followers.php:46 includes/rest/class-followers.php:49 #: includes/rest/class-following.php:46 includes/rest/class-following.php:49 -#: includes/rest/class-outbox.php:47 includes/rest/class-outbox.php:50 +#: includes/rest/class-outbox.php:45 includes/rest/class-outbox.php:48 #: includes/rest/class-webfinger.php:61 msgid "User not found" msgstr "" @@ -132,11 +141,19 @@ msgstr "" msgid "Resource host does not match blog host" msgstr "" +#: includes/table/followers-list.php:11 +msgid "Identifier" +msgstr "" + +#: templates/followers-list.php:4 +msgid "You currently have %s followers." +msgstr "" + #: templates/json-author.php:48 msgid "Blog" msgstr "" -#: templates/json-author.php:58 templates/settings-page.php:71 +#: templates/json-author.php:58 msgid "Profile" msgstr "" @@ -144,114 +161,94 @@ msgstr "" msgid "Website" msgstr "" -#: templates/settings-page.php:2 +#: templates/settings.php:2 msgid "ActivityPub Settings" msgstr "" -#: templates/settings-page.php:4 +#: templates/settings.php:4 msgid "" "ActivityPub turns your blog into a federated social network. This means you " "can share and talk to everyone using the ActivityPub protocol, including " "users of Friendica, Pleroma and Mastodon." msgstr "" -#: templates/settings-page.php:9 +#: templates/settings.php:9 msgid "Activities" msgstr "" -#: templates/settings-page.php:11 +#: templates/settings.php:11 msgid "All activity related settings." msgstr "" -#: templates/settings-page.php:17 +#: templates/settings.php:17 msgid "Post-Content" msgstr "" -#: templates/settings-page.php:21 +#: templates/settings.php:21 msgid "Excerpt" msgstr "" -#: templates/settings-page.php:21 +#: templates/settings.php:21 msgid "A content summary, shortened to 400 characters and without markup." msgstr "" -#: templates/settings-page.php:24 +#: templates/settings.php:24 msgid "Content (default)" msgstr "" -#: templates/settings-page.php:24 +#: templates/settings.php:24 msgid "The full content." msgstr "" -#: templates/settings-page.php:30 +#: templates/settings.php:30 msgid "Backlink" msgstr "" -#: templates/settings-page.php:39 +#: templates/settings.php:39 msgid "Activity-Object-Type" msgstr "" -#: templates/settings-page.php:43 +#: templates/settings.php:43 msgid "Note (default)" msgstr "" -#: templates/settings-page.php:43 +#: templates/settings.php:43 msgid "Should work with most platforms." msgstr "" -#: templates/settings-page.php:46 +#: templates/settings.php:46 msgid "Article" msgstr "" -#: templates/settings-page.php:46 +#: templates/settings.php:46 msgid "" "The presentation of the \"Article\" might change on different platforms. " "Mastodon for example shows the \"Article\" type as a simple link." msgstr "" -#: templates/settings-page.php:49 +#: templates/settings.php:49 msgid "WordPress Post-Format" msgstr "" -#: templates/settings-page.php:49 +#: templates/settings.php:49 msgid "Maps the WordPress Post-Format to the ActivityPub Object Type." msgstr "" -#: templates/settings-page.php:55 +#: templates/settings.php:55 msgid "Hashtags" msgstr "" -#: templates/settings-page.php:59 +#: templates/settings.php:59 msgid "" "Add hashtags in the content as native tags and replace the " "#tag with the tag-link." msgstr "" -#: templates/settings-page.php:62 +#: templates/settings.php:62 msgid "Add all tags as hashtags to the end of each activity." msgstr "" -#: templates/settings-page.php:73 -msgid "All profile related settings." -msgstr "" - -#: templates/settings-page.php:79 -msgid "Followers" -msgstr "" - -#: templates/settings-page.php:81 -msgid "All follower related settings." -msgstr "" - -#: templates/settings-page.php:87 -msgid "List of followers" -msgstr "" - -#: templates/settings-page.php:97 -msgid "No followers yet" -msgstr "" - -#: templates/settings-page.php:112 +#: templates/settings.php:77 msgid "" "If you like this plugin, what about a small donation?" diff --git a/readme.txt b/readme.txt index 9ad0ed3..fa8d90e 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://notiz.blog/donate/ Tags: OStatus, fediverse, activitypub, activitystream Requires at least: 4.7 Tested up to: 5.2.2 -Stable tag: 0.7.3 +Stable tag: 0.8.0 Requires PHP: 5.6 License: MIT License URI: http://opensource.org/licenses/MIT @@ -84,6 +84,10 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). += 0.8.0 = + +* Moved followers list to user-menu + = 0.7.4 = * added admin_email to metadata, to be able to "Manage your instance" on https://fediverse.network/manage/ diff --git a/templates/followers-list.php b/templates/followers-list.php new file mode 100644 index 0000000..46d5485 --- /dev/null +++ b/templates/followers-list.php @@ -0,0 +1,15 @@ +
+

+ +

+ + + +
+ + prepare_items(); + $token_table->display(); + ?> +
+
diff --git a/templates/settings-page.php b/templates/settings.php similarity index 81% rename from templates/settings-page.php rename to templates/settings.php index 208a16f..4d124e4 100644 --- a/templates/settings-page.php +++ b/templates/settings.php @@ -68,41 +68,6 @@ -

- -

- - - - - -

- -

- - - - - - - - -
- - - -
    - -
  • - -
- -

- -
- - -