summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/api.php30
-rw-r--r--classes/feeds.php25
-rw-r--r--classes/handler/public.php18
-rw-r--r--classes/pluginhost.php1
-rw-r--r--classes/pref/filters.php10
-rw-r--r--include/functions.php15
-rw-r--r--include/rssfuncs.php2
7 files changed, 54 insertions, 47 deletions
diff --git a/classes/api.php b/classes/api.php
index 334f5fdc9..c1f4aa9fa 100644
--- a/classes/api.php
+++ b/classes/api.php
@@ -309,7 +309,7 @@ class API extends Handler {
if ($article_id) {
- $query = "SELECT id,title,link,content,cached_content,feed_id,comments,int_id,
+ $query = "SELECT id,title,link,content,feed_id,comments,int_id,
marked,unread,published,score,
".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
author,(SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title
@@ -338,7 +338,7 @@ class API extends Handler {
"comments" => $line["comments"],
"author" => $line["author"],
"updated" => (int) strtotime($line["updated"]),
- "content" => $line["cached_content"] != "" ? $line["cached_content"] : $line["content"],
+ "content" => $line["content"],
"feed_id" => $line["feed_id"],
"attachments" => $attachments,
"score" => (int)$line["score"],
@@ -638,6 +638,11 @@ class API extends Handler {
$headlines = array();
while ($line = db_fetch_assoc($result)) {
+ $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100);
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100, true);
+ }
+
$is_updated = ($line["last_read"] == "" &&
($line["unread"] != "t" && $line["unread"] != "1"));
@@ -660,28 +665,22 @@ class API extends Handler {
"tags" => $tags,
);
- if ($include_attachments)
- $headline_row['attachments'] = get_article_enclosures(
- $line['id']);
+ if ($include_attachments)
+ $headline_row['attachments'] = get_article_enclosures(
+ $line['id']);
- if ($show_excerpt) {
- $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
- $headline_row["excerpt"] = $excerpt;
- }
+ if (!$show_excerpt)
+ $headline_row["excerpt"] = $line["content_preview"];
if ($show_content) {
- if ($line["cached_content"] != "") {
- $line["content_preview"] =& $line["cached_content"];
- }
-
if ($sanitize_content) {
$headline_row["content"] = sanitize(
- $line["content_preview"],
+ $line["content"],
sql_bool_to_bool($line['hide_images']),
false, $line["site_url"]);
} else {
- $headline_row["content"] = $line["content_preview"];
+ $headline_row["content"] = $line["content"];
}
}
@@ -699,6 +698,7 @@ class API extends Handler {
$headline_row["always_display_attachments"] = sql_bool_to_bool($line["always_display_enclosures"]);
$headline_row["author"] = $line["author"];
+
$headline_row["score"] = (int)$line["score"];
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_API) as $p) {
diff --git a/classes/feeds.php b/classes/feeds.php
index d79380074..c57328fe7 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -288,6 +288,16 @@ class Feeds extends Handler_Protected {
$expand_cdm = get_pref('CDM_EXPANDED');
while ($line = $this->dbh->fetch_assoc($result)) {
+ $line["content_preview"] = "— " . truncate_string(strip_tags($line["content_preview"]), 250);
+
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 250, false);
+ }
+
+ if (get_pref('SHOW_CONTENT_PREVIEW')) {
+ $content_preview = $line["content_preview"];
+ }
+
$id = $line["id"];
$feed_id = $line["feed_id"];
$label_cache = $line["label_cache"];
@@ -360,11 +370,6 @@ class Feeds extends Handler_Protected {
$date_entered_fmt = T_sprintf("Imported at %s",
make_local_datetime($line["date_entered"], false));
- if (get_pref('SHOW_CONTENT_PREVIEW')) {
- $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]),
- 250);
- }
-
$score = $line["score"];
$score_pic = "images/" . get_score_pic($score);
@@ -455,9 +460,7 @@ class Feeds extends Handler_Protected {
truncate_string($line["title"], 200);
if (get_pref('SHOW_CONTENT_PREVIEW')) {
- if ($content_preview) {
- $reply['content'] .= "<span class=\"contentPreview\">$content_preview</span>";
- }
+ $reply['content'] .= "<span class=\"contentPreview\">" . $line["content_preview"] . "</span>";
}
$reply['content'] .= "</a></span>";
@@ -502,7 +505,7 @@ class Feeds extends Handler_Protected {
else
$tags = false;
- $line["content"] = sanitize($line["content_preview"],
+ $line["content"] = sanitize($line["content"],
sql_bool_to_bool($line['hide_images']), false, $entry_site_url);
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_RENDER_ARTICLE_CDM) as $p) {
@@ -574,8 +577,8 @@ class Feeds extends Handler_Protected {
else
$excerpt_hidden = "style=\"display : none\"";
- $reply['content'] .= "<span $excerpt_hidden
- id=\"CEXC-$id\" class=\"cdmExcerpt\">$content_preview</span>";
+ $reply['content'] .= "<span $excerpt_hidden id=\"CEXC-$id\" class=\"cdmExcerpt\">" . $line["content_preview"] . "</span>";
+
$reply['content'] .= "</span>";
if (!get_pref('VFEED_GROUP_BY_FEED')) {
diff --git a/classes/handler/public.php b/classes/handler/public.php
index b15463564..60a961bfa 100644
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -85,8 +85,11 @@ class Handler_Public extends Handler {
}
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
-
+ $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
while ($line = $this->dbh->fetch_assoc($result)) {
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line);
+ }
$tpl->setVariable('ARTICLE_ID',
htmlspecialchars($orig_guid ? $line['link'] :
@@ -94,10 +97,9 @@ class Handler_Public extends Handler {
"/public.php?url=" . urlencode($line['link'])), true);
$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
- $tpl->setVariable('ARTICLE_EXCERPT',
- truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
+ $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true);
- $content = sanitize($line["content_preview"], false, $owner_uid);
+ $content = sanitize($line["content"], false, $owner_uid);
if ($line['note']) {
$content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" .
@@ -170,13 +172,17 @@ class Handler_Public extends Handler {
$feed['articles'] = array();
while ($line = $this->dbh->fetch_assoc($result)) {
+ $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100);
+ }
$article = array();
$article['id'] = $line['link'];
$article['link'] = $line['link'];
$article['title'] = $line['title'];
- $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
- $article['content'] = sanitize($line["content_preview"], false, $owner_uid);
+ $article['excerpt'] = $line["content_preview"];
+ $article['content'] = sanitize($line["content"], false, $owner_uid);
$article['updated'] = date('c', strtotime($line["updated"]));
if ($line['note']) $article['note'] = $line['note'];
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 53adf01f9..a1bd1b364 100644
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -37,6 +37,7 @@ class PluginHost {
const HOOK_PREFS_EDIT_FEED = 20;
const HOOK_PREFS_SAVE_FEED = 21;
const HOOK_FETCH_FEED = 22;
+ const HOOK_QUERY_HEADLINES = 23;
const KIND_ALL = 1;
const KIND_SYSTEM = 2;
diff --git a/classes/pref/filters.php b/classes/pref/filters.php
index 6a70e622c..5d19a5556 100644
--- a/classes/pref/filters.php
+++ b/classes/pref/filters.php
@@ -95,14 +95,16 @@ class Pref_Filters extends Handler_Protected {
print "<div class=\"filterTestHolder\">";
print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
-
+ $line["content_preview"] = strip_tags($line["content_preview"]), 100, '...');
while ($line = $this->dbh->fetch_assoc($result)) {
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100);
+ }
$entry_timestamp = strtotime($line["updated"]);
$entry_tags = get_article_tags($line["id"], $_SESSION["uid"]);
- $content_preview = truncate_string(
- strip_tags($line["content_preview"]), 100, '...');
+ $content_preview = $line["content_preview"];
if ($line["feed_title"])
$feed_title = $line["feed_title"];
@@ -118,7 +120,7 @@ class Pref_Filters extends Handler_Protected {
print "&nbsp;(";
print "<b>" . $feed_title . "</b>";
print "):&nbsp;";
- print "<span class=\"insensitive\">" . $content_preview . "</span>";
+ print "<span class=\"insensitive\">" . $line["content_preview"] . "</span>";
print " " . mb_substr($line["date_entered"], 0, 16);
print "</td></tr>";
diff --git a/include/functions.php b/include/functions.php
index 603a865a1..d71f81ac4 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -71,7 +71,6 @@
"hu_HU" => "Magyar (Hungarian)",
"it_IT" => "Italiano",
"ja_JP" => "日本語 (Japanese)",
- "ko_KR" => "한국어 (Korean)",
"lv_LV" => "Latviešu",
"nb_NO" => "Norwegian bokmål",
"nl_NL" => "Dutch",
@@ -1059,7 +1058,7 @@
$date_qpart = "date_entered < DATE_SUB(NOW(), INTERVAL 1 WEEK) ";
}
break;
- case "2week":
+ case "2weeks":
if (DB_TYPE == "pgsql") {
$date_qpart = "date_entered < NOW() - INTERVAL '2 week' ";
} else {
@@ -2579,7 +2578,9 @@
}
}
- $content_query_part = "content as content_preview, cached_content, ";
+
+ $content_query_part = "content, content AS content_preview, ";
+
if (is_numeric($feed)) {
@@ -2750,13 +2751,10 @@
if ($site_url) {
- if ($entry->hasAttribute('href')) {
+ if ($entry->hasAttribute('href'))
$entry->setAttribute('href',
rewrite_relative_url($site_url, $entry->getAttribute('href')));
- $entry->setAttribute('rel', 'noreferrer');
- }
-
if ($entry->hasAttribute('src')) {
$src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
@@ -3106,8 +3104,7 @@
tag_cache,
author,
orig_feed_id,
- note,
- cached_content
+ note
FROM ttrss_entries,ttrss_user_entries
WHERE id = '$id' AND ref_id = id AND owner_uid = $owner_uid");
diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index e2837a3b5..cfb0e7a46 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -671,7 +671,6 @@
updated,
content,
content_hash,
- cached_content,
no_orig_date,
date_updated,
date_entered,
@@ -686,7 +685,6 @@
'$entry_timestamp_fmt',
'$entry_content',
'$content_hash',
- '',
$no_orig_date,
NOW(),
'$date_feed_processed',