diff options
author | fox <[email protected]> | 2020-01-05 05:44:00 +0000 |
---|---|---|
committer | Gogs <[email protected]> | 2020-01-05 05:44:00 +0000 |
commit | 67c7b6ef5360eff3b00d95b7a2f74aa1e56d812f (patch) | |
tree | b97a1433c6500afa27ca5c0db1956d3832fcc36e /plugins | |
parent | 5448a9462e4c8ce6194d0a6dceeef4e422386c55 (diff) | |
parent | 3a3c74dfa42abd2fcd66b40f55675f5942ea0794 (diff) |
Merge branch 'af_redditimgur_update' of koffieanon/tt-rss into master
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/af_redditimgur/init.php | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index c8ba4a1b2..d28e072f4 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -239,10 +239,10 @@ class Af_RedditImgur extends Plugin { } $matches = array(); - if (!$found && preg_match("/youtube\.com\/v\/([\w-]+)/", $entry->getAttribute("href"), $matches) || + if (!$found && (preg_match("/youtube\.com\/v\/([\w-]+)/", $entry->getAttribute("href"), $matches) || preg_match("/youtube\.com\/.*?[\&\?]v=([\w-]+)/", $entry->getAttribute("href"), $matches) || preg_match("/youtube\.com\/watch\?v=([\w-]+)/", $entry->getAttribute("href"), $matches) || - preg_match("/\/\/youtu.be\/([\w-]+)/", $entry->getAttribute("href"), $matches)) { + preg_match("/\/\/youtu.be\/([\w-]+)/", $entry->getAttribute("href"), $matches))) { $vid_id = $matches[1]; @@ -264,9 +264,9 @@ class Af_RedditImgur extends Plugin { $found = true; } - if (!$found && preg_match("/\.(jpg|jpeg|gif|png)(\?[0-9][0-9]*)?$/i", $entry->getAttribute("href")) || + if (!$found && (preg_match("/\.(jpg|jpeg|gif|png)(\?[0-9][0-9]*)?[$\?]/i", $entry->getAttribute("href")) || mb_strpos($entry->getAttribute("href"), "i.reddituploads.com") !== FALSE || - mb_strpos($this->get_content_type($entry->getAttribute("href")), "image/") !== FALSE) { + mb_strpos($this->get_content_type($entry->getAttribute("href")), "image/") !== FALSE)) { Debug::log("Handling as a picture", Debug::$LOG_VERBOSE); @@ -280,36 +280,36 @@ class Af_RedditImgur extends Plugin { $found = true; } - // imgur via link rel="image_src" href="..." - if (!$found && preg_match("/imgur/", $entry->getAttribute("href"))) { + // imgur via link rel="image_src" 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"), - "http_accept" => "text/*"]); + $content = fetch_file_contents(["url" => $entry->getAttribute("href"), + "http_accept" => "text/*"]); - if ($content) { - $cdoc = new DOMDocument(); + if ($content) { + $cdoc = new DOMDocument(); - if (@$cdoc->loadHTML($content)) { - $cxpath = new DOMXPath($cdoc); + if (@$cdoc->loadHTML($content)) { + $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->setAttribute("src", $rel_image->getAttribute("href")); + $img = $doc->createElement('img'); + $img->setAttribute("src", $rel_image->getAttribute("href")); - $br = $doc->createElement('br'); - $entry->parentNode->insertBefore($img, $entry); - $entry->parentNode->insertBefore($br, $entry); + $br = $doc->createElement('br'); + $entry->parentNode->insertBefore($img, $entry); + $entry->parentNode->insertBefore($br, $entry); - $found = true; - } - } - } - } + $found = true; + } + } + } + } // wtf is this even if (!$found && preg_match("/^https?:\/\/gyazo\.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches)) { |