3
1
Back

Court // Gunnerkrigg Court // Gunnerkrigg Court elseif (strpos($article['link'], 'somethingpositive.net') !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $this->get_img_tags($xpath, '(//div[@id="comicbody"]//img)', $article) . $article['content']; elseif (strpos($article["link"], "drugsandwires.fail/dnwcomic/") !== FALSE) { $doc = new DOMDocument(); $doc->loadHTML($article['content']); $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $matches[1]; $img = preg_replace("@height=\"\d+\"@", "", $img); $article['content'] = $img; } } Clean up code formatting; added a few comics; standardized appending alt/title text under images (extra useful for non-browser users) function about() { function get_img_tags($xpath, $query, $article, $base_url=NULL) { /* absolute URL */ $abs = "$host$path/$rel"; function get_content($link) { $html = fetch_file_contents($link); Fix for when invisiblebread has no bread Fix for when invisiblebread has no bread elseif (strpos($article['link'], 'somethingpositive.net') !== FALSE) { $xpath = new DOMXpath($doc); $bread = $xpath->query("//a[contains(@href, 'bonus-panel')]")->item(0); if ($bread) { $bread_page_url = $bread->getAttribute('href'); $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $this->get_img_tags($xpath, "//div[@id='comic']//img", $article); } } Invisible Bread, Softer World (alt tags), Dinosaur Comics Cleanup elseif (strpos($article['link'], 'threepanelsoul.com/2') !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $matches[1]; $img = preg_replace("@height=\"\d+\"@", "", $img); $article['content'] = $this->get_img_tags($xpath, "//div[@id='comic']//img", $article); } // XKCD (alt tags we don't need to mess with them. // this is far simpler than this // only keep everything starting at the top to indicate direction? Pointer2 = 1; $n > 0; $abs = "$host$path/$rel"; /* replace '//' or '/./' or '/foo/../' with '/' */ $re = array('#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#'); for($n=1; $n>0; $abs=preg_replace($re, '/', $abs, -1, $n)) { } /* dirty absolute URL is ready! */ return $scheme.'://'.$abs; return $scheme . '://' . $abs; } From 0d3d72c49e606725216a5a9a4217e6c039d5a574 Mon Sep 17 00:00:00 2001.

New Pull Request