diff options
author | Andrew Dolgov <[email protected]> | 2023-06-09 08:43:09 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-06-09 08:43:09 +0300 |
commit | c898802a8d9dfac5cc100b84325b0308619521c6 (patch) | |
tree | 97816ed3bbb884b80250a95ab482e89d5ca1bea0 /init.php | |
parent | 0b15471029dab95dc48e94ecaa73cdd9acd6fbaf (diff) |
enable readability & handle_as_image
Diffstat (limited to 'init.php')
-rw-r--r-- | init.php | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -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); } } } |