summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-08-12 12:16:07 +0300
committerAndrew Dolgov <[email protected]>2015-08-12 12:16:07 +0300
commit6dbd6585a98b52442e40b6175d2db39c3fb99426 (patch)
tree4cefb84d680c9495e84d893ab3841f0d381a4aa1 /plugins
parentb028da0a2d808f7d316734ecf479eeb3e96e2ec8 (diff)
af_readability: add pluggable filter action
Diffstat (limited to 'plugins')
-rw-r--r--plugins/af_readability/init.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/af_readability/init.php b/plugins/af_readability/init.php
index b4ccdd335..8914ba43a 100644
--- a/plugins/af_readability/init.php
+++ b/plugins/af_readability/init.php
@@ -21,6 +21,8 @@ class Af_Readability extends Plugin {
$host->add_hook($host::HOOK_PREFS_TAB, $this);
$host->add_hook($host::HOOK_PREFS_EDIT_FEED, $this);
$host->add_hook($host::HOOK_PREFS_SAVE_FEED, $this);
+
+ $host->add_filter_action($this, "action_inline", __("Inline content"));
}
function hook_prefs_tab($args) {
@@ -90,11 +92,11 @@ class Af_Readability extends Plugin {
$this->host->set($this, "enabled_feeds", $enabled_feeds);
}
- function hook_article_filter($article) {
+ function hook_article_filter_action($article, $action) {
+ return $this->process_article($article);
+ }
- $enabled_feeds = $this->host->get($this, "enabled_feeds");
- $key = array_search($article["feed"]["id"], $enabled_feeds);
- if ($key === FALSE) return $article;
+ function process_article($article) {
if (!class_exists("Readability")) require_once(dirname(dirname(__DIR__)). "/lib/readability/Readability.php");
@@ -161,6 +163,15 @@ class Af_Readability extends Plugin {
}
return $article;
+ }
+
+ function hook_article_filter($article) {
+
+ $enabled_feeds = $this->host->get($this, "enabled_feeds");
+ $key = array_search($article["feed"]["id"], $enabled_feeds);
+ if ($key === FALSE) return $article;
+
+ return $this->process_article($article);
}