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

Commit 88fcd9b

Browse files
committed
Add invite property
1 parent d6d2a4a commit 88fcd9b

File tree

9 files changed

+109
-17
lines changed

9 files changed

+109
-17
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Requires at least:** 4.8.2
66
**Requires PHP:** 5.4
77
**Tested up to:** 4.9.1
8-
**Stable tag:** 3.7.3
8+
**Stable tag:** 3.7.4
99
**License:** MIT
1010
**License URI:** http://opensource.org/licenses/MIT
1111

@@ -68,6 +68,9 @@ 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.4 ###
72+
* Replace `rsvp-invite` property which is not in use with `invite` property and add unit tests
73+
7174
### 3.7.3 ###
7275

7376
* Replace tracking with interested property as noted on https://indieweb.org/rsvp

includes/class-linkbacks-handler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ public static function get_comment_type_excerpts() {
221221
// translators: Name verb on domain
222222
'rsvp:maybe' => __( 'Maybe %1$s will be <strong>attending</strong>.', 'semantic-linkbacks' ),
223223
// translators: Name verb on domain
224-
'rsvp:invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
225-
// translators: Name verb on domain
226224
'rsvp:interested' => __( '%1$s is <strong>interested</strong> in this event.', 'semantic-linkbacks' ),
225+
// translators: Name verb on domain
226+
'invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
227227
);
228228

229229
return $strings;
@@ -247,9 +247,9 @@ public static function get_comment_type_strings() {
247247
'bookmark' => __( 'Bookmark', 'semantic-linkbacks' ),
248248
'rsvp:yes' => __( 'RSVP', 'semantic-linkbacks' ),
249249
'rsvp:no' => __( 'RSVP', 'semantic-linkbacks' ),
250-
'rsvp:invited' => __( 'RSVP', 'semantic-linkbacks' ),
251250
'rsvp:maybe' => __( 'RSVP', 'semantic-linkbacks' ),
252251
'rsvp:interested' => __( 'RSVP', 'semantic-linkbacks' ),
252+
'invited' => __( 'Invited', 'semantic-linkbacks' ),
253253
);
254254

255255
return $strings;
@@ -594,8 +594,8 @@ public static function comment_class( $classes, $class, $comment_id, $post_id )
594594
'rsvp:yes' => array( 'u-rsvp' ),
595595
'rsvp:no' => array( 'u-rsvp' ),
596596
'rsvp:maybe' => array( 'u-rsvp' ),
597-
'rsvp:invited' => array( 'u-rsvp' ),
598597
'rsvp:interested' => array( 'u-rsvp' ),
598+
'invited' => array( 'u-invitee' ),
599599
);
600600

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

