summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-15 20:01:07 +0300
committerAndrew Dolgov <[email protected]>2015-06-15 20:01:07 +0300
commit6de3a1be7b7bfb82f5e3a4ce3161abb764e49582 (patch)
tree5b409341114263f1b712f2bc3f65fc9526c0b847 /include
parent86b05f8661274e4bcf4a30caed2f8a105a392352 (diff)
allow plugins modify article score
Diffstat (limited to 'include')
-rw-r--r--include/rssfuncs.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index a27a91747..cc8a8e3f0 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -687,6 +687,7 @@
"tags" => $entry_tags,
"author" => $entry_author,
"force_catchup" => false, // ugly hack for the time being
+ "score_modifier" => 0, // no previous value, plugin should recalculate score modifier based on content if needed
"language" => $entry_language, // read only
"feed" => array("id" => $feed,
"fetch_url" => $fetch_url,
@@ -743,6 +744,7 @@
$entry_content = $article["content"]; // escaped below
$entry_force_catchup = $article["force_catchup"];
$article_labels = $article["labels"];
+ $entry_score_modifier = (int) $article["score_modifier"];
if ($debug_enabled) {
_debug("article labels:", $debug_enabled);
@@ -853,9 +855,9 @@
continue;
}
- $score = calculate_article_score($article_filters);
+ $score = calculate_article_score($article_filters) + $entry_score_modifier;
- _debug("initial score: $score", $debug_enabled);
+ _debug("initial score: $score [including plugin modifier: $entry_score_modifier]", $debug_enabled);
$query = "SELECT ref_id, int_id FROM ttrss_user_entries WHERE
ref_id = '$ref_id' AND owner_uid = '$owner_uid'