]>
git.wh0rd.org - tt-rss.git/blob - plugins/af_threewordphrase/init.php
7b178313b1f64174f059284ec6a5a9e95a3d70b0
2 class Af_ThreeWordPhrase
extends Plugin
{
8 "Fetch content of Three Word Phrase comics",
12 function init($host) {
15 $host->add_hook($host::HOOK_ARTICLE_FILTER
, $this);
18 function hook_article_filter($article) {
19 $owner_uid = $article["owner_uid"];
21 if (strpos($article["link"], "threewordphrase.com") !== FALSE) {
22 if (strpos($article["plugin_data"], "threewordphrase,$owner_uid:") === FALSE) {
24 $doc = new DOMDocument();
25 @$doc->loadHTML(fetch_file_contents($article["link"]));
30 $xpath = new DOMXpath($doc);
32 $basenode = $xpath->query("//td/center/img")->item(0);
35 $article["content"] = $doc->saveXML($basenode);
36 $article["plugin_data"] = "threewordphrase,$owner_uid:" . $article["plugin_data"];
39 } else if (isset($article["stored"]["content"])) {
40 $article["content"] = $article["stored"]["content"];
47 function api_version() {