af_redditimgur: maybe fix duplicate album images

This commit is contained in:
Andrew Dolgov 2015-07-15 23:06:15 +03:00
parent dfabcb337c
commit ecc92d92ac
1 changed files with 5 additions and 3 deletions

View File

@ -188,9 +188,11 @@ class Af_RedditImgur extends Plugin {
foreach ($aentries as $aentry) { foreach ($aentries as $aentry) {
if (!in_array($aentry->getAttribute("content"), $urls)) { $url = str_replace("?fb", "", $aentry->getAttribute("content"));
if (!in_array($url, $urls)) {
$img = $doc->createElement('img'); $img = $doc->createElement('img');
$img->setAttribute("src", str_replace("?fb", "", $aentry->getAttribute("content"))); $img->setAttribute("src", $url);
$entry->parentNode->insertBefore($doc->createElement('br'), $entry); $entry->parentNode->insertBefore($doc->createElement('br'), $entry);
$br = $doc->createElement('br'); $br = $doc->createElement('br');
@ -198,7 +200,7 @@ class Af_RedditImgur extends Plugin {
$entry->parentNode->insertBefore($img, $entry); $entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry); $entry->parentNode->insertBefore($br, $entry);
array_push($urls, $aentry->getAttribute("content")); array_push($urls, $url);
$found = true; $found = true;
} }