]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_comics/filters/af_comics_gocomics.php
2 class Af_Comics_GoComics
extends Af_ComicFilter
{
5 return array("GoComics");
8 function process(&$article) {
9 $owner_uid = $article["owner_uid"];
11 if (strpos($article["guid"], "gocomics.com") !== FALSE) {
12 $doc = new DOMDocument();
13 @$doc->loadHTML(fetch_file_contents($article["link"]));
18 $xpath = new DOMXPath($doc);
19 $entries = $xpath->query("(//img[@class='strip'])");
23 if ($entries->length
> 1) { // if we have more than one match, then get the zoomed one, which is the second for gocomics
24 $entry = $entries->item(1); // get the second element (items start at 0)
25 if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
26 $entry->setAttribute("src", $matches[0]);
32 // fallback on the smaller version
33 foreach ($entries as $entry) {
34 if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
35 $entry->setAttribute("src", $matches[0]);
43 $article["content"] = $doc->saveXML($basenode);