summaryrefslogtreecommitdiff
path: root/classes/feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-10-27 11:25:26 +0400
committerAndrew Dolgov <[email protected]>2012-10-27 11:25:26 +0400
commit02195b9d48c4267a8bc450759c56258a26cd9b71 (patch)
tree3bf3f82bc2c800231732cf613546ac0c9f0c77ac /classes/feeds.php
parent8a06b1dbc2fcf61f7dddecd3de16f0ea433d91af (diff)
fix label row backgrounds only used when cached data is available
Diffstat (limited to 'classes/feeds.php')
-rw-r--r--classes/feeds.php28
1 files changed, 16 insertions, 12 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index 113e2768e..72abc41e2 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -283,25 +283,29 @@ class Feeds extends Handler_Protected {
if ($label_cache) {
if ($label_cache["no-labels"] == 1)
$labels = array();
- else {
+ else
$labels = $label_cache;
- if (count($labels) > 0) {
- $bg = rgb2hsl(_color_unpack($labels[0][3]));
- if ($bg && $bg[1] > 0) {
+ }
+ }
- $bg[1] = 0.1;
- $bg[2] = 1;
+ if (!is_array($labels)) $labels = get_article_labels($this->link, $id);
- $bg = _color_pack(hsl2rgb($bg));
- $label_row_style = $this->make_gradient($bg, $class);;
- }
- }
+ if (count($labels) > 0) {
+ for ($i = 0; $i < min(4, count($labels)); $i++) {
+ $bg = rgb2hsl(_color_unpack($labels[$i][3]));
+
+ if ($bg && $bg[1] > 0) {
+ $bg[1] = 0.1;
+ $bg[2] = 1;
+
+ $bg = _color_pack(hsl2rgb($bg));
+ $label_row_style = $this->make_gradient($bg, $class);;
+
+ break;
}
}
}
- if (!is_array($labels)) $labels = get_article_labels($this->link, $id);
-
$labels_str = "<span id=\"HLLCTR-$id\">";
$labels_str .= format_article_labels($labels, $id);
$labels_str .= "</span>";