From c898802a8d9dfac5cc100b84325b0308619521c6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 9 Jun 2023 08:43:09 +0300 Subject: enable readability & handle_as_image --- init.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'init.php') diff --git a/init.php b/init.php index 739c2c3..6af66cd 100644 --- a/init.php +++ b/init.php @@ -145,20 +145,14 @@ class Af_Lemmy extends Plugin { $found = true; } - if (!$found && (preg_match("/\.(jpg|jpeg|gif|png)(\?[0-9][0-9]*)?[$\?]?/i", $entry_href) || + if (!$found && (preg_match("/\.(jpe?g|gif|png)(\?[0-9][0-9]*)?[$\?]?/i", $entry_href) || /* mb_strpos($entry_href, "i.reddituploads.com") !== false || */ mb_strpos($this->get_content_type($entry_href), "image/") !== false)) { Debug::log("Handling as a picture", Debug::LOG_VERBOSE); - $img = $doc->createElement('img'); - $img->setAttribute("src", $entry_href); - - $br = $doc->createElement('br'); - $entry->parentNode->insertBefore($img, $entry); - $entry->parentNode->insertBefore($br, $entry); - - $found = true; + $this->handle_as_image($doc, $entry, $entry_href, $entry_href); + $found = 1; } // imgur via link rel="image_src" href="..." @@ -302,7 +296,7 @@ class Af_Lemmy extends Plugin { $article["content"] = $doc->saveHTML($node); $article["enclosures"] = $this->generated_enclosures; } else { - // $article = $this->readability($article, $content_href, $doc, $xpath); + $article = $this->readability($article, $article['link'], $doc, $xpath); } } } -- cgit v1.2.3