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#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 @@
+- - | -
-
-
|
-
---|