Merge pull request #452 from aliz27/patch-1

Add support for sillies
This commit is contained in:
Andrew Dolgov 2015-05-13 19:22:13 +03:00
commit 6da5c4c365
1 changed files with 18 additions and 3 deletions

View File

@ -8,8 +8,8 @@ class Af_Comics_Cad extends Af_ComicFilter {
function process(&$article) {
$owner_uid = $article["owner_uid"];
if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
if (strpos($article["title"], "News:") === FALSE) {
if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
$doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
@ -24,7 +24,22 @@ class Af_Comics_Cad extends Af_ComicFilter {
$article["content"] = $doc->saveXML($basenode);
}
}
}
elseif (strpos($article["link"], "cad-comic.com/sillies/") !== FALSE) {
$doc = new DOMDocument();
@$doc->loadHTML(fetch_file_contents($article["link"]));
$basenode = false;
if ($doc) {
$xpath = new DOMXPath($doc);
$basenode = $xpath->query('(//img[contains(@src, "/comics/sillies-")])')->item(0);
if ($basenode) {
$article["content"] = $doc->saveXML($basenode);
}
}
}
return true;