Skip to content

Commit b958d59

Browse files
committed
added setting to enable/disable hashtags /cc @chrisaldrich
1 parent 13bbfe0 commit b958d59

File tree

7 files changed

+94
-35
lines changed

7 files changed

+94
-35
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ indent_style = space
1919
indent_size = 2
2020

2121
[{*.txt,wp-config-sample.php}]
22-
end_of_line = crlf
22+
end_of_line = lf

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ To implement:
5555

5656
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
5757

58+
### 0.4.0 ###
59+
60+
* added settings to enable/disable hashtag support
61+
* fixed follower list
62+
* send activities only for new posts, otherwise send updates
63+
5864
### 0.3.2 ###
5965

6066
* added "followers" endpoint

activitypub.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: ActivityPub
44
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
55
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
6-
* Version: 0.3.2
6+
* Version: 0.4.0
77
* Author: Matthias Pfefferle
88
* Author URI: https://notiz.blog/
99
* License: MIT
@@ -70,9 +70,11 @@ function activitypub_init() {
7070
add_action( 'admin_init', array( 'Activitypub_Admin', 'register_settings' ) );
7171
add_action( 'show_user_profile', array( 'Activitypub_Admin', 'add_fediverse_profile' ) );
7272

73-
require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php';
74-
add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 );
75-
add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 );
73+
if ( '1' === get_option( 'activitypub_use_hashtags', '1' ) ) {
74+
require_once dirname( __FILE__ ) . '/includes/class-activitypub-hashtag.php';
75+
add_filter( 'wp_insert_post', array( 'Activitypub_Hashtag', 'insert_post' ), 99, 2 );
76+
add_filter( 'the_content', array( 'Activitypub_Hashtag', 'the_content' ), 99, 2 );
77+
}
7678
}
7779
add_action( 'plugins_loaded', 'activitypub_init' );
7880

includes/class-activitypub-admin.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ public static function register_settings() {
6060
'default' => 0,
6161
)
6262
);
63+
register_setting(
64+
'activitypub', 'activitypub_use_hashtags', array(
65+
'type' => 'boolean',
66+
'description' => __( 'Use the Shortlink instead of the permalink', 'activitypub' ),
67+
'default' => 0,
68+
)
69+
);
6370
}
6471

