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
[{*.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).
### 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 ###
* added "followers" endpoint

View file

@ -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.3.2
* Version: 0.4.0
* Author: Matthias Pfefferle
* Author URI: https://notiz.blog/
* License: MIT
@ -70,9 +70,11 @@ function activitypub_init() {
add_action( 'admin_init', array( 'Activitypub_Admin', 'register_settings' ) );
add_action( 'show_user_profile', array( 'Activitypub_Admin', 'add_fediverse_profile' ) );
require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php';
add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 );
add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 );
if ( '1' === get_option( 'activitypub_use_hashtags', '1' ) ) {
require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php';
add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 );
add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 );
}
}
add_action( 'plugins_loaded', 'activitypub_init' );

View file

@ -60,6 +60,13 @@ class Activitypub_Admin {
'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() {

View file

@ -2,9 +2,9 @@
# This file is distributed under the MIT.
msgid ""
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"
"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"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@ -21,15 +21,16 @@ msgstr ""
msgid "The Activity-Object-Type"
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"
msgstr ""
#: includes/class-activitypub-admin.php:69
#: includes/class-activitypub-admin.php:76
msgid "Overview"
msgstr ""
#: includes/class-activitypub-admin.php:71
#: includes/class-activitypub-admin.php:78
msgid ""
"ActivityPub is a decentralized social networking protocol based on the "
"ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended "
@ -39,33 +40,33 @@ msgid ""
"subscribing to content."
msgstr ""
#: includes/class-activitypub-admin.php:76
#: includes/class-activitypub-admin.php:83
msgid "For more information:"
msgstr ""
#: includes/class-activitypub-admin.php:77
#: includes/class-activitypub-admin.php:84
msgid "<a href=\"https://activitypub.rocks/\">Test Suite</a>"
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>"
msgstr ""
#: includes/class-activitypub-admin.php:79
#: includes/class-activitypub-admin.php:86
msgid ""
"<a href=\"https://github.com/pfefferle/wordpress-activitypub/issues\">Give "
"us feedback</a>"
msgstr ""
#: includes/class-activitypub-admin.php:81
#: includes/class-activitypub-admin.php:88
msgid "<a href=\"https://notiz.blog/donate\">Donate</a>"
msgstr ""
#: includes/class-activitypub-admin.php:87
#: includes/class-activitypub-admin.php:94
msgid "Fediverse"
msgstr ""
#: includes/class-db-activitypub-followers.php:23
#: includes/class-db-activitypub-followers.php:46
msgid "Unknown Actor schema"
msgstr ""
@ -128,7 +129,7 @@ msgstr ""
msgid "Blog"
msgstr ""
#: templates/json-author.php:59 templates/settings-page.php:60
#: templates/json-author.php:59 templates/settings-page.php:79
msgid "Profile"
msgstr ""
@ -179,57 +180,75 @@ msgstr ""
msgid "Backlink"
msgstr ""
#: templates/settings-page.php:41
#: templates/settings-page.php:39
msgid "Activtity-Object-Type"
msgstr ""
#: templates/settings-page.php:45
#: templates/settings-page.php:43
msgid "Note (default)"
msgstr ""
#: templates/settings-page.php:45
#: templates/settings-page.php:43
msgid "Should work with most plattforms."
msgstr ""
#: templates/settings-page.php:48
#: templates/settings-page.php:46
msgid "Article"
msgstr ""
#: templates/settings-page.php:48
#: templates/settings-page.php:46
msgid ""
"The presentation of the \"Article\" might change on different plattforms. "
"Mastodon for example shows the \"Article\" type as a simple link."
msgstr ""
#: templates/settings-page.php:51
#: templates/settings-page.php:49
msgid "WordPress Post-Format"
msgstr ""
#: templates/settings-page.php:51
#: templates/settings-page.php:49
msgid "Maps the WordPress Post-Format to the ActivityPub Object Type."
msgstr ""
#: templates/settings-page.php:62
msgid "All profile related settings."
#: templates/settings-page.php:58
msgid "Hashtag"
msgstr ""
#: templates/settings-page.php:68
msgid "Followers"
#: templates/settings-page.php:60
msgid "All #tag related settings"
msgstr ""
#: templates/settings-page.php:66
msgid "Support Hashtags"
msgstr ""
#: 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."
msgstr ""
#: templates/settings-page.php:76
#: templates/settings-page.php:95
msgid "List of followers"
msgstr ""
#: templates/settings-page.php:86
#: templates/settings-page.php:105
msgid "No followers yet"
msgstr ""
#: templates/settings-page.php:101
#: templates/settings-page.php:120
msgid ""
"If you like this plugin, what about a small <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).
= 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 =
* added "followers" endpoint

View file

@ -30,10 +30,8 @@
<?php esc_html_e( 'Backlink', 'activitypub' ); ?>
</th>
<td>
<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>
<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>
<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>
</td>
</tr>
<tr>
@ -57,6 +55,27 @@
<?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>
<p><?php esc_html_e( 'All profile related settings.', 'activitypub' ); ?></p>