]> git.wh0rd.org - tt-rss.git/blame - plugins/af_comics/filters/af_comics_comicclass.php
Use 'saveHTML' when generating HTML from a DOMDocument.
[tt-rss.git] / plugins / af_comics / filters / af_comics_comicclass.php
CommitLineData
7624aa6e
AD
1<?php
2class Af_Comics_ComicClass extends Af_ComicFilter {
3
4 function supported() {
5 return array("Loading Artist");
6 }
7
8 function process(&$article) {
7624aa6e
AD
9 if (strpos($article["guid"], "loadingartist.com") !== FALSE) {
10
11 // lol at people who block clients by user agent
12 // oh noes my ad revenue Q_Q
13
14 $res = fetch_file_contents($article["link"], false, false, false,
15 false, false, 0,
16 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
17
18 $doc = new DOMDocument();
7624aa6e 19
21ce7d9e 20 if (@$doc->loadHTML($res)) {
7624aa6e
AD
21 $xpath = new DOMXPath($doc);
22 $basenode = $xpath->query('//div[@class="comic"]')->item(0);
23
24 if ($basenode) {
f3774b9d 25 $article["content"] = $doc->saveHTML($basenode);
7624aa6e
AD
26 }
27 }
28
29 return true;
30 }
31
32 return false;
33 }
f3774b9d 34}