]> git.mjollnir.org Git - s9y.git/commitdiff
pingback fetchData: Retreive content from first <p> tag, if found in order to have...
authorbrockhaus <brockhaus>
Wed, 22 Aug 2007 17:57:57 +0000 (17:57 +0000)
committerbrockhaus <brockhaus>
Wed, 22 Aug 2007 17:57:57 +0000 (17:57 +0000)
include/functions_trackbacks.inc.php

index 315426bb3e9d3fc8a149b213ee87b47eacee7ce3..cb9dd1f538bb743daed61421d2ed9a52e8b5927c 100644 (file)
@@ -510,10 +510,16 @@ function fetchPingbackData( &$comment) {
             $comment['title'] = strip_tags($matches[1]);
         }
         
+        // Try to get content from first <p> tag on:
+        if (preg_match('@<p[^>]*>(.*?)</body>@is',$fContent,$matches)) {
+            $body = $matches[1];
+        }
+        if (empty($body) && preg_match('@<body[^>]*>(.*?)</body>@is',$fContent,$matches)){
+            $body = $matches[1];
+        }
         // Get a part of the article
-        if (preg_match('@<body[^>]*>(.*?)</body>@is',$fContent,$matches)) {
-            
-            $body = strip_tags($matches[1]);
+        if (!empty($body)) {
+            $body = strip_tags($body);
 
             //TODO: Serendipity comes into trouble wit html_entity_decode and "Umlaute"
             $body = str_replace(array("&nbsp;"),array(' '),$body);