]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeds.php
Merge branch 'master' into hookhead
[tt-rss.git] / classes / feeds.php
index 1a17981515789667db241b4daafc8c7117bbac39..ccc0548db07d12dc81fa159a7bdb422814cd15cd 100644 (file)
@@ -286,10 +286,12 @@ 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)) {
-                               $class = ($lnum % 2) ? "even" : "odd";
-
+                               $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);
+                               }
                                $id = $line["id"];
                                $feed_id = $line["feed_id"];
                                $label_cache = $line["label_cache"];
@@ -316,6 +318,8 @@ class Feeds extends Handler_Protected {
                                        array_push($topmost_article_ids, $id);
                                }
 
+                               $class = "";
+
                                if (sql_bool_to_bool($line["unread"])) {
                                        $class .= " Unread";
                                        ++$num_unread;
@@ -360,9 +364,8 @@ 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') ) {
+                                               $content_preview =  $line["content_preview"];   
                                }
 
                                $score = $line["score"];
@@ -377,9 +380,9 @@ class Feeds extends Handler_Protected {
                                        title=\"$score\">";
 
                                if ($score > 500) {
-                                       $hlc_suffix = "H";
+                                       $hlc_suffix = "high";
                                } else if ($score < -100) {
-                                       $hlc_suffix = "L";
+                                       $hlc_suffix = "low";
                                } else {
                                        $hlc_suffix = "";
                                }
@@ -409,23 +412,6 @@ class Feeds extends Handler_Protected {
                                        if (!isset($rgba_cache[$feed_id])) {
                                                $rgba_cache[$feed_id] = join(",", _color_unpack($fav_color));
                                        }
-
-                                       $rgba = $rgba_cache[$feed_id];
-
-                                       if (sql_bool_to_bool($line["unread"]))
-                                               $endalpha = '0.3';
-                                       else
-                                               $endalpha = '0.1';
-
-                                       // W3C definition seems to work in FF and Chrome
-                                       $row_background = "background-image : linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba($rgba, $endalpha) 100%);";
-
-                                       /* $row_background = "background-image : -moz-linear-gradient(left, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 100%);".
-                                               "background-image : linear-gradient(to right, rgba(255, 255, 255, 0) 50%, rgba($rgba, 0.2) 100%);";
-                                               "background-image : -webkit-gradient(linear, left top, right top, color-stop(50%, rgba(255,255,255,0)),
-                                                       color-stop(100%, rgba($rgba, 0.2)));"; */
-                               } else {
-                                       $row_background = "";
                                }
 
                                if (!get_pref('COMBINED_DISPLAY_MODE')) {
@@ -451,7 +437,7 @@ class Feeds extends Handler_Protected {
                                        $mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
                                                onmouseout='postMouseOut($id)'";
 
-                                       $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs style='$row_background'>";
+                                       $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs>";
 
                                        $reply['content'] .= "<div class='hlLeft'>";
 
@@ -465,16 +451,14 @@ class Feeds extends Handler_Protected {
                                        $reply['content'] .= "</div>";
 
                                        $reply['content'] .= "<div onclick='return hlClicked(event, $id)'
-                                               class=\"hlTitle\"><span class='hlContent$hlc_suffix'>";
-                                       $reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title\"
+                                               class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
+                                       $reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title $hlc_suffix\"
                                                href=\"" . htmlspecialchars($line["link"]) . "\"
                                                onclick=\"\">" .
                                                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>";
@@ -487,14 +471,14 @@ class Feeds extends Handler_Protected {
 
                                        if (!get_pref('VFEED_GROUP_BY_FEED')) {
                                                if (@$line["feed_title"]) {
-                                                       $reply['content'] .= "<div class=\"hlFeed\">
-                                                               <a href=\"#\" onclick=\"viewfeed($feed_id)\">".
-                                                               truncate_string($line["feed_title"],30)."</a>
-                                                       </div>";
+                                                       $rgba = @$rgba_cache[$feed_id];
+
+                                                       $reply['content'] .= "<a class=\"hlFeed\" style=\"background : rgba($rgba, 0.3)\" href=\"#\" onclick=\"viewfeed($feed_id)\">".
+                                                               truncate_string($line["feed_title"],30)."</a>";
                                                }
                                        }
 
-                                       $reply['content'] .= "<span title='$date_entered_fmt'>$updated_fmt</span>
+                                       $reply['content'] .= "<div title='$date_entered_fmt'>$updated_fmt</div>
                                                </span>";
 
                                        $reply['content'] .= "<div class=\"hlRight\">";
@@ -519,7 +503,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) {
@@ -556,7 +540,7 @@ class Feeds extends Handler_Protected {
 
                                        $expanded_class = $expand_cdm ? "expanded" : "expandable";
 
-                                       $reply['content'] .= "<div class=\"cdm $expanded_class $class\"
+                                       $reply['content'] .= "<div class=\"cdm $hlc_suffix $expanded_class $class\"
                                                id=\"RROW-$id\" $mouseover_attrs>";
 
                                        $reply['content'] .= "<div class=\"cdmHeader\" style=\"$row_background\">";
@@ -573,12 +557,12 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<span id=\"RTITLE-$id\"
                                                onclick=\"return cdmClicked(event, $id);\"
-                                               class=\"titleWrap$hlc_suffix\">
-                                               <a class=\"title\"
+                                               class=\"titleWrap $hlc_suffix\">
+                                               <a class=\"title $hlc_suffix\"
                                                target=\"_blank\" href=\"".
                                                htmlspecialchars($line["link"])."\">".
                                                $line["title"] .
-                                               " <span class=\"author\">$entry_author</span></a>";
+                                               "</a> <span class=\"author\">$entry_author</span>";
 
                                        $reply['content'] .= $labels_str;
 
@@ -591,14 +575,17 @@ 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')) {
                                                if (@$line["feed_title"]) {
+                                                       $rgba = @$rgba_cache[$feed_id];
+
                                                        $reply['content'] .= "<div class=\"hlFeed\">
-                                                               <a href=\"#\" onclick=\"viewfeed($feed_id)\">".
+                                                               <a href=\"#\" style=\"background-color: rgba($rgba,0.3)\"
+                                                               onclick=\"viewfeed($feed_id)\">".
                                                                truncate_string($line["feed_title"],30)."</a>
                                                        </div>";
                                                }
@@ -607,7 +594,7 @@ class Feeds extends Handler_Protected {
                                        $reply['content'] .= "<span class='updated' title='$date_entered_fmt'>
                                                $updated_fmt</span>";
 
-                                       $reply['content'] .= "<div style=\"vertical-align : middle\">";
+                                       $reply['content'] .= "<div class='scoreWrap' style=\"vertical-align : middle\">";
                                        $reply['content'] .= "$score_pic";
 
                                        if (!get_pref("VFEED_GROUP_BY_FEED") && $line["feed_title"]) {
@@ -720,7 +707,7 @@ class Feeds extends Handler_Protected {
                                        $reply['content'] .= "</div>";
                                        $reply['content'] .= "</div>";
 
-                                       $reply['content'] .= "</div>";
+                                       $reply['content'] .= "</div><hr/>";
 
                                        $reply['content'] .= "</div>";
 
@@ -877,7 +864,7 @@ class Feeds extends Handler_Protected {
                        $override_order = "ttrss_entries.title";
                        break;
                case "date_reverse":
-                       $override_order = "date_entered, updated";
+                       $override_order = "score DESC, date_entered, updated";
                        break;
                case "feed_dates":
                        $override_order = "updated DESC";