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/pref/filters.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'classes/pref/filters.php') diff --git a/classes/pref/filters.php b/classes/pref/filters.php index bcc7b5aec..099c88252 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -97,12 +97,17 @@ class Pref_Filters extends Handler_Protected { print ""; 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, '...'); + if(isset($line["modified_preview"])) + $content_preview = strip_tags($line["content_preview"]); + else + $content_preview = truncate_string(strip_tags($line["content_preview"]), 100, '...'); if ($line["feed_title"]) $feed_title = $line["feed_title"]; -- 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/pref/filters.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'classes/pref/filters.php') diff --git a/classes/pref/filters.php b/classes/pref/filters.php index 63318033e..5d19a5556 100644 --- a/classes/pref/filters.php +++ b/classes/pref/filters.php @@ -95,7 +95,7 @@ class Pref_Filters extends Handler_Protected { print "
"; print "
"; - + $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); @@ -104,10 +104,7 @@ class Pref_Filters extends Handler_Protected { $entry_timestamp = strtotime($line["updated"]); $entry_tags = get_article_tags($line["id"], $_SESSION["uid"]); - if(isset($line["modified_preview"])) - $content_preview = strip_tags($line["content_preview"]); - else - $content_preview = truncate_string(strip_tags($line["content_preview"]), 100, '...'); + $content_preview = $line["content_preview"]; if ($line["feed_title"]) $feed_title = $line["feed_title"]; @@ -123,7 +120,7 @@ class Pref_Filters extends Handler_Protected { print " ("; print "" . $feed_title . ""; print "): "; - print "" . $content_preview . ""; + print "" . $line["content_preview"] . ""; print " " . mb_substr($line["date_entered"], 0, 16); print ""; -- cgit v1.2.3