Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit f716d65

Browse files
committed
Add Watch and Listen types
1 parent 89cb7ae commit f716d65

9 files changed

+203
-101
lines changed

‎README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
**Tags:** webmention, pingback, trackback, linkback, microformats, comments, indieweb
55
**Requires at least:** 4.8.2
66
**Requires PHP:** 5.4
7-
**Tested up to:** 4.9.2
8-
**Stable tag:** 3.7.5
7+
**Tested up to:** 4.9.4
8+
**Stable tag:** 3.7.6
99
**License:** MIT
1010
**License URI:** http://opensource.org/licenses/MIT
1111

@@ -68,6 +68,10 @@ The Webmention and Pingback logos are made by [Aaron Parecki](http://aaronpareck
6868

6969
Project actively developed on Github at [pfefferle/wordpress-semantic-linkbacks](https://github.com/pfefferle/wordpress-semantic-linkbacks). Please file support issues there.
7070

71+
### 3.7.6 ###
72+
* Update Parser to version 0.4.3
73+
* Introduce watch and listen properties
74+
7175
### 3.7.5 ###
7276

7377
* fixed Reacji UI ((#154)[https://github.com/pfefferle/wordpress-semantic-linkbacks/issues/154])

‎includes/class-linkbacks-handler.php

+50-42
Original file line numberDiff line numberDiff line change
@@ -201,29 +201,33 @@ public static function update_meta( $comment_id, $commentdata ) {
201201
public static function get_comment_type_excerpts() {
202202
$strings = array(
203203
// translators: Name verb on domain
204-
'mention' => __( '%1$s mentioned %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
204+
'mention' => __( '%1$s mentioned %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
205205
// translators: Name verb on domain
206-
'reply' => __( '%1$s replied to %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
206+
'reply' => __( '%1$s replied to %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
207207
// translators: Name verb on domain
208-
'repost' => __( '%1$s reposted %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
208+
'repost' => __( '%1$s reposted %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
209209
// translators: Name verb on domain
210-
'like' => __( '%1$s liked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
210+
'like' => __( '%1$s liked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
211211
// translators: Name verb on domain
212-
'favorite' => __( '%1$s favorited %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
212+
'favorite' => __( '%1$s favorited %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
213213
// translators: Name verb on domain
214-
'tag' => __( '%1$s tagged %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
214+
'tag' => __( '%1$s tagged %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
215215
// translators: Name verb on domain
216-
'bookmark' => __( '%1$s bookmarked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
216+
'bookmark' => __( '%1$s bookmarked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
217217
// translators: Name verb on domain
218-
'rsvp:yes' => __( '%1$s is <strong>attending</strong>.', 'semantic-linkbacks' ),
218+
'rsvp:yes' => __( '%1$s is <strong>attending</strong>.', 'semantic-linkbacks' ),
219219
// translators: Name verb on domain
220-
'rsvp:no' => __( '%1$s is <strong>not attending</strong>.', 'semantic-linkbacks' ),
220+
'rsvp:no' => __( '%1$s is <strong>not attending</strong>.', 'semantic-linkbacks' ),
221221
// translators: Name verb on domain
222-
'rsvp:maybe' => __( 'Maybe %1$s will be <strong>attending</strong>.', 'semantic-linkbacks' ),
222+
'rsvp:maybe' => __( 'Maybe %1$s will be <strong>attending</strong>.', 'semantic-linkbacks' ),
223223
// translators: Name verb on domain
224224
'rsvp:interested' => __( '%1$s is <strong>interested</strong> in this event.', 'semantic-linkbacks' ),
225225
// translators: Name verb on domain
226-
'invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
226+
'invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
227+
// translators: Name verb on domain
228+
'listen' => __( '%1$s is <strong>listening</strong>.', 'semantic-linkbacks' ),
229+
// translators: Name verb on domain
230+
'watch' => __( '%1$s is <strong>watching</strong>.', 'semantic-linkbacks' ),
227231
);
228232

229233
return $strings;
@@ -237,19 +241,21 @@ public static function get_comment_type_excerpts() {
237241
public static function get_comment_type_strings() {
238242
$strings = array(
239243
// Special case. any value that evals to false will be considered standard
240-
'mention' => __( 'Mention', 'semantic-linkbacks' ),
241-
242-
'reply' => __( 'Reply', 'semantic-linkbacks' ),
243-
'repost' => __( 'Repost', 'semantic-linkbacks' ),
244-
'like' => __( 'Like', 'semantic-linkbacks' ),
245-
'favorite' => __( 'Favorite', 'semantic-linkbacks' ),
246-
'tag' => __( 'Tag', 'semantic-linkbacks' ),
247-
'bookmark' => __( 'Bookmark', 'semantic-linkbacks' ),
248-
'rsvp:yes' => __( 'RSVP', 'semantic-linkbacks' ),
249-
'rsvp:no' => __( 'RSVP', 'semantic-linkbacks' ),
250-
'rsvp:maybe' => __( 'RSVP', 'semantic-linkbacks' ),
244+
'mention' => __( 'Mention', 'semantic-linkbacks' ),
245+
246+
'reply' => __( 'Reply', 'semantic-linkbacks' ),
247+
'repost' => __( 'Repost', 'semantic-linkbacks' ),
248+
'like' => __( 'Like', 'semantic-linkbacks' ),
249+
'favorite' => __( 'Favorite', 'semantic-linkbacks' ),
250+
'tag' => __( 'Tag', 'semantic-linkbacks' ),
251+
'bookmark' => __( 'Bookmark', 'semantic-linkbacks' ),
252+
'rsvp:yes' => __( 'RSVP', 'semantic-linkbacks' ),
253+
'rsvp:no' => __( 'RSVP', 'semantic-linkbacks' ),
254+
'rsvp:maybe' => __( 'RSVP', 'semantic-linkbacks' ),
251255
'rsvp:interested' => __( 'RSVP', 'semantic-linkbacks' ),
252-
'invited' => __( 'Invited', 'semantic-linkbacks' ),
256+
'invited' => __( 'Invited', 'semantic-linkbacks' ),
257+
'listen' => __( 'Listening', 'semantic-linkbacks' ),
258+
'watch' => __( 'Watching', 'semantic-linkbacks' ),
253259
);
254260

255261
return $strings;
@@ -420,21 +426,21 @@ public static function comment_text_add_cite( $text, $comment = null, $args = ar
420426
*/
421427
public static function get_post_type( $post_id ) {
422428
$post_typestrings = self::get_post_type_strings();
423-
$post_type = $post_typestrings[ 'post' ];
424-
429+
$post_type = $post_typestrings['post'];
430+
425431
// If this is the page homepages are redirected to then use the site name
426432
if ( $post_id === get_option( 'webmention_home_mentions', 0 ) ) {
427433
$post_type = get_bloginfo( 'name' );
428-
} else if ( 'page' === get_post_type( $post_id ) ) {
429-
$post_type = $post_typestrings[ 'page' ];
430-
} else if ( current_theme_supports( 'post-formats' ) ) {
434+
} elseif ( 'page' === get_post_type( $post_id ) ) {
435+
$post_type = $post_typestrings['page'];
436+
} elseif ( current_theme_supports( 'post-formats' ) ) {
431437
$post_format = get_post_format( $post_id );
432-
438+
433439
// add "standard" as default for post format enabled types
434440
if ( ! $post_format || ! in_array( $post_format, array_keys( $post_typestrings ), true ) ) {
435441
$post_format = 'standard';
436442
}
437-
443+
438444
$post_type = $post_typestrings[ $post_format ];
439445
}
440446

@@ -603,19 +609,21 @@ public static function comment_class( $classes, $class, $comment_id, $post_id )
603609
$comment = get_comment( $comment_id );
604610
// "comment type to class" mapper
605611
$class_mapping = array(
606-
'mention' => array( 'u-mention' ),
607-
608-
'reply' => array( 'u-comment' ),
609-
'repost' => array( 'u-repost' ),
610-
'like' => array( 'u-like' ),
611-
'favorite' => array( 'u-favorite' ),
612-
'tag' => array( 'u-tag' ),
613-
'bookmark' => array( 'u-bookmark' ),
614-
'rsvp:yes' => array( 'u-rsvp' ),
615-
'rsvp:no' => array( 'u-rsvp' ),
616-
'rsvp:maybe' => array( 'u-rsvp' ),
612+
'mention' => array( 'u-mention' ),
613+
614+
'reply' => array( 'u-comment' ),
615+
'repost' => array( 'u-repost' ),
616+
'like' => array( 'u-like' ),
617+
'favorite' => array( 'u-favorite' ),
618+
'tag' => array( 'u-tag' ),
619+
'bookmark' => array( 'u-bookmark' ),
620+
'rsvp:yes' => array( 'u-rsvp' ),
621+
'rsvp:no' => array( 'u-rsvp' ),
622+
'rsvp:maybe' => array( 'u-rsvp' ),
617623
'rsvp:interested' => array( 'u-rsvp' ),
618-
'invited' => array( 'u-invitee' ),
624+
'invited' => array( 'u-invitee' ),
625+
'listen' => array( 'u-listen' ),
626+
'watch' => array( 'u-watch' ),
619627
);
620628

621629
$semantic_linkbacks_type = self::get_type( $comment );

‎includes/class-linkbacks-mf2-handler.php

+25-11
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,43 @@ public static function get_class_mapper() {
2525

2626
/*
2727
* replies
28-
* @link http://indiewebcamp.com/replies
28+
* @link http://indieweb.org/replies
2929
*/
3030
$class_mapper['in-reply-to'] = 'reply';
3131
$class_mapper['reply'] = 'reply';
3232
$class_mapper['reply-of'] = 'reply';
3333

3434
/*
3535
* repost
36-
* @link http://indiewebcamp.com/repost
36+
* @link http://indieweb.org/repost
3737
*/
3838
$class_mapper['repost'] = 'repost';
3939
$class_mapper['repost-of'] = 'repost';
4040

4141
/*
4242
* likes
43-
* @link http://indiewebcamp.com/likes
43+
* @link http://indieweb.org/likes
4444
*/
4545
$class_mapper['like'] = 'like';
4646
$class_mapper['like-of'] = 'like';
4747

4848
/*
4949
* favorite
50-
* @link http://indiewebcamp.com/favorite
50+
* @link http://indieweb.org/favorite
5151
*/
5252
$class_mapper['favorite'] = 'favorite';
5353
$class_mapper['favorite-of'] = 'favorite';
5454

5555
/*
5656
* bookmark
57-
* @link http://indiewebcamp.com/bookmark
57+
* @link http://indieweb.org/bookmark
5858
*/
5959
$class_mapper['bookmark'] = 'bookmark';
6060
$class_mapper['bookmark-of'] = 'bookmark';
6161

6262
/*
6363
* rsvp
64-
* @link http://indiewebcamp.com/rsvp
64+
* @link http://indieweb.org/rsvp
6565
*/
6666
$class_mapper['rsvp'] = 'rsvp';
6767
/*
@@ -72,11 +72,25 @@ public static function get_class_mapper() {
7272

7373
/*
7474
* tag
75-
* @link http://indiewebcamp.com/tag
75+
* @link http://indieweb.org/tag
7676
*/
77-
$class_mapper['tag-of'] = 'tag';
77+
$class_mapper['tag-of'] = 'tag';
7878
$class_mapper['category'] = 'tag';
7979

80+
/*
81+
* listen
82+
* @link http://indieweb.org/listen
83+
*/
84+
$class_mapper['listen-of'] = 'listen';
85+
$class_mapper['listen'] = 'listen';
86+
87+
/*
88+
* watch
89+
* @link http://indieweb.org/watch
90+
*/
91+
$class_mapper['watch-of'] = 'watch';
92+
$class_mapper['watch'] = 'watch';
93+
8094
return apply_filters( 'semantic_linkbacks_microformats_class_mapper', $class_mapper );
8195
}
8296

@@ -90,7 +104,7 @@ public static function get_rel_mapper() {
90104

91105
/*
92106
* replies
93-
* @link http://indiewebcamp.com/in-reply-to
107+
* @link http://indieweb.org/in-reply-to
94108
*/
95109
$rel_mapper['in-reply-to'] = 'reply';
96110
$rel_mapper['reply-of'] = 'reply';
@@ -139,7 +153,7 @@ public static function generate_commentdata( $commentdata ) {
139153
$commentdata['remote_source_rels'] = $rels;
140154

141155
// try to find some content
142-
// @link http://indiewebcamp.com/comments-presentation
156+
// @link http://indieweb.org/comments-presentation
143157
if ( isset( $properties['summary'] ) ) {
144158
$commentdata['comment_content'] = wp_slash( $properties['summary'] );
145159
} elseif ( isset( $properties['content'] ) ) {
@@ -277,7 +291,7 @@ public static function generate_commentdata( $commentdata ) {
277291
'audio',
278292
'photo',
279293
'featured',
280-
'swarm-coins' // https://ownyourswarm.p3k.io/docs#coins
294+
'swarm-coins', // https://ownyourswarm.p3k.io/docs#coins
281295
);
282296

283297
// Add in supported properties

‎includes/class-linkbacks-walker-comment.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ protected function html5_comment( $comment, $depth, $args ) {
110110

111111
<div class="comment-metadata">
112112
<?php
113-
if ( $coins ) {
114-
// translators: Number of Swarm Coins
115-
printf( _n( '+%d coin', '+%d coins', (int) $coins, 'semantic-linkbacks' ), $coins );
116-
echo ' / ';
117-
}
113+
if ( $coins ) {
114+
// translators: Number of Swarm Coins
115+
printf( _n( '+%d coin', '+%d coins', (int) $coins, 'semantic-linkbacks' ), $coins );
116+
echo ' / ';
117+
}
118118
?>
119119

120120

0 commit comments

Comments
 (0)