summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-02-12 16:01:28 +0300
committerAndrew Dolgov <[email protected]>2017-02-12 16:01:28 +0300
commit58210301e0e462ddfe9bd625865059d57a0c7cd7 (patch)
treecf16254efec2a2c13bec84c72a0f1320759a7a79
parent3891782cf5fc20dc70e17c8665866aef6392233e (diff)
add HOOK_ENCLOSURE_ENTRY for af_zz_imgproxy
-rw-r--r--classes/pluginhost.php1
-rw-r--r--include/functions2.php4
-rw-r--r--plugins/af_zz_imgproxy/init.php9
3 files changed, 14 insertions, 0 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 82565257a..3c2d7931e 100644
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -51,6 +51,7 @@ class PluginHost {
const HOOK_ARTICLE_FILTER_ACTION = 30;
const HOOK_ARTICLE_EXPORT_FEED = 31;
const HOOK_MAIN_TOOLBAR_BUTTON = 32;
+ const HOOK_ENCLOSURE_ENTRY = 33;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;
diff --git a/include/functions2.php b/include/functions2.php
index 96274b6a0..21fe805f7 100644
--- a/include/functions2.php
+++ b/include/functions2.php
@@ -1944,6 +1944,10 @@
foreach ($result as $line) {
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ENCLOSURE_ENTRY) as $plugin) {
+ $line = $plugin->hook_render_enclosure($line);
+ }
+
$url = $line["content_url"];
$ctype = $line["content_type"];
$title = $line["title"];
diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php
index 6d7954c3c..923f81734 100644
--- a/plugins/af_zz_imgproxy/init.php
+++ b/plugins/af_zz_imgproxy/init.php
@@ -18,10 +18,19 @@ class Af_Zz_ImgProxy extends Plugin {
$host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
$host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this);
$host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this);
+ $host->add_hook($host::HOOK_ENCLOSURE_ENTRY, $this);
$host->add_hook($host::HOOK_PREFS_TAB, $this);
}
+ function hook_enclosure_entry($enc) {
+ $proxy_all = $this->host->get($this, "proxy_all");
+
+ $enc["url"] = $this->rewrite_url_if_needed($enc["url"], $proxy_all);
+
+ return $enc;
+ }
+
function hook_render_article($article) {
return $this->hook_render_article_cdm($article);
}