From a46176172878938d936aaeb75c536d2e4d4016cf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 29 Jul 2015 16:27:07 +0300 Subject: [PATCH] af_redditimgur: check for duplicate first image in imgur albums --- plugins/af_redditimgur/init.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index c9989bc53..f3d8b28b4 100644 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -189,8 +189,10 @@ class Af_RedditImgur extends Plugin { foreach ($aentries as $aentry) { $url = str_replace("?fb", "", $aentry->getAttribute("content")); + $check_url = basename($url); + $check_url = mb_substr($check_url, 0, strrpos($check_url, ".")); - if (!in_array($url, $urls)) { + if (!in_array($check_url, $urls)) { $img = $doc->createElement('img'); $img->setAttribute("src", $url); $entry->parentNode->insertBefore($doc->createElement('br'), $entry); @@ -200,7 +202,7 @@ class Af_RedditImgur extends Plugin { $entry->parentNode->insertBefore($img, $entry); $entry->parentNode->insertBefore($br, $entry); - array_push($urls, $url); + array_push($urls, $check_url); $found = true; }