* add HOOK_ENCLOSURE_IMPORTED

* pass feed id to HOOK_FEED_PARSED
This commit is contained in:
Andrew Dolgov 2020-04-29 11:33:39 +03:00
parent 84bea5086c
commit 6573541873
2 changed files with 9 additions and 1 deletions

View File

@ -65,6 +65,7 @@ class PluginHost {
const HOOK_ARTICLE_IMAGE = 42; const HOOK_ARTICLE_IMAGE = 42;
const HOOK_FEED_TREE = 43; const HOOK_FEED_TREE = 43;
const HOOK_IFRAME_WHITELISTED = 44; const HOOK_IFRAME_WHITELISTED = 44;
const HOOK_ENCLOSURE_IMPORTED = 45;
const KIND_ALL = 1; const KIND_ALL = 1;
const KIND_SYSTEM = 2; const KIND_SYSTEM = 2;

View File

@ -469,7 +469,7 @@ class RSSUtils {
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) { foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) {
Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE); Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE);
$start = microtime(true); $start = microtime(true);
$plugin->hook_feed_parsed($rss); $plugin->hook_feed_parsed($rss, $feed);
Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE); Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE);
} }
@ -1032,6 +1032,13 @@ class RSSUtils {
if (is_array($encs)) { if (is_array($encs)) {
foreach ($encs as $e) { foreach ($encs as $e) {
foreach ($pluginhost->get_hooks(PluginHost::HOOK_ENCLOSURE_IMPORTED) as $plugin) {
$e = $plugin->hook_enclosure_imported($e, $feed);
}
var_dump($e);
$e_item = array( $e_item = array(
rewrite_relative_url($site_url, $e->link), rewrite_relative_url($site_url, $e->link),
$e->type, $e->length, $e->title, $e->width, $e->height); $e->type, $e->length, $e->title, $e->width, $e->height);