diff --git a/init.php b/init.php index 4e977cb..40f834f 100644 --- a/init.php +++ b/init.php @@ -10,7 +10,6 @@ define('ADD_IDS', False); define("GDORN_DEBUG", False); - class gdorn_comics extends Plugin { function about() { return array( @@ -53,10 +52,50 @@ class gdorn_comics extends Plugin { } // The Trenches elseif (strpos($article["link"], "trenchescomic.com/comic/post/") !== FALSE && - strpos($article["title"], "Comic:") !== FALSE) { + strpos($article["title"], "Comic:") !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $this->get_img_tags($xpath, '(//div[@id="comic"]//img)', $article); } + // SatW + elseif (strpos($article["link"], "satwcomic.com/") !== FALSE) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, '(//div[@class="container"]//center//img)', $article); + } + // Manic Pixie Nightmare Girls + elseif (strpos($article["link"], "manicpixienightmaregirls.com/") !== FALSE) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, '(//div[@id="main"]//img)', $article); + } + // PhD Unknown + elseif (strpos($article["link"], "www.phdunknown.com/index.php?id=") !== FALSE) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, '(//div[@id="comicbody"]//img)', $article) . $article['content']; + } + // SBMC + elseif (strpos($article["link"], "www.smbc-comics.com/comic/") !== FALSE) { + if (strpos($article["content"], "bonus panel!") !== FALSE) { + $xpath = $this->get_xpath_dealie($article['link']); + $aftercomic = $this->get_img_tags($xpath, '(//div[@id="aftercomic"]//img)', $article); + $article['content'] .= $aftercomic; + } + } + // Chainsawsuit + elseif (strpos($article["link"], "chainsawsuit.com/comic/") !== FALSE ) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, '(//div[@id="comic"]//img)', $article) . $article['content']; + } + // Eat That Toast + elseif (strpos($article["link"], "eatthattoast.com/comic/") !== FALSE ) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, '(//div[@id="comic"]//img)', $article); + } + // Poorly Drawn Lines + elseif (strpos($article["link"], "poorlydrawnlines.com/comic/") !== FALSE ) { + $xpath = $this->get_xpath_dealie($article['link']); + $img_tag = $this->get_img_tags($xpath, '(//div[@class="post"]//img)', $article); + + $article['content'] = $img_tag . $article['content']; + } // Cyanide & Happiness elseif (strpos($article["link"], "explosm.net/comics") !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); @@ -87,9 +126,9 @@ class gdorn_comics extends Plugin { $article['content'] = $this->get_img_tags($xpath, "//div[@id='content']/img", $article); } // CTRL+ALT+DEL - elseif (strpos($article['link'], 'cad-comic.com/cad/') !== FALSE) { + elseif (strpos($article['link'], 'cad-comic.com/comic/') !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); - $article['content'] = $this->get_img_tags($xpath, "//div[@id='content']/img", $article); + $article['content'] = $this->get_img_tags($xpath, "//div[@class='comicpage']//img[contains(@src, 'ENG_')]", $article); } // Three Panel Soul elseif (strpos($article['link'], 'threepanelsoul.com/2') !== FALSE) { @@ -158,14 +197,13 @@ class gdorn_comics extends Plugin { } // Doghouse Diaries, which has broken alt tags in feedburner (if there are quotes) elseif (strpos($article['content'], 'thedoghousediaries.com/dhdcomics/') !== FALSE){ - $xpath = $this->get_xpath_dealie($article['link']); - $article['content'] = $this->get_img_tags($xpath, "//div[@id='imgdiv']//img", $article); - //also get blog + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, "//div[@id='imgdiv']//img", $article); + //also get blog $entries = $xpath->query("//div[@id='signoff-wrapper']"); foreach ($entries as $entry) { $article['content'] .= "
" . $entry->textContent . "
"; } - } // Pain Train (to get alt tag) elseif (strpos($article['link'], 'paintraincomic.com/comic/') !== FALSE) { @@ -187,6 +225,16 @@ class gdorn_comics extends Plugin { $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $this->get_img_tags($xpath, "//div[@id='comic-1']//img", $article); } + // Robot Hugs + elseif (strpos($article['link'], 'www.robot-hugs.com/') !== FALSE) { + $xpath = $this->get_xpath_dealie($article['link']); + $article['content'] = $this->get_img_tags($xpath, "//div[@id='comic-1']//img", $article); + // And get blog entry + $entries = $xpath->query("//div[@class='entry']"); + foreach ($entries as $entry) { + $article['content'] .= "" . $entry->textContent . "
"; + } + } // Dinosaur Comics Cleanup elseif (strpos($article['link'], 'qwantz.com/index.php?comic') !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); @@ -210,18 +258,6 @@ class gdorn_comics extends Plugin { $article['content'] .= "" . $entry->ownerDocument->saveXML($entry) . "
"; } } - // VG Cats - elseif (strpos($article["content"], "//www.vgcats.com/comics/?strip_id=") !== FALSE) { - // slightly complicated; the link is to tumblr, but there's a url in the post that we want - $doc = new DOMDocument(); - $doc->loadHTML($article['content']); - $url_xpath = new DOMXpath($doc); - $vgcats_url_node = $url_xpath->query("//a[contains(@href, 'strip_id')]")->item(0); - $vgcats_url = $vgcats_url_node->getAttribute('href'); - $article['debug'][] = "URL: $vgcats_url"; - $xpath = $this->get_xpath_dealie($vgcats_url); - $article['content'] = $this->get_img_tags($xpath, "//div//img[contains(@src, 'images') and contains(@src, 'jpg')]", $article, "http://vgcats.com/comics/"); - } // Invisible Bread (make the bread visible) elseif (strpos($article['content'], 'invisiblebread.com/2') !== FALSE) { $doc = new DOMDocument(); @@ -242,9 +278,11 @@ class gdorn_comics extends Plugin { } // Questionable Content (cleanup) elseif (strpos($article['link'], 'questionablecontent') !== FALSE) { + // replace the