]> git.wh0rd.org Git - tt-rss.git/commitdiff
Add support for sillies
authoraliz27 <aliz@tamperd.net>
Wed, 13 May 2015 16:19:32 +0000 (18:19 +0200)
committeraliz27 <aliz@tamperd.net>
Wed, 13 May 2015 16:19:32 +0000 (18:19 +0200)
plugins/af_comics/filters/af_comics_cad.php

index 43836724fb18a005a2abb6ee493e549bad85cc2c..15b8d7ad4dae5f3af1e84e92b1afe77e6453be6b 100644 (file)
@@ -8,8 +8,8 @@ class Af_Comics_Cad extends Af_ComicFilter {
        function process(&$article) {
                $owner_uid = $article["owner_uid"];
 
-               if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
-                       if (strpos($article["title"], "News:") === FALSE) {
+               if (strpos($article["title"], "News:") === FALSE) {
+                       if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
 
                                $doc = new DOMDocument();
                                @$doc->loadHTML(fetch_file_contents($article["link"]));
@@ -24,9 +24,24 @@ class Af_Comics_Cad extends Af_ComicFilter {
                                                $article["content"] = $doc->saveXML($basenode);
                                        }
                                }
-
                        }
+                       
+                       elseif (strpos($article["link"], "cad-comic.com/sillies/") !== FALSE) {
+                               $doc = new DOMDocument();
+                               @$doc->loadHTML(fetch_file_contents($article["link"]));
 
+                               $basenode = false;
+
+                               if ($doc) {
+                                       $xpath = new DOMXPath($doc);
+                                       $basenode = $xpath->query('(//img[contains(@src, "/comics/sillies-")])')->item(0);
+
+                                       if ($basenode) {
+                                               $article["content"] = $doc->saveXML($basenode);
+                                       }
+                               }
+                       }
+                       
                        return true;
                }