+
+ // let's try meta properties
+ if (!$found) {
+ _debug("looking for meta og:image", $debug);
+
+ $content = fetch_file_contents(["url" => $entry->getAttribute("href"),
+ "http_accept" => "text/*"]);
+
+ if ($content) {
+ $cdoc = new DOMDocument();
+
+ if (@$cdoc->loadHTML($content)) {
+ $cxpath = new DOMXPath($cdoc);
+
+ $og_image = $cxpath->query("//meta[@property='og:image']")->item(0);
+
+ if ($og_image) {
+
+ $og_src = $og_image->getAttribute("content");
+
+ if ($og_src) {
+ $img = $doc->createElement('img');
+ $img->setAttribute("src", $og_src);
+
+ $br = $doc->createElement('br');
+ $entry->parentNode->insertBefore($img, $entry);
+ $entry->parentNode->insertBefore($br, $entry);
+
+ $found = true;
+ }
+ }
+ }
+ }
+ }
+