Add rel=trackback header and discovery (#438)
This commit is contained in:
parent
565b8ef51d
commit
18f6429f32
@ -172,6 +172,10 @@ function serendipity_trackback_autodiscover($res, $loc, $url, $author, $title, $
|
|||||||
$is_wp = false;
|
$is_wp = false;
|
||||||
$wp_check = false;
|
$wp_check = false;
|
||||||
|
|
||||||
|
// the new detection method via rel=trackback should have priority
|
||||||
|
if (preg_match('@link\s*rel=["\']trackback["\'].*href=["\'](https?:[^"\']+)["\']@i', $res, $matches)) {
|
||||||
|
$trackURI = trim($matches[1]);
|
||||||
|
} else {
|
||||||
if (preg_match('@((' . preg_quote($loc, '@') . '|' . preg_quote($loc2, '@') . ')/?trackback/)@i', $res, $wp_loc)) {
|
if (preg_match('@((' . preg_quote($loc, '@') . '|' . preg_quote($loc2, '@') . ')/?trackback/)@i', $res, $wp_loc)) {
|
||||||
// We found a WP-blog that may not advertise RDF-Tags!
|
// We found a WP-blog that may not advertise RDF-Tags!
|
||||||
$is_wp = true;
|
$is_wp = true;
|
||||||
@ -209,6 +213,7 @@ function serendipity_trackback_autodiscover($res, $loc, $url, $author, $title, $
|
|||||||
if ($wp_check) {
|
if ($wp_check) {
|
||||||
$trackURI = $wp_loc[0];
|
$trackURI = $wp_loc[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = 'url=' . rawurlencode($url)
|
$data = 'url=' . rawurlencode($url)
|
||||||
. '&title=' . rawurlencode($title)
|
. '&title=' . rawurlencode($title)
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<link rel="alternate" type="application/rss+xml" title="{$blogTitle} RSS feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/index.rss2">
|
<link rel="alternate" type="application/rss+xml" title="{$blogTitle} RSS feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/index.rss2">
|
||||||
<link rel="alternate" type="application/x.atom+xml" title="{$blogTitle} Atom feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/atom.xml">
|
<link rel="alternate" type="application/x.atom+xml" title="{$blogTitle} Atom feed" href="{$serendipityBaseURL}{$serendipityRewritePrefix}feeds/atom.xml">
|
||||||
{if $entry_id}
|
{if $entry_id}
|
||||||
|
<link rel="trackback" type="application/x-www-form-urlencoded" href="{$serendipityBaseURL}comment.php?type=trackback&entry_id={$entry_id}">
|
||||||
<link rel="pingback" href="{$serendipityBaseURL}comment.php?type=pingback&entry_id={$entry_id}">
|
<link rel="pingback" href="{$serendipityBaseURL}comment.php?type=pingback&entry_id={$entry_id}">
|
||||||
{/if}
|
{/if}
|
||||||
{serendipity_hookPlugin hook="frontend_header"}
|
{serendipity_hookPlugin hook="frontend_header"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user