diff options
author | Andrew Dolgov <[email protected]> | 2019-05-07 06:57:28 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-05-07 06:57:28 +0300 |
commit | 84d43a1b445f0e79a71e7466cdf746181865f492 (patch) | |
tree | 583a3db3731409bcc725074c555c53f9581e890c | |
parent | 2ce31fd0bf3e337ba8a76b45ff9d2a80d94ef2c3 (diff) |
catchup_feed: invoke HOOK_SEARCH if necessary
-rwxr-xr-x | classes/feeds.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/classes/feeds.php b/classes/feeds.php index 98bfa0923..03f13539f 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -850,9 +850,23 @@ class Feeds extends Handler_Protected { $pdo = Db::pdo(); - // Todo: all this interval stuff needs some generic generator function + if (is_array($search) && $search[0]) { + $search_qpart = ""; - $search_qpart = is_array($search) && $search[0] ? search_to_sql($search[0], $search[1])[0] : 'true'; + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SEARCH) as $plugin) { + list($search_qpart, $search_words) = $plugin->hook_search($search[0]); + break; + } + + // fall back in case of no plugins + if (!$search_qpart) { + list($search_qpart, $search_words) = search_to_sql($search[0], $search[1]); + } + } else { + $search_qpart = "true"; + } + + // TODO: all this interval stuff needs some generic generator function switch ($mode) { case "1day": |