added setting to enable/disable hashtags /cc @chrisaldrich

This commit is contained in:
Matthias Pfefferle 2019-02-17 21:27:20 +01:00
parent 13bbfe0501
commit b958d5910c
7 changed files with 95 additions and 36 deletions

View file

@ -19,4 +19,4 @@ indent_style = space
indent_size = 2 indent_size = 2
[{*.txt,wp-config-sample.php}] [{*.txt,wp-config-sample.php}]
end_of_line = crlf end_of_line = lf

View file

@ -55,6 +55,12 @@ To implement:
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
### 0.4.0 ###
* added settings to enable/disable hashtag support
* fixed follower list
* send activities only for new posts, otherwise send updates
### 0.3.2 ### ### 0.3.2 ###
* added "followers" endpoint * added "followers" endpoint

View file

@ -3,7 +3,7 @@
* Plugin Name: ActivityPub * Plugin Name: ActivityPub
* Plugin URI: https://github.com/pfefferle/wordpress-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. * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
* Version: 0.3.2 * Version: 0.4.0
* Author: Matthias Pfefferle * Author: Matthias Pfefferle
* Author URI: https://notiz.blog/ * Author URI: https://notiz.blog/
* License: MIT * License: MIT
@ -70,9 +70,11 @@ function activitypub_init() {
add_action( 'admin_init', array( 'Activitypub_Admin', 'register_settings' ) ); add_action( 'admin_init', array( 'Activitypub_Admin', 'register_settings' ) );
add_action( 'show_user_profile', array( 'Activitypub_Admin', 'add_fediverse_profile' ) ); add_action( 'show_user_profile', array( 'Activitypub_Admin', 'add_fediverse_profile' ) );
if ( '1' === get_option( 'activitypub_use_hashtags', '1' ) ) {
require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php'; require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php';
add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 ); add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 );
add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 ); add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 );
}
} }
add_action( 'plugins_loaded', 'activitypub_init' ); add_action( 'plugins_loaded', 'activitypub_init' );

View file

