]> git.wh0rd.org Git - tt-rss.git/commitdiff
Changed the implementation of HOOK_QUERY_HEADLINES to deal with issue Fox raised
authorjustauser <justausr@hotmail.com>
Fri, 28 Jun 2013 14:46:45 +0000 (10:46 -0400)
committerjustauser <justausr@hotmail.com>
Fri, 28 Jun 2013 14:46:45 +0000 (10:46 -0400)
classes/api.php
classes/feeds.php
classes/handler/public.php
classes/pref/filters.php

index 139a486ee6eccfca2d9c5d966352c68a69577b1d..aa092df781356ad373d790a44a9212dd3adc7d21 100644 (file)
@@ -638,7 +638,7 @@ 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);
                                }
@@ -669,13 +669,8 @@ class API extends Handler {
                                                $headline_row['attachments'] = get_article_enclosures(
                                                        $line['id']);
 
-                               if ($show_excerpt ){
-                                       if(isset($line["modified_preview"])) 
-                                               $excerpt = strip_tags($line["content_preview"]);
-                                       else
-                                               $excerpt = truncate_string(strip_tags($line["content_preview"]), 100);
-                                       $headline_row["excerpt"] = $excerpt;
-                               }
+                               if (!$show_excerpt )
+                                       $headline_row["excerpt"] = $ine["content_preview"];
 
                                if ($show_content) {
 
index b0447fd25fe9ff41dc606641e019b40cd68479c4..44af9ae0bfe4c9e3bc5065293c8441c8966b7950 100644 (file)
@@ -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"] =  "&mdash; " . 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 =  " &mdash; " .  strip_tags($line["content_preview"]);
-                                       else
-                                               $content_preview =  " &mdash; " . 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'] .= "<span class=\"contentPreview\">$content_preview</span>";
-                                               }
+                                                       $reply['content'] .= "<span class=\"contentPreview\">" . $line["content_preview"] . "</span>";
                                        }
 
                                        $reply['content'] .= "</a></span>";
@@ -580,7 +575,7 @@ 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>";
 
index 825ea5e2e6a9ea705fb9a139ba3ef0ab7086d362..08f35e21264d966567e6b0f9f6293d95552485db 100644 (file)
@@ -85,7 +85,7 @@ 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);
@@ -94,11 +94,7 @@ class Handler_Public extends Handler {
                                $tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
                                $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
                                $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
-                               if(isset($line["modified_preview"]))
-                                       $tpl->setVariable('ARTICLE_EXCERPT', strip_tags($line["content_preview"]), true);
-                               else
-                                       $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"], false, $owner_uid);
 
@@ -170,6 +166,7 @@ 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);
                                }
@@ -178,10 +175,7 @@ class Handler_Public extends Handler {
                                $article['id'] = $line['link'];
                                $article['link']        = $line['link'];
                                $article['title'] = $line['title'];
-                               if(isset($line["modified_preview"]))
-                                       $article['excerpt'] = strip_tags($line["content_preview"]);
-                               else
-                                       $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
+                               $article['excerpt'] = $line["content_preview"];
                                $article['content'] = sanitize($line["content"], false, $owner_uid);
                                $article['updated'] = date('c', strtotime($line["updated"]));
 
index 63318033ea11ee7d6ae3e352455099c33ce8f021..5d19a5556572bc05cf13c7cf02dce0c43c39c168 100644 (file)
@@ -95,7 +95,7 @@ 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);
@@ -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 "&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>";