Merge branch 'Add_set_basic_feed_info_to_af_comics' of rodneys_mission/tt-rss into master

This commit is contained in:
fox 2019-03-13 04:49:01 +00:00 committed by Gogs
commit e0dabf318b
1 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class Af_Comics extends Plugin {
$this->host = $host;
$host->add_hook($host::HOOK_FETCH_FEED, $this);
$host->add_hook($host::HOOK_FEED_BASIC_INFO, $this);
$host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
$host->add_hook($host::HOOK_PREFS_TAB, $this);
@ -166,6 +167,16 @@ class Af_Comics extends Plugin {
return $contents;
}
function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
if ($auth_login || $auth_pass)
return $basic_info;
if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches))
$basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
return $basic_info;
}
function api_version() {
return 2;
}