|
|
@ -414,12 +414,14 @@ class RSSUtils {
|
|
|
|
|
|
|
|
|
|
|
|
Debug::log("running HOOK_FETCH_FEED handlers...", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("running HOOK_FETCH_FEED handlers...", Debug::$LOG_VERBOSE);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FETCH_FEED) as $plugin) {
|
|
|
|
$start_ts = microtime(true);
|
|
|
|
Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE);
|
|
|
|
$last_article_timestamp = 0;
|
|
|
|
$start = microtime(true);
|
|
|
|
$pluginhost->chain_hooks_callback(PluginHost::HOOK_FETCH_FEED,
|
|
|
|
$feed_data = $plugin->hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, 0, $auth_login, $auth_pass);
|
|
|
|
function ($result, $plugin) use (&$feed_data, $start_ts) {
|
|
|
|
Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE);
|
|
|
|
$feed_data = $result;
|
|
|
|
}
|
|
|
|
Debug::log(sprintf("=== %.4f (sec) %s", microtime(true) - $start_ts, get_class($plugin)), Debug::$LOG_VERBOSE);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
$feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass);
|
|
|
|
|
|
|
|
|
|
|
|
if ($feed_data) {
|
|
|
|
if ($feed_data) {
|
|
|
|
Debug::log("feed data has been modified by a plugin.", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("feed data has been modified by a plugin.", Debug::$LOG_VERBOSE);
|
|
|
@ -529,12 +531,13 @@ class RSSUtils {
|
|
|
|
Debug::log("running HOOK_FEED_FETCHED handlers...", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("running HOOK_FEED_FETCHED handlers...", Debug::$LOG_VERBOSE);
|
|
|
|
$feed_data_checksum = md5($feed_data);
|
|
|
|
$feed_data_checksum = md5($feed_data);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
|
|
|
|
$start_ts = microtime(true);
|
|
|
|
Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE);
|
|
|
|
$pluginhost->chain_hooks_callback(PluginHost::HOOK_FEED_FETCHED,
|
|
|
|
$start = microtime(true);
|
|
|
|
function ($result, $plugin) use (&$feed_data, $start_ts) {
|
|
|
|
$feed_data = $plugin->hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed);
|
|
|
|
$feed_data = $result;
|
|
|
|
Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log(sprintf("=== %.4f (sec) %s", microtime(true) - $start_ts, get_class($plugin)), Debug::$LOG_VERBOSE);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
$feed_data, $fetch_url, $owner_uid, $feed);
|
|
|
|
|
|
|
|
|
|
|
|
if (md5($feed_data) != $feed_data_checksum) {
|
|
|
|
if (md5($feed_data) != $feed_data_checksum) {
|
|
|
|
Debug::log("feed data has been modified by a plugin.", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("feed data has been modified by a plugin.", Debug::$LOG_VERBOSE);
|
|
|
@ -551,12 +554,12 @@ class RSSUtils {
|
|
|
|
|
|
|
|
|
|
|
|
// We use local pluginhost here because we need to load different per-user feed plugins
|
|
|
|
// We use local pluginhost here because we need to load different per-user feed plugins
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_PARSED) as $plugin) {
|
|
|
|
$start_ts = microtime(true);
|
|
|
|
Debug::log("... " . get_class($plugin), Debug::$LOG_VERBOSE);
|
|
|
|
$pluginhost->chain_hooks_callback(PluginHost::HOOK_FEED_PARSED,
|
|
|
|
$start = microtime(true);
|
|
|
|
function($result, $plugin) use ($start_ts) {
|
|
|
|
$plugin->hook_feed_parsed($rss, $feed);
|
|
|
|
Debug::log(sprintf("=== %.4f (sec) %s", microtime(true) - $start_ts, get_class($plugin)), Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log(sprintf("=== %.4f (sec)", microtime(true) - $start), Debug::$LOG_VERBOSE);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
$rss, $feed);
|
|
|
|
|
|
|
|
|
|
|
|
Debug::log("language: $feed_language", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("language: $feed_language", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("processing feed data...", Debug::$LOG_VERBOSE);
|
|
|
|
Debug::log("processing feed data...", Debug::$LOG_VERBOSE);
|
|
|
@ -744,9 +747,11 @@ 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) {
|
|
|
|
$pluginhost->chain_hooks_callback(PluginHost::HOOK_ENCLOSURE_IMPORTED,
|
|
|
|
$e = $plugin->hook_enclosure_imported($e, $feed);
|
|
|
|
function ($result) use (&$e) {
|
|
|
|
}
|
|
|
|
$e = $result;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
$e, $feed);
|
|
|
|
|
|
|
|
|
|
|
|
$e_item = array(
|
|
|
|
$e_item = array(
|
|
|
|
rewrite_relative_url($site_url, $e->link),
|
|
|
|
rewrite_relative_url($site_url, $e->link),
|
|
|
@ -850,9 +855,8 @@ class RSSUtils {
|
|
|
|
$article["tags"], $matched_rules, $matched_filters);
|
|
|
|
$article["tags"], $matched_rules, $matched_filters);
|
|
|
|
|
|
|
|
|
|
|
|
// $article_filters should be renamed to something like $filter_actions; actual filter objects are in $matched_filters
|
|
|
|
// $article_filters should be renamed to something like $filter_actions; actual filter objects are in $matched_filters
|
|
|
|
foreach ($pluginhost->get_hooks(PluginHost::HOOK_FILTER_TRIGGERED) as $plugin) {
|
|
|
|
$pluginhost->run_hooks(PluginHost::HOOK_FILTER_TRIGGERED,
|
|
|
|
$plugin->hook_filter_triggered($feed, $owner_uid, $article, $matched_filters, $matched_rules, $article_filters);
|
|
|
|
$feed, $owner_uid, $article, $matched_filters, $matched_rules, $article_filters);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$matched_filter_ids = array_map(function($f) { return $f['id']; }, $matched_filters);
|
|
|
|
$matched_filter_ids = array_map(function($f) { return $f['id']; }, $matched_filters);
|
|
|
|
|
|
|
|
|
|
|
|