]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/af_tumblr_1280/init.php
support disabling of e-mail digests entirely
[tt-rss.git] / plugins / af_tumblr_1280 / init.php
index 985d8c5f889568fe1e7e011e8153271ec7ff30bd..8aba0e65239e2618e839931e430b6efd46305159 100755 (executable)
@@ -4,10 +4,14 @@ class Af_Tumblr_1280 extends Plugin {
 
        function about() {
                return array(1.0,
-                       "Replace Tumblr pictures with largest size if available (requires CURL)",
+                       "Replace Tumblr pictures and videos with largest size if available (requires CURL)",
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function init($host) {
                $this->host = $host;
 
@@ -60,6 +64,19 @@ class Af_Tumblr_1280 extends Plugin {
                                }
                        }
 
+                       $video_sources = $xpath->query('//video/source[contains(@src, \'.tumblr.com/video_file\')]');
+
+                       foreach ($video_sources as $source) {
+                               $src = $source->getAttribute("src");
+
+                               $new_src = preg_replace("/\/\d{3}$/", "", $src);
+
+                               if ($src != $new_src) {
+                                       $source->setAttribute("src", $new_src);
+                                       $found = true;
+                               }
+                       }
+
                        if ($found) {
                                $doc->removeChild($doc->firstChild); //remove doctype
                                $article["content"] = $doc->saveHTML();
@@ -75,5 +92,4 @@ class Af_Tumblr_1280 extends Plugin {
                return 2;
        }
 
-}
-?>
+}
\ No newline at end of file