host = $host; $host->add_hook($host::HOOK_PREFS_TAB, $this); $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); } function csrf_ignore($method) { $csrf_ignored = array("index", "edit"); return array_search($method, $csrf_ignored) !== false; } function before($method) { if ($_SESSION["uid"]) { return true; } return false; } function after() { return true; } function hook_article_filter($article) { $ftr = $this->host->get($this, "ftr_url"); $url = trim($article['link']); $request = $ftr.'makefulltextfeed.php?format=json&url='.urlencode($url); if (version_compare(VERSION, '1.7.9', '>=')) { $result = fetch_file_contents($request); } else { // fallback to file_get_contents() $result = file_get_contents($request); } $result = json_decode($result, true); $content = $result['rss']['channel']['item']['description']; if (!(strcmp($content, "[unable to retrieve full-text content]") == 0)) { $article['title'] = $result['rss']['channel']['item']['title']; $article['content'] = $content; } return $article; } function hook_prefs_tab($args) { if ($args != "prefPrefs") return; print "