includes/class-linkbacks-mf2-handler.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public static function get_class_mapper() {
6464
* @link http://indiewebcamp.com/rsvp
6565
*/
6666
$class_mapper['rsvp'] = 'rsvp';
67+
/*
68+
* invite
69+
* @link https://indieweb.org/invitation
70+
*/
71+
$class_mapper['invitee'] = 'invite';
6772

6873
/*
6974
* tag
@@ -160,6 +165,10 @@ public static function generate_commentdata( $commentdata ) {
160165
$author = self::get_representative_author( $mf_array, $source );
161166
$author = self::flatten_microformats( $author );
162167
}
168+
// If this is an invite than the invite should be displayed instead of the author
169+
if ( isset( $properties['invitee'] ) ) {
170+
$author = $properties['invitee'];
171+
}
163172

164173
// if author is present use the informations for the comment
165174
if ( $author ) {
@@ -247,6 +256,9 @@ public static function generate_commentdata( $commentdata ) {
247256
// get post type
248257
$commentdata['comment_meta']['semantic_linkbacks_type'] = wp_slash( self::get_entry_type( $commentdata['target'], $entry, $mf_array ) );
249258
}
259+
if ( isset( $properties['invitee'] ) ) {
260+
$commentdata['comment_meta']['semantic_linkbacks_type'] = wp_slash( 'invite' );
261+
}
250262

251263
$whitelist = array(
252264
'author',

languages/semantic-linkbacks.pot

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# This file is distributed under the MIT.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: Semantic-Linkbacks 3.7.2\n"
5+
"Project-Id-Version: Semantic-Linkbacks 3.7.4\n"
66
"Report-Msgid-Bugs-To: "
77
"http://wordpress.org/support/plugin/semantic-linkbacks\n"
8-
"POT-Creation-Date: 2017-12-29 09:07:37+00:00\n"
8+
"POT-Creation-Date: 2017-12-29 10:21:09+00:00\n"
99
"MIME-Version: 1.0\n"
1010
"Content-Type: text/plain; charset=utf-8\n"
1111
"Content-Transfer-Encoding: 8bit\n"
@@ -66,12 +66,12 @@ msgstr ""
6666

6767
#: includes/class-linkbacks-handler.php:224
6868
#. translators: Name verb on domain
69-
msgid "%1$s is <strong>invited</strong>."
69+
msgid "%1$s is <strong>interested</strong> in this event."
7070
msgstr ""
7171

7272
#: includes/class-linkbacks-handler.php:226
7373
#. translators: Name verb on domain
74-
msgid "%1$s <strong>tracks</strong> this event."
74+
msgid "%1$s is <strong>invited</strong>."
7575
msgstr ""
7676

7777
#: includes/class-linkbacks-handler.php:240
@@ -106,10 +106,13 @@ msgstr ""
106106
#: includes/class-linkbacks-handler.php:249
107107
#: includes/class-linkbacks-handler.php:250
108108
#: includes/class-linkbacks-handler.php:251
109-
#: includes/class-linkbacks-handler.php:252
110109
msgid "RSVP"
111110
msgstr ""
112111

112+
#: includes/class-linkbacks-handler.php:252 templates/linkbacks.php:102
113+
msgid "Invited"
114+
msgstr ""
115+
113116
#: includes/class-linkbacks-handler.php:266
114117
msgid "this Article"
115118
msgstr ""
@@ -269,10 +272,6 @@ msgstr ""
269272
msgid "Yes"
270273
msgstr ""
271274

272-
#: templates/linkbacks.php:102
273-
msgid "Invited"
274-
msgstr ""
275-
276275
#: templates/linkbacks.php:114
277276
msgid "Maybe"
278277
msgstr ""

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: webmention, pingback, trackback, linkback, microformats, comments, indiewe
55
Requires at least: 4.8.2
66
Requires PHP: 5.4
77
Tested up to: 4.9.1
8-
Stable tag: 3.7.3
8+
Stable tag: 3.7.4
99
License: MIT
1010
License URI: http://opensource.org/licenses/MIT
1111

@@ -68,6 +68,9 @@ 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.4 =
72+
* Replace `rsvp-invite` property which is not in use with `invite` property and add unit tests
73+
7174
= 3.7.3 =
7275

7376
* Replace tracking with interested property as noted on https://indieweb.org/rsvp

semantic-linkbacks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Semantic Linkbacks for WebMentions, Trackbacks and Pingbacks
66
* Author: Matthias Pfefferle
77
* Author URI: https://notiz.blog/
8-
* Version: 3.7.3
8+
* Version: 3.7.4
99
* License: MIT
1010
* License URI: http://opensource.org/licenses/MIT
1111
* Text Domain: semantic-linkbacks
@@ -20,7 +20,7 @@
2020
* @author Matthias Pfefferle
2121
*/
2222
class Semantic_Linkbacks_Plugin {
23-
public static $version = '3.7.2';
23+
public static $version = '3.7.4';
2424
/**
2525
* Initialize the plugin, registering WordPress hooks.
2626
*/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Bridgy Response</title>
6+
<style type="text/css">
7+
body {
8+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
9+
}
10+
.p-uid {
11+
display: none;
12+
}
13+
.u-photo {
14+
max-width: 50px;
15+
border-radius: 4px;
16+
}
17+
.e-content {
18+
margin-top: 10px;
19+
font-size: 1.3em;
20+
}
21+
</style>
22+
</head>
23+
<article class="h-entry">
24+
<span class="p-uid">tag:facebook.com,2013:169650146961455_rsvp_318643335139472</span>
25+
26+
27+
28+
<span class="p-author h-card">
29+
<data class="p-uid" value="tag:facebook.com,2013:5410052"></data>
30+
<data class="p-numeric-id" value="5410052"></data>
31+
<a class="p-name u-url" href="https://www.facebook.com/5410052">Chris Aldrich</a>
32+
33+
<img class="u-photo" src="https://graph.facebook.com/v2.10/5410052/picture?type=large" alt="" />
34+
</span>
35+
36+
<a class="p-name u-url" href="https://www.facebook.com/169650146961455#318643335139472">invited</a>
37+
<div class="">
38+
<span class="p-invitee h-card">
39+
<a class="p-name u-url" href="http://example.com/webmention/target/placeholder">Angelo Gladding</a>
40+
41+
<img class="u-photo" src="https://graph.facebook.com/v2.10/318643335139472/picture?type=large" alt="" />
42+
</span>
43+
44+
45+
</div>
46+
47+
48+
49+
50+
<a class="u-in-reply-to" href="http://example.com/webmention/target/placeholder"></a>
51+
52+
53+
</article>
54+
55+
</html>
56+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"comment_author": "Angelo Gladding",
3+
"comment_author_url": "http://example.com/webmention/target/placeholder",
4+
"comment_meta": {
5+
"semantic_linkbacks_type": "invite"
6+
}
7+
}

tests/test-microformats.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
<?php
22
class MicroformatsTest extends WP_UnitTestCase {
3+
4+
public static function assertArraySubset( array $expectation, array $reality, $strict = false, $message = '' ) {
5+
foreach ( $expectation as $key => $value ) {
6+
self::assertArrayHasKey( $key, $reality, $message );
7+
if ( is_array( $value ) ) {
8+
self::assertArraySubset( $value, $reality[ $key ], $strict, $message . '[' . $key . ']' );
9+
} else {
10+
self::assertEquals( $value, $reality[ $key ], $message . '[' . $key . ']' );
11+
}
12+
}
13+
}
14+
315
/**
416
* @dataProvider templateProvider
517
*/

0 commit comments

Comments
 (0)