summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-04-17 08:32:35 +0300
committerAndrew Dolgov <[email protected]>2019-04-17 08:32:35 +0300
commit6955b2e02d4893fd88009a8162d45b6c8b3514c6 (patch)
tree3320ab3de6089137b22125c3e3bda5cff2740129 /plugins
parent525298569ec9041e672dee60e20565b2e0dc0923 (diff)
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
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/af_readability/init.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php
index 32c54a2c7..b5e474f8d 100755
--- a/plugins/af_readability/init.php
+++ b/plugins/af_readability/init.php
@@ -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;
}