3
1
Back

PDF Fix for two bugs in Doghouse Diaries rss: spaces in img src and quotes in alt/title text Added The Trenches; yet more code style tweaking // The Oatmeal $entries = $xpath->query($query); $result_html = ''; $orig_src = $entry->getAttribute('src'); $new_src = $this->rel2abs($orig_src, $article['link']); if ($alt_text == $title_text){ } elseif (strpos($article["link"], "explosm.net/comics") !== FALSE) { // Drugs and Wires elseif (strpos($article['link'], 'dead-philosophers.com/?p') !== FALSE) { elseif (strpos($article['link'], 'jesusandmo.net') !== FALSE) { $xpath = $this->get_xpath_dealie($article['link']); $article['content'] = $this->get_img_tags($xpath, '//td/img[contains(@src, "/comics/images/")]', $article); } Gunnerkrigg and cleanup of alt-tag-only sites Invisible Bread, Softer World (alt tags), Dinosaur Comics Cleanup elseif (strpos($article['link'], 'www.timothywinchester.com/2') !== FALSE) { elseif (strpos($article['content'], 'www.asofterworld.com/index.php?id') !== FALSE) { $doc = new DOMDocument(); $doc->loadHTML($article['content']); $xpath = $this->get_xpath_dealie($article['link']); // elseif (strpos($article["link"], "explosm.net/comics") !== FALSE) { $xpath = new DOMXpath($doc); $imgs = $xpath->query('//img'); //doesn't get simpler than this foreach ($imgs as $img) { $article['content'] = $this->get_img_tags($xpath, "//div[@id='comic']/noscript/img", $article); } // XKCD (alt tags we don't need to call out for foreach ($imgs as $img) { if ($title_text == $article['title'] || strpos($article['title'], $title_text) !== False) { $alt_text = $entry->getAttribute('alt'); $alt_text = $entry->getAttribute('alt'); $alt_text = trim($entry->getAttribute('alt')); $alt_text = trim($entry->getAttribute('title')); $result_html .= "
Alt: $alt_text
"; } } // there's both alt and title texts, they're both different, use both. $title_element = $doc->createElement("i", $title_text); } function get_img_tags($xpath, $query, $article){ $entries = $xpath->query("//div[@class='entry']"); foreach ($entries as $entry){ $article['content'] .= "

" . $entry->ownerDocument->saveXML($entry) . "

"; } } // Dead Philosophers // Dead Philosophers elseif (strpos($article['link'], 'cad-comic.com/comic/') !== FALSE) { $article['content'] .= "
" . $msg . ""; // Softer World (alt tags), Dinosaur Comics (alt tags+blog), CAD, attempt at OOTS (but that one uses a ground plane on only.

New Pull Request