From 891e36f57e2e3955a4f13019e8fdc58fce826434 Mon Sep 17 00:00:00 2001 From: justauser Date: Thu, 27 Jun 2013 11:18:23 -0400 Subject: Changes to add a new hook: HOOK_QUERY_HEADLINES. An example is provided. --- classes/feeds.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 83736925c..fd4c7fe53 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -288,6 +288,9 @@ class Feeds extends Handler_Protected { $expand_cdm = get_pref('CDM_EXPANDED'); while ($line = $this->dbh->fetch_assoc($result)) { + foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { + $line = $p->hook_query_headlines($line, 250); + } $id = $line["id"]; $feed_id = $line["feed_id"]; $label_cache = $line["label_cache"]; @@ -360,9 +363,12 @@ 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); + if (get_pref('SHOW_CONTENT_PREVIEW') ) { + if(isset($line["modified_preview"])) + $content_preview = strip_tags($line["content_preview"]); + else + $content_preview = truncate_string(strip_tags($line["content_preview"]), + 250); } $score = $line["score"]; @@ -502,7 +508,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) { @@ -575,7 +581,7 @@ class Feeds extends Handler_Protected { $excerpt_hidden = "style=\"display : none\""; $reply['content'] .= " - $content_preview"; + id=\"CEXC-$id\" class=\"cdmExcerpt\"> -" . $content_preview . ""; $reply['content'] .= ""; if (!get_pref('VFEED_GROUP_BY_FEED')) { -- cgit v1.2.3 From 0708046b4f0c3f430258f561dbc1a51ed5d92888 Mon Sep 17 00:00:00 2001 From: justauser Date: Thu, 27 Jun 2013 12:01:57 -0400 Subject: change for HOOK_QUERY_HEADLINES. See example for details. --- classes/feeds.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 85276a4b1..409824f96 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -363,15 +363,12 @@ 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') ) { -# if(isset($line["modified_preview"])) -# $content_preview = strip_tags($line["content_preview"]); -# else -# $content_preview = truncate_string(strip_tags($line["content_preview"]), -# 250); - if (get_pref('SHOW_CONTENT_PREVIEW')) { - $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]), - 250); + if (get_pref('SHOW_CONTENT_PREVIEW') ) { + if(isset($line["modified_preview"])) + $content_preview = " — " . strip_tags($line["content_preview"]); + else + $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]), + 250); } $score = $line["score"]; -- cgit v1.2.3 From 2e188438456314d4cffab67c6a0baddb0b364b05 Mon Sep 17 00:00:00 2001 From: justauser Date: Thu, 27 Jun 2013 12:21:14 -0400 Subject: one more change to merge to origin --- classes/feeds.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index 409824f96..b0447fd25 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -580,12 +580,8 @@ class Feeds extends Handler_Protected { else $excerpt_hidden = "style=\"display : none\""; - $reply['content'] .= " -" . $content_preview . ""; -======= - id=\"CEXC-$id\" class=\"cdmExcerpt\">$content_preview"; ->>>>>>> origin + $reply['content'] .= "$content_preview"; + $reply['content'] .= ""; if (!get_pref('VFEED_GROUP_BY_FEED')) { -- cgit v1.2.3 From 67631438353273ea260be518e627bc25500e01f2 Mon Sep 17 00:00:00 2001 From: justauser Date: Fri, 28 Jun 2013 10:46:45 -0400 Subject: Changed the implementation of HOOK_QUERY_HEADLINES to deal with issue Fox raised --- classes/feeds.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index b0447fd25..44af9ae0b 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -286,8 +286,9 @@ class Feeds extends Handler_Protected { if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PS", $timing_info); $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); } @@ -364,11 +365,7 @@ class Feeds extends Handler_Protected { make_local_datetime($line["date_entered"], false)); if (get_pref('SHOW_CONTENT_PREVIEW') ) { - if(isset($line["modified_preview"])) - $content_preview = " — " . strip_tags($line["content_preview"]); - else - $content_preview = " — " . truncate_string(strip_tags($line["content_preview"]), - 250); + $content_preview = $line["content_preview"]; } $score = $line["score"]; @@ -461,9 +458,7 @@ class Feeds extends Handler_Protected { truncate_string($line["title"], 200); if (get_pref('SHOW_CONTENT_PREVIEW')) { - if ($content_preview) { - $reply['content'] .= "$content_preview"; - } + $reply['content'] .= "" . $line["content_preview"] . ""; } $reply['content'] .= ""; @@ -580,7 +575,7 @@ class Feeds extends Handler_Protected { else $excerpt_hidden = "style=\"display : none\""; - $reply['content'] .= "$content_preview"; + $reply['content'] .= "" . $line["content_preview"] . ""; $reply['content'] .= ""; -- cgit v1.2.3 From 425a6edc6b3e84d0cc0ed144ab66421adac33fa5 Mon Sep 17 00:00:00 2001 From: justauser Date: Wed, 10 Jul 2013 04:24:29 -0400 Subject: forgot one file --- classes/feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes/feeds.php') diff --git a/classes/feeds.php b/classes/feeds.php index ccc0548db..c5c120ed7 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -290,7 +290,7 @@ class Feeds extends Handler_Protected { 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); + $line = $p->hook_query_headlines($line, 250, false); } $id = $line["id"]; $feed_id = $line["feed_id"]; -- cgit v1.2.3