]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
More robust pingback link detection
authorStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 14 Oct 2015 20:28:38 +0000 (15:28 -0500)
committerStephen Paul Weber <singpolyma@singpolyma.net>
Wed, 14 Oct 2015 20:28:38 +0000 (15:28 -0500)
plugins/Linkback/LinkbackPlugin.php

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