+ <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">";
+
+ $rv['content'] .= "<meta property=\"og:title\" content=\"".htmlspecialchars($line["title"])."\"/>\n";
+ $rv['content'] .= "<meta property=\"og:site_name\" content=\"".htmlspecialchars($line["feed_title"])."\"/>\n";
+ $rv['content'] .= "<meta property=\"og:description\" content=\"".
+ htmlspecialchars(truncate_string(strip_tags($line["content"]), 500, "..."))."\"/>\n";
+
+ $rv['content'] .= "</head>";
+
+ $og_image = false;
+
+ foreach ($enclosures as $enc) {
+ if (strpos($enc["content_type"], "image/") !== FALSE) {
+ $og_image = $enc["content_url"];
+ break;
+ }
+ }
+
+ if (!$og_image) {
+ $tmpdoc = new DOMDocument();
+
+ if (@$tmpdoc->loadHTML(mb_substr($line["content"], 0, 131070))) {
+ $tmpxpath = new DOMXPath($tmpdoc);
+ $first_img = $tmpxpath->query("//img")->item(0);
+
+ if ($first_img) {
+ $og_image = $first_img->getAttribute("src");
+ }
+ }
+ }