1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 13:15:55 +00:00

Spaces to tabs for consistency.

This commit is contained in:
koffieanon
2020-01-04 17:21:05 +01:00
parent 297a89c2d2
commit e89dd83f05

View File

@@ -280,36 +280,36 @@ class Af_RedditImgur extends Plugin {
$found = true; $found = true;
} }
// imgur via link rel="image_src" href="..." // imgur via link rel="image_src" href="..."
if (!$found && preg_match("/imgur/", $entry->getAttribute("href"))) { if (!$found && preg_match("/imgur/", $entry->getAttribute("href"))) {
Debug::log("handling as imgur page/whatever", Debug::$LOG_VERBOSE); Debug::log("handling as imgur page/whatever", Debug::$LOG_VERBOSE);
$content = fetch_file_contents(["url" => $entry->getAttribute("href"), $content = fetch_file_contents(["url" => $entry->getAttribute("href"),
"http_accept" => "text/*"]); "http_accept" => "text/*"]);
if ($content) { if ($content) {
$cdoc = new DOMDocument(); $cdoc = new DOMDocument();
if (@$cdoc->loadHTML($content)) { if (@$cdoc->loadHTML($content)) {
$cxpath = new DOMXPath($cdoc); $cxpath = new DOMXPath($cdoc);
$rel_image = $cxpath->query("//link[@rel='image_src']")->item(0); $rel_image = $cxpath->query("//link[@rel='image_src']")->item(0);
if ($rel_image) { if ($rel_image) {
$img = $doc->createElement('img'); $img = $doc->createElement('img');
$img->setAttribute("src", $rel_image->getAttribute("href")); $img->setAttribute("src", $rel_image->getAttribute("href"));
$br = $doc->createElement('br'); $br = $doc->createElement('br');
$entry->parentNode->insertBefore($img, $entry); $entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry); $entry->parentNode->insertBefore($br, $entry);
$found = true; $found = true;
} }
} }
} }
} }
// wtf is this even // wtf is this even
if (!$found && preg_match("/^https?:\/\/gyazo\.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches)) { if (!$found && preg_match("/^https?:\/\/gyazo\.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches)) {