More robust pingback link detection

This commit is contained in:
Stephen Paul Weber 2015-10-14 15:28:38 -05:00
parent 0ba53edd96
commit a4a37d6fc9
1 changed files with 3 additions and 3 deletions

View File

@ -100,9 +100,9 @@ class LinkbackPlugin extends Plugin
if (array_key_exists('X-Pingback', $result->headers)) { if (array_key_exists('X-Pingback', $result->headers)) {
$pb = $result->headers['X-Pingback']; $pb = $result->headers['X-Pingback'];
} else if (preg_match('/<link rel="pingback" href="([^"]+)" ?\/?>/',
$result->body, } else if(preg_match('/<(?:link|a)[ ]+href="([^"]+)"[ ]+rel="[^" ]* ?pingback ?[^" ]*"[ ]*\/?>/i', $result->body, $match)
$match)) { || preg_match('/<(?:link|a)[ ]+rel="[^" ]* ?pingback ?[^" ]*"[ ]+href="([^"]+)"[ ]*\/?>/i', $result->body, $match)) {
$pb = $match[1]; $pb = $match[1];
} }