diff options
author | Andrew Dolgov <[email protected]> | 2015-08-12 08:29:23 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-08-12 08:29:23 +0300 |
commit | be2cfc1fff8792715e059249939a1a798779d777 (patch) | |
tree | e92b56f38f30af15c6dff677ca22fb8fe0190920 /include | |
parent | 90da4ada664443704dca6119c12bb7ecccb48aa9 (diff) | |
parent | b87744534a5250e9f839997f8eceb5b86b8c0e5c (diff) |
Merge branch 'master' of git.fakecake.org:tt-rss
Diffstat (limited to 'include')
-rw-r--r-- | include/functions.php | 14 | ||||
-rw-r--r-- | include/rssfuncs.php | 54 |
2 files changed, 50 insertions, 18 deletions
diff --git a/include/functions.php b/include/functions.php index d90855ea6..6d183abaa 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,6 +1,6 @@ <?php define('EXPECTED_CONFIG_VERSION', 26); - define('SCHEMA_VERSION', 128); + define('SCHEMA_VERSION', 129); define('LABEL_BASE_INDEX', -1024); define('PLUGIN_FEED_BASE_INDEX', -128); @@ -580,8 +580,10 @@ } } - function print_select($id, $default, $values, $attributes = "") { - print "<select name=\"$id\" id=\"$id\" $attributes>"; + function print_select($id, $default, $values, $attributes = "", $name = "") { + if (!$name) $name = $id; + + print "<select name=\"$name\" id=\"$id\" $attributes>"; foreach ($values as $v) { if ($v == $default) $sel = "selected=\"1\""; @@ -595,8 +597,10 @@ print "</select>"; } - function print_select_hash($id, $default, $values, $attributes = "") { - print "<select name=\"$id\" id='$id' $attributes>"; + function print_select_hash($id, $default, $values, $attributes = "", $name = "") { + if (!$name) $name = $id; + + print "<select name=\"$name\" id='$id' $attributes>"; foreach (array_keys($values) as $v) { if ($v == $default) $sel = 'selected="selected"'; diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 6532fb270..a922516cd 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -773,6 +773,47 @@ } } + /* Collect article tags here so we could filter by them: */ + + $article_filters = get_article_filters($filters, $article["title"], + $article["content"], $article["link"], 0, $article["author"], + $article["tags"]); + + if ($debug_enabled) { + _debug("article filters: ", $debug_enabled); + if (count($article_filters) != 0) { + print_r($article_filters); + } + } + + $plugin_filter_names = find_article_filters($article_filters, "plugin"); + $plugin_filter_actions = $pluginhost->get_filter_actions(); + + if (count($plugin_filter_names) > 0) { + _debug("applying plugin filter actions...", $debug_enabled); + + foreach ($plugin_filter_names as $pfn) { + list($pfclass,$pfaction) = explode(":", $pfn["param"]); + + if (isset($plugin_filter_actions[$pfclass])) { + $plugin = $pluginhost->get_plugin($pfclass); + + _debug("... $pfclass: $pfaction", $debug_enabled); + + if ($plugin) { + $start = microtime(true); + $article = $plugin->hook_article_filter_action($article, $pfaction); + + _debug("=== " . sprintf("%.4f (sec)", microtime(true) - $start), $debug_enabled); + } else { + _debug("??? $pfclass: plugin object not found."); + } + } else { + _debug("??? $pfclass: filter plugin not registered."); + } + } + } + $entry_tags = $article["tags"]; $entry_guid = db_escape_string($entry_guid); $entry_title = db_escape_string($article["title"]); @@ -875,19 +916,6 @@ $dupcheck_qpart = ""; } - /* Collect article tags here so we could filter by them: */ - - $article_filters = get_article_filters($filters, $entry_title, - $entry_content, $entry_link, $entry_timestamp, $entry_author, - $entry_tags); - - if ($debug_enabled) { - _debug("article filters: ", $debug_enabled); - if (count($article_filters) != 0) { - print_r($article_filters); - } - } - if (find_article_filter($article_filters, "filter")) { //db_query("COMMIT"); // close transaction in progress continue; |