af_comics_tfd.php 847 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class Af_Comics_Tfd extends Af_ComicFilter {
  3. function supported() {
  4. return array("Toothpaste For Dinner", "Married to the Sea");
  5. }
  6. function process(&$article) {
  7. if (strpos($article["link"], "toothpastefordinner.com") !== FALSE ||
  8. strpos($article["link"], "marriedtothesea.com") !== FALSE) {
  9. $res = fetch_file_contents($article["link"], false, false, false,
  10. false, false, 0,
  11. "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
  12. if (!$res) return $article;
  13. $doc = new DOMDocument();
  14. if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
  15. $xpath = new DOMXPath($doc);
  16. $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
  17. if ($basenode) {
  18. $article["content"] = $doc->saveHTML($basenode);
  19. return true;
  20. }
  21. }
  22. }
  23. return false;
  24. }
  25. }