]> git.wh0rd.org Git - tt-rss.git/commitdiff
add af_comics filter for toothpastefordinner
authorAndrew Dolgov <noreply@fakecake.org>
Tue, 21 Oct 2014 12:53:17 +0000 (16:53 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Tue, 21 Oct 2014 12:53:17 +0000 (16:53 +0400)
plugins/af_comics/filters/af_comics_tfd.php [new file with mode: 0644]

diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php
new file mode 100644 (file)
index 0000000..c4e5945
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+class Af_Comics_Tfd extends Af_ComicFilter {
+
+       function supported() {
+               return array("Toothpaste For Dinner");
+       }
+
+       function process(&$article) {
+               $owner_uid = $article["owner_uid"];
+
+               if (strpos($article["link"], "toothpastefordinner.com") !== FALSE) {
+                       $doc = new DOMDocument();
+
+                       @$doc->loadHTML(fetch_file_contents($article["link"]));
+
+                       $basenode = false;
+
+                       if ($doc) {
+                               $xpath = new DOMXPath($doc);
+                               $basenode = $xpath->query('//img[@class="comic"]')->item(0);
+
+                               if ($basenode) {
+                                       $article["content"] = $doc->saveXML($basenode);
+                                       return true;
+                               }
+                       }
+               }
+
+               return false;
+       }
+}
+?>