]> git.wh0rd.org Git - tt-rss.git/commitdiff
af_redditimgur: check for duplicate first image in imgur albums
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 29 Jul 2015 13:27:07 +0000 (16:27 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Wed, 29 Jul 2015 13:27:07 +0000 (16:27 +0300)
plugins/af_redditimgur/init.php

index c9989bc53ab0c228e9d07998c8aee11fa4e16c8d..f3d8b28b4b041d3596c83b91b586e46a475d9bae 100644 (file)
@@ -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;
                                                                }