]> git.wh0rd.org Git - tt-rss.git/commitdiff
af_comics: add cad embedding
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 17 Feb 2014 08:26:46 +0000 (12:26 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 17 Feb 2014 08:26:46 +0000 (12:26 +0400)
plugins/af_comics/init.php

index 993ddb7cdcbdc99b47c5ada97855fc47b8e2f01e..4672f33564b52799b8556ec0cb582e4983a9f662 100644 (file)
@@ -27,6 +27,7 @@ class Af_Comics extends Plugin {
                print "<li>Buni</li>
                <li>Buttersafe</li>
                <li>CSection</li>
+               <li>Ctrl+Alt+Del</li>
                <li>Dilbert</li>
                <li>Explosm</li>
                <li>GoComics</li>
@@ -150,6 +151,29 @@ class Af_Comics extends Plugin {
                        }
                }
 
+               if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
+                       if (strpos($article["plugin_data"], "af_comics,$owner_uid:") === 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/cad-")])')->item(0);
+
+                                       if ($basenode) {
+                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["plugin_data"] = "af_comics,$owner_uid:" . $article["plugin_data"];
+                                       }
+                               }
+
+                       } else if (isset($article["stored"]["content"])) {
+                               $article["content"] = $article["stored"]["content"];
+                       }
+               }
+
                if (strpos($article["guid"], "gocomics.com") !== FALSE) {
                        if (strpos($article["plugin_data"], "af_comics,$owner_uid:") === FALSE) {
                                $doc = new DOMDocument();