]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/af_redditimgur/init.php
plugins: remove obsolete plugin_data/stored stuff
[tt-rss.git] / plugins / af_redditimgur / init.php
index 39a20784cd2a805262c8972b4cabf6a9779b0024..e513cc6f4f2858d67f7e8edcad96a8474e5e51b8 100644 (file)
@@ -15,12 +15,8 @@ class Af_RedditImgur extends Plugin {
        }
 
        function hook_article_filter($article) {
-               $owner_uid = $article["owner_uid"];
-
-               $force = false;
 
                if (strpos($article["link"], "reddit.com/r/") !== FALSE) {
-                       if (strpos($article["plugin_data"], "redditimgur,$owner_uid:") === FALSE || $force) {
                                $doc = new DOMDocument();
                                @$doc->loadHTML($article["content"]);
 
@@ -62,7 +58,7 @@ class Af_RedditImgur extends Plugin {
                                                                                $aentries = $axpath->query('(//img[@src])');
 
                                                                                foreach ($aentries as $aentry) {
-                                                                                       if (preg_match("/^http:\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) {
+                                                                                       if (preg_match("/\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) {
                                                                                                $img = $doc->createElement('img');
                                                                                                $img->setAttribute("src", $aentry->getAttribute("src"));
 
@@ -81,7 +77,7 @@ class Af_RedditImgur extends Plugin {
                                                        }
 
                                                        // linked albums, ffs
-                                                       if (preg_match("/^http:\/\/imgur.com\/a\/[^\.]+$/", $entry->getAttribute("href"), $matches)) {
+                                                       if (preg_match("/^http:\/\/imgur.com\/(a|album)\/[^\.]+$/", $entry->getAttribute("href"), $matches)) {
 
                                                                $album_content = fetch_file_contents($entry->getAttribute("href"),
                                                                        false, false, false, false, 10);
@@ -123,12 +119,8 @@ class Af_RedditImgur extends Plugin {
 
                                        if ($node && $found) {
                                                $article["content"] = $doc->saveXML($node);
-                                               if (!$force) $article["plugin_data"] = "redditimgur,$owner_uid:" . $article["plugin_data"];
                                        }
                                }
-                       } else if (isset($article["stored"]["content"])) {
-                               $article["content"] = $article["stored"]["content"];
-                       }
                }
 
                return $article;