From: Andrew Dolgov Date: Wed, 29 Jul 2015 13:27:07 +0000 (+0300) Subject: af_redditimgur: check for duplicate first image in imgur albums X-Git-Tag: 16.3~201 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a46176172878938d936aaeb75c536d2e4d4016cf;p=tt-rss.git af_redditimgur: check for duplicate first image in imgur albums --- diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index c9989bc5..f3d8b28b 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; }