1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 04:35:56 +00:00

plugins: add HOOK_GET_FULL_TEXT which may be used to provide full text extraction to core code and other plugins, instead of trying to invoke af_readability specifically

This commit is contained in:
Andrew Dolgov
2019-04-17 08:32:35 +03:00
parent 525298569e
commit 6955b2e02d
3 changed files with 24 additions and 1 deletions

View File

@@ -38,6 +38,13 @@ class Af_Readability extends Plugin {
$host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
$host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
$enable_share_anything = $this->host->get($this, "enable_share_anything");
// provide full text services to external code
// TODO: option that controls this needs a better caption
if ($enable_share_anything)
$host->add_hook($host::HOOK_GET_FULL_TEXT, $this);
$host->add_filter_action($this, "action_inline", __("Inline content"));
}
@@ -237,6 +244,12 @@ class Af_Readability extends Plugin {
}
function hook_get_full_text($link) {
$extracted_content = $this->extract_content($link);
return trim(strip_tags(sanitize($extracted_content)));
}
function api_version() {
return 2;
}