@ -60,6 +60,13 @@ class Activitypub_Admin {
'default' => 0, 'default' => 0,
) )
); );
register_setting(
'activitypub', 'activitypub_use_hashtags', array(
'type' => 'boolean',
'description' => __( 'Use the Shortlink instead of the permalink', 'activitypub' ),
'default' => 0,
)
);
} }
public static function add_help_tab() { public static function add_help_tab() {

View file

@ -2,9 +2,9 @@
# This file is distributed under the MIT. # This file is distributed under the MIT.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ActivityPub 0.3.2\n" "Project-Id-Version: ActivityPub 0.4.0\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: 2019-02-04 12:33:44+00:00\n" "POT-Creation-Date: 2019-02-17 20:26:22+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"
@ -21,15 +21,16 @@ msgstr ""
msgid "The Activity-Object-Type" msgid "The Activity-Object-Type"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:59 templates/settings-page.php:34 #: includes/class-activitypub-admin.php:59
#: includes/class-activitypub-admin.php:66 templates/settings-page.php:33
msgid "Use the Shortlink instead of the permalink" msgid "Use the Shortlink instead of the permalink"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:69 #: includes/class-activitypub-admin.php:76
msgid "Overview" msgid "Overview"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:71 #: includes/class-activitypub-admin.php:78
msgid "" msgid ""
"ActivityPub is a decentralized social networking protocol based on the " "ActivityPub is a decentralized social networking protocol based on the "
"ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended " "ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended "
@ -39,33 +40,33 @@ msgid ""
"subscribing to content." "subscribing to content."
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:76 #: includes/class-activitypub-admin.php:83
msgid "For more information:" msgid "For more information:"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:77 #: includes/class-activitypub-admin.php:84
msgid "<a href=\"https://activitypub.rocks/\">Test Suite</a>" msgid "<a href=\"https://activitypub.rocks/\">Test Suite</a>"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:78 #: includes/class-activitypub-admin.php:85
msgid "<a href=\"https://www.w3.org/TR/activitypub/\">W3C Spec</a>" msgid "<a href=\"https://www.w3.org/TR/activitypub/\">W3C Spec</a>"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:79 #: includes/class-activitypub-admin.php:86
msgid "" msgid ""
"<a href=\"https://github.com/pfefferle/wordpress-activitypub/issues\">Give " "<a href=\"https://github.com/pfefferle/wordpress-activitypub/issues\">Give "
"us feedback</a>" "us feedback</a>"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:81 #: includes/class-activitypub-admin.php:88
msgid "<a href=\"https://notiz.blog/donate\">Donate</a>" msgid "<a href=\"https://notiz.blog/donate\">Donate</a>"
msgstr "" msgstr ""
#: includes/class-activitypub-admin.php:87 #: includes/class-activitypub-admin.php:94
msgid "Fediverse" msgid "Fediverse"
msgstr "" msgstr ""
#: includes/class-db-activitypub-followers.php:23 #: includes/class-db-activitypub-followers.php:46
msgid "Unknown Actor schema" msgid "Unknown Actor schema"
msgstr "" msgstr ""
@ -128,7 +129,7 @@ msgstr ""
msgid "Blog" msgid "Blog"
msgstr "" msgstr ""
#: templates/json-author.php:59 templates/settings-page.php:60 #: templates/json-author.php:59 templates/settings-page.php:79
msgid "Profile" msgid "Profile"
msgstr "" msgstr ""
@ -179,57 +180,75 @@ msgstr ""
msgid "Backlink" msgid "Backlink"
msgstr "" msgstr ""
#: templates/settings-page.php:41 #: templates/settings-page.php:39
msgid "Activtity-Object-Type" msgid "Activtity-Object-Type"
msgstr "" msgstr ""
#: templates/settings-page.php:45 #: templates/settings-page.php:43
msgid "Note (default)" msgid "Note (default)"
msgstr "" msgstr ""
#: templates/settings-page.php:45 #: templates/settings-page.php:43
msgid "Should work with most plattforms." msgid "Should work with most plattforms."
msgstr "" msgstr ""
#: templates/settings-page.php:48 #: templates/settings-page.php:46
msgid "Article" msgid "Article"
msgstr "" msgstr ""
#: templates/settings-page.php:48 #: templates/settings-page.php:46
msgid "" msgid ""
"The presentation of the \"Article\" might change on different plattforms. " "The presentation of the \"Article\" might change on different plattforms. "
"Mastodon for example shows the \"Article\" type as a simple link." "Mastodon for example shows the \"Article\" type as a simple link."
msgstr "" msgstr ""
#: templates/settings-page.php:51 #: templates/settings-page.php:49
msgid "WordPress Post-Format" msgid "WordPress Post-Format"
msgstr "" msgstr ""
#: templates/settings-page.php:51 #: templates/settings-page.php:49
msgid "Maps the WordPress Post-Format to the ActivityPub Object Type." msgid "Maps the WordPress Post-Format to the ActivityPub Object Type."
msgstr "" msgstr ""
#: templates/settings-page.php:62 #: templates/settings-page.php:58
msgid "All profile related settings." msgid "Hashtag"
msgstr "" msgstr ""
#: templates/settings-page.php:68 #: templates/settings-page.php:60
msgid "Followers" msgid "All #tag related settings"
msgstr ""
#: templates/settings-page.php:66
msgid "Support Hashtags"
msgstr "" msgstr ""
#: templates/settings-page.php:70 #: templates/settings-page.php:70
msgid ""
"Add hashtags in the content as native tags and replace the "
"<code>#tag</code> with the tag-link."
msgstr ""
#: templates/settings-page.php:81
msgid "All profile related settings."
msgstr ""
#: templates/settings-page.php:87
msgid "Followers"
msgstr ""
#: templates/settings-page.php:89
msgid "All follower related settings." msgid "All follower related settings."
msgstr "" msgstr ""
#: templates/settings-page.php:76 #: templates/settings-page.php:95
msgid "List of followers" msgid "List of followers"
msgstr "" msgstr ""
#: templates/settings-page.php:86 #: templates/settings-page.php:105
msgid "No followers yet" msgid "No followers yet"
msgstr "" msgstr ""
#: templates/settings-page.php:101 #: templates/settings-page.php:120
msgid "" msgid ""
"If you like this plugin, what about a small <a " "If you like this plugin, what about a small <a "
"href=\"https://notiz.blog/donate\">donation</a>?" "href=\"https://notiz.blog/donate\">donation</a>?"

View file

@ -55,6 +55,12 @@ To implement:
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
= 0.4.0 =
* added settings to enable/disable hashtag support
* fixed follower list
* send activities only for new posts, otherwise send updates
= 0.3.2 = = 0.3.2 =
* added "followers" endpoint * added "followers" endpoint

View file

@ -30,10 +30,8 @@
<?php esc_html_e( 'Backlink', 'activitypub' ); ?> <?php esc_html_e( 'Backlink', 'activitypub' ); ?>
</th> </th>
<td> <td>
<p> <p><label><input type="checkbox" name="activitypub_use_shortlink" id="activitypub_use_shortlink" value="1" <?php echo checked( '1', get_option( 'activitypub_use_shortlink', '0' ) ); ?> /> <?php esc_html_e( 'Use the Shortlink instead of the permalink', 'activitypub' ); ?></label></p>
<label><input type="checkbox" name="activitypub_use_shortlink" id="activitypub_use_shortlink" value="1" <?php echo checked( '1', get_option( 'activitypub_use_shortlink', '0' ) ); ?> /> <?php esc_html_e( 'Use the Shortlink instead of the permalink', 'activitypub' ); ?></label>
<p class="description"><?php printf( esc_html( 'I can recommend %sHum%s, to prettify the Shortlinks', 'activitypub' ), '<a href="https://wordpress.org/plugins/hum/" target="_blank">', '</a>' ); ?></p> <p class="description"><?php printf( esc_html( 'I can recommend %sHum%s, to prettify the Shortlinks', 'activitypub' ), '<a href="https://wordpress.org/plugins/hum/" target="_blank">', '</a>' ); ?></p>
</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -57,6 +55,27 @@
<?php do_settings_fields( 'activitypub', 'activity' ); ?> <?php do_settings_fields( 'activitypub', 'activity' ); ?>
<h2><?php esc_html_e( 'Hashtag', 'activitypub' ); ?></h2>
<p><?php esc_html_e( 'All #tag related settings', 'activitypub' ); ?></p>
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label><?php esc_html_e( 'Support Hashtags', 'activitypub' ); ?></label>
</th>
<td>
<p>
<label><input type="checkbox" name="activitypub_use_hashtags" id="activitypub_use_hashtags" value="1" <?php echo checked( '1', get_option( 'activitypub_use_hashtags', '1' ) ); ?> /> <?php _e( 'Add hashtags in the content as native tags and replace the <code>#tag</code> with the tag-link.', 'activitypub' ); ?></label>
</p>
</td>
</tr>
</tbody>
</table>
<?php do_settings_fields( 'activitypub', 'hashtag' ); ?>
<h2><?php esc_html_e( 'Profile', 'activitypub' ); ?></h2> <h2><?php esc_html_e( 'Profile', 'activitypub' ); ?></h2>
<p><?php esc_html_e( 'All profile related settings.', 'activitypub' ); ?></p> <p><?php esc_html_e( 'All profile related settings.', 'activitypub' ); ?></p>