6572
public static function add_help_tab() {

languages/activitypub.pot

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# This file is distributed under the MIT.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: ActivityPub 0.3.2\n"
5+
"Project-Id-Version: ActivityPub 0.4.0\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/activitypub\n"
7-
"POT-Creation-Date: 2019-02-04 12:33:44+00:00\n"
7+
"POT-Creation-Date: 2019-02-17 20:26:22+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
@@ -21,15 +21,16 @@ msgstr ""
2121
msgid "The Activity-Object-Type"
2222
msgstr ""
2323

24-
#: includes/class-activitypub-admin.php:59 templates/settings-page.php:34
24+
#: includes/class-activitypub-admin.php:59
25+
#: includes/class-activitypub-admin.php:66 templates/settings-page.php:33
2526
msgid "Use the Shortlink instead of the permalink"
2627
msgstr ""
2728

28-
#: includes/class-activitypub-admin.php:69
29+
#: includes/class-activitypub-admin.php:76
2930
msgid "Overview"
3031
msgstr ""
3132

32-
#: includes/class-activitypub-admin.php:71
33+
#: includes/class-activitypub-admin.php:78
3334
msgid ""
3435
"ActivityPub is a decentralized social networking protocol based on the "
3536
"ActivityStreams 2.0 data format. ActivityPub is an official W3C recommended "
@@ -39,33 +40,33 @@ msgid ""
3940
"subscribing to content."
4041
msgstr ""
4142

42-
#: includes/class-activitypub-admin.php:76
43+
#: includes/class-activitypub-admin.php:83
4344
msgid "For more information:"
4445
msgstr ""
4546

46-
#: includes/class-activitypub-admin.php:77
47+
#: includes/class-activitypub-admin.php:84
4748
msgid "<a href=\"https://activitypub.rocks/\">Test Suite</a>"
4849
msgstr ""
4950

50-
#: includes/class-activitypub-admin.php:78
51+
#: includes/class-activitypub-admin.php:85
5152
msgid "<a href=\"https://www.w3.org/TR/activitypub/\">W3C Spec</a>"
5253
msgstr ""
5354

54-
#: includes/class-activitypub-admin.php:79
55+
#: includes/class-activitypub-admin.php:86
5556
msgid ""
5657
"<a href=\"https://github.com/pfefferle/wordpress-activitypub/issues\">Give "
5758
"us feedback</a>"
5859
msgstr ""
5960

60-
#: includes/class-activitypub-admin.php:81
61+
#: includes/class-activitypub-admin.php:88
6162
msgid "<a href=\"https://notiz.blog/donate\">Donate</a>"
6263
msgstr ""
6364

64-
#: includes/class-activitypub-admin.php:87
65+
#: includes/class-activitypub-admin.php:94
6566
msgid "Fediverse"
6667
msgstr ""
6768

68-
#: includes/class-db-activitypub-followers.php:23
69+
#: includes/class-db-activitypub-followers.php:46
6970
msgid "Unknown Actor schema"
7071
msgstr ""
7172

@@ -128,7 +129,7 @@ msgstr ""
128129
msgid "Blog"
129130
msgstr ""
130131

131-
#: templates/json-author.php:59 templates/settings-page.php:60
132+
#: templates/json-author.php:59 templates/settings-page.php:79
132133
msgid "Profile"
133134
msgstr ""
134135

@@ -179,57 +180,75 @@ msgstr ""
179180
msgid "Backlink"
180181
msgstr ""
181182

182-
#: templates/settings-page.php:41
183+
#: templates/settings-page.php:39
183184
msgid "Activtity-Object-Type"
184185
msgstr ""
185186

186-
#: templates/settings-page.php:45
187+
#: templates/settings-page.php:43
187188
msgid "Note (default)"
188189
msgstr ""
189190

190-
#: templates/settings-page.php:45
191+
#: templates/settings-page.php:43
191192
msgid "Should work with most plattforms."
192193
msgstr ""
193194

194-
#: templates/settings-page.php:48
195+
#: templates/settings-page.php:46
195196
msgid "Article"
196197
msgstr ""
197198

198-
#: templates/settings-page.php:48
199+
#: templates/settings-page.php:46
199200
msgid ""
200201
"The presentation of the \"Article\" might change on different plattforms. "
201202
"Mastodon for example shows the \"Article\" type as a simple link."
202203
msgstr ""
203204

204-
#: templates/settings-page.php:51
205+
#: templates/settings-page.php:49
205206
msgid "WordPress Post-Format"
206207
msgstr ""
207208

208-
#: templates/settings-page.php:51
209+
#: templates/settings-page.php:49
209210
msgid "Maps the WordPress Post-Format to the ActivityPub Object Type."
210211
msgstr ""
211212

212-
#: templates/settings-page.php:62
213+
#: templates/settings-page.php:58
214+
msgid "Hashtag"
215+
msgstr ""
216+
217+
#: templates/settings-page.php:60
218+
msgid "All #tag related settings"
219+
msgstr ""
220+
221+
#: templates/settings-page.php:66
222+
msgid "Support Hashtags"
223+
msgstr ""
224+
225+
#: templates/settings-page.php:70
226+
msgid ""
227+
"Add hashtags in the content as native tags and replace the "
228+
"<code>#tag</code> with the tag-link."
229+
msgstr ""
230+
231+
#: templates/settings-page.php:81
213232
msgid "All profile related settings."
214233
msgstr ""
215234

216-
#: templates/settings-page.php:68
235+
#: templates/settings-page.php:87
217236
msgid "Followers"
218237
msgstr ""
219238

220-
#: templates/settings-page.php:70
239+
#: templates/settings-page.php:89
221240
msgid "All follower related settings."
222241
msgstr ""
223242

224-
#: templates/settings-page.php:76
243+
#: templates/settings-page.php:95
225244
msgid "List of followers"
226245
msgstr ""
227246

228-
#: templates/settings-page.php:86
247+
#: templates/settings-page.php:105
229248
msgid "No followers yet"
230249
msgstr ""
231250

232-
#: templates/settings-page.php:101
251+
#: templates/settings-page.php:120
233252
msgid ""
234253
"If you like this plugin, what about a small <a "
235254
"href=\"https://notiz.blog/donate\">donation</a>?"

readme.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ To implement:
5555

5656
Project maintained on github at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub).
5757

58+
= 0.4.0 =
59+
60+
* added settings to enable/disable hashtag support
61+
* fixed follower list
62+
* send activities only for new posts, otherwise send updates
63+
5864
= 0.3.2 =
5965

6066
* added "followers" endpoint

templates/settings-page.php

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
<?php esc_html_e( 'Backlink', 'activitypub' ); ?>
3131
</th>
3232
<td>
33-
<p>
34-
<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>
35-
<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>
36-
</p>
33+
<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>
34+
<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>
3735
</td>
3836
</tr>
3937
<tr>
@@ -57,6 +55,27 @@
5755

5856
<?php do_settings_fields( 'activitypub', 'activity' ); ?>
5957

58+
<h2><?php esc_html_e( 'Hashtag', 'activitypub' ); ?></h2>
59+
60+
<p><?php esc_html_e( 'All #tag related settings', 'activitypub' ); ?></p>
61+
62+
<table class="form-table">
63+
<tbody>
64+
<tr>
65+
<th scope="row">
66+
<label><?php esc_html_e( 'Support Hashtags', 'activitypub' ); ?></label>
67+
</th>
68+
<td>
69+
<p>
70+
<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>
71+
</p>
72+
</td>
73+
</tr>
74+
</tbody>
75+
</table>
76+
77+
<?php do_settings_fields( 'activitypub', 'hashtag' ); ?>
78+
6079
<h2><?php esc_html_e( 'Profile', 'activitypub' ); ?></h2>
6180

6281
<p><?php esc_html_e( 'All profile related settings.', 'activitypub' ); ?></p>

0 commit comments

Comments
 (0)