- // linked albums & pages
-
- /*if (!$found && preg_match("/^https?:\/\/(m\.)?imgur.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches) ||
- preg_match("/^https?:\/\/(m\.)?imgur.com\/(a|album|gallery)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) {
-
- _debug("Handling as an imgur page/album/gallery", $debug);
-
- $album_content = fetch_file_contents($entry->getAttribute("href"),
- false, false, false, false, 10);
-
- if ($album_content) {
- $adoc = new DOMDocument();
-
- if (@$adoc->loadHTML($album_content)) {
- $axpath = new DOMXPath($adoc);
-
- $aentries = $axpath->query("(//div[@class='post-image']/img[@src] | //a[@class='zoom']/img[@src] | //div[@class='video-elements']/source)");
- $urls = [];
-
- foreach ($aentries as $aentry) {
-
- $url = $aentry->getAttribute("src");
-
- if (!in_array($url, $urls)) {
-
- if ($aentry->tagName == "img") {
-
- $img = $doc->createElement('img');
- $img->setAttribute("src", $url);
- $entry->parentNode->insertBefore($doc->createElement('br'), $entry);
-
- $br = $doc->createElement('br');
-
- $entry->parentNode->insertBefore($img, $entry);
- $entry->parentNode->insertBefore($br, $entry);
- } else if ($aentry->tagName == "source") {
-
- if (strpos($url, "imgur.com") !== FALSE)
- $poster_url = str_replace(".mp4", "h.jpg", $url);
- else
- $poster_url = "";
-
- $this->handle_as_video($doc, $entry, $url, $poster_url);
-
- }
-
- array_push($urls, $url);
-
- $found = true;
- }
-
- }
-
- if ($debug) print_r($urls);
- }
- }
- } */
-