summaryrefslogtreecommitdiff
path: root/plugins/af_redditimgur
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-07-11 00:54:15 +0300
committerAndrew Dolgov <[email protected]>2015-07-11 00:54:15 +0300
commitd4ac4fc6fdf639ebb00957dfea5935413bce541d (patch)
tree2f9ac64c67461b4e65a44c9e2394a6dc1e9bb74d /plugins/af_redditimgur
parentb8887ebb14cb8d27d385e3e4db965dbc46473732 (diff)
af_redditimgur: fix imgur single-image pages
Diffstat (limited to 'plugins/af_redditimgur')
-rw-r--r--plugins/af_redditimgur/init.php40
1 files changed, 3 insertions, 37 deletions
diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php
index 6f2c7ff98..c4ec265d3 100644
--- a/plugins/af_redditimgur/init.php
+++ b/plugins/af_redditimgur/init.php
@@ -159,44 +159,10 @@ class Af_RedditImgur extends Plugin {
$found = true;
}
- // links to imgur pages
- $matches = array();
- if (preg_match("/^https?:\/\/(m\.)?imgur.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches)) {
-
- $token = $matches[2];
-
- $album_content = fetch_file_contents($entry->getAttribute("href"),
- false, false, false, false, 10);
-
- if ($album_content && $token) {
- $adoc = new DOMDocument();
- @$adoc->loadHTML($album_content);
-
- if ($adoc) {
- $axpath = new DOMXPath($adoc);
- $aentries = $axpath->query('(//img[@src])');
-
- foreach ($aentries as $aentry) {
- if (preg_match("/\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) {
- $img = $doc->createElement('img');
- $img->setAttribute("src", $aentry->getAttribute("src"));
-
- $br = $doc->createElement('br');
-
- $entry->parentNode->insertBefore($img, $entry);
- $entry->parentNode->insertBefore($br, $entry);
-
- $found = true;
-
- break;
- }
- }
- }
- }
- }
+ // linked albums & pages
- // linked albums, ffs
- if (preg_match("/^https?:\/\/imgur.com\/(a|album|gallery)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) {
+ if (preg_match("/^https?:\/\/(m\.)?imgur.com\/([^\.\/]+$)/", $entry->getAttribute("href"), $matches) ||
+ preg_match("/^https?:\/\/imgur.com\/(a|album|gallery)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) {
$album_content = fetch_file_contents($entry->getAttribute("href"),
false, false, false, false, 10);