add af_comics filter for toothpastefordinner

This commit is contained in:
Andrew Dolgov 2014-10-21 16:53:17 +04:00
parent edccb21df0
commit 110ce72a72
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
class Af_Comics_Tfd extends Af_ComicFilter {
function supported() {
return array("Toothpaste For Dinner");
}
function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["link"], "toothpastefordinner.com") !== FALSE) {
$doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false;
if ($doc) {
$xpath = new DOMXPath($doc);
$basenode = $xpath->query('//img[@class="comic"]')->item(0);
if ($basenode) {
$article["content"] = $doc->saveXML($basenode);
return true;
}
}
}
return false;
}
}
?>