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

Commit e4e1b23

Browse files
authored
Merge pull request #91 from dshanske/tests
Fix All But One Tests
2 parents f9eda5f + cb817f4 commit e4e1b23

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

includes/class-linkbacks-mf2-handler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function generate_commentdata( $commentdata ) {
168168
if ( ! is_wp_error( $response ) ) {
169169
$parser = new Parser( wp_remote_retrieve_body( $response ), $author );
170170
$author_array = $parser->parse( true );
171-
$properties['author'] = $author = self::get_representative_author( $author_array, $author );
171+
$properties['author'] = $author = self::flatten_microformats( self::get_representative_author( $author_array, $author ) );
172172
}
173173
} else {
174174
$comment_data['comment_author'] = wp_slash( $author );
@@ -406,11 +406,10 @@ public static function get_representative_author( $mf_array, $source ) {
406406
if ( isset( $mf['properties'] ) && isset( $mf['properties']['url'] ) ) {
407407
foreach ( $mf['properties']['url'] as $url ) {
408408
if ( wp_parse_url( $url, PHP_URL_HOST ) == wp_parse_url( $source, PHP_URL_HOST ) ) {
409-
$flat = self::flatten_microformats( $mf );
410409
if ( isset( $mf_array['rels']['me'] ) ) {
411-
$flat['me'] = $mf_array['rels']['me'];
410+
$mf['properties']['me'] = $mf_array['rels']['me'];
412411
}
413-
return $flat;
412+
return $mf;
414413
break;
415414
}
416415
}

tests/templates/adactio-com.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ <h2>More information</h2>
476476
<h3>About this site</h3>
477477

478478
<address class="vcard h-card">
479-
<a href="http://adactio.com/" class="url u-url" rel="me">Adactio</a> is the online home of <a href="mailto:&#106;&#101;&#114;&#101;&#109;&#121;&#64;&#97;&#100;&#97;&#99;&#116;&#105;&#111;&#46;&#99;&#111;&#109;" class="email fn p-name u-email">Jeremy Keith</a>, a <span class="role p-role">web developer</span> and <span class="title p-job-title">author</span> living and working in <span class="adr p-adr"><span class="locality p-locality">Brighton</span>, <span class="country-name p-country-name">England</span></span>.
479+
<a href="http://example.com/adactio" class="url u-url" rel="me">Adactio</a> is the online home of <a href="mailto:&#106;&#101;&#114;&#101;&#109;&#121;&#64;&#97;&#100;&#97;&#99;&#116;&#105;&#111;&#46;&#99;&#111;&#109;" class="email fn p-name u-email">Jeremy Keith</a>, a <span class="role p-role">web developer</span> and <span class="title p-job-title">author</span> living and working in <span class="adr p-adr"><span class="locality p-locality">Brighton</span>, <span class="country-name p-country-name">England</span></span>.
480480
</address>
481481
</div>
482482

tests/test-microformats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public function test_interpreter( $file_name ) {
77
$comment = Linkbacks_MF2_Handler::generate_commentdata(
88
array(
99
'remote_source_original' => file_get_contents( dirname( __FILE__ ) . '/templates/' . $file_name . '.html' ),
10-
'comment_author_url' => 'http://example.com/webmention/source/placeholder',
10+
'comment_author_url' => 'http://example.com/webmention/target/placeholder',
1111
'target' => 'http://example.com/webmention/target/placeholder',
1212
'comment_type' => 'webmention',
1313
'comment_author' => $file_name,

0 commit comments

Comments
 (0)