diff options
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/include/functions.php b/include/functions.php index c39b4938c..48bb39d28 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1162,7 +1162,7 @@ $data = array_merge($data, getVirtCounters()); $data = array_merge($data, getLabelCounters()); - $data = array_merge($data, getFeedCounters($active_feed)); + $data = array_merge($data, getFeedCounters()); $data = array_merge($data, getCategoryCounters()); return $data; @@ -1286,7 +1286,7 @@ return $unread; } else if ($cat == -1) { - return getFeedUnread(-1) + getFeedUnread($link, -2) + getFeedUnread($link, -3) + getFeedUnread($link, 0); + return getFeedUnread(-1) + getFeedUnread(-2) + getFeedUnread(-3) + getFeedUnread(0); } else if ($cat == -2) { $result = db_query(" @@ -1726,7 +1726,8 @@ } if (!$root_id) { - $is_selected = ($default_id == "CAT:0") ? "selected=\"1\"" : ""; + $default_is_cat = ($default_id == "CAT:0"); + $is_selected = $default_is_cat ? "selected=\"1\"" : ""; printf("<option $is_selected value='CAT:0'>%s</option>", __("Uncategorized")); @@ -2844,8 +2845,7 @@ if ($version_data) { $version_data = json_decode($version_data, true); if ($version_data && $version_data['version']) { - - if (version_compare(VERSION, $version_data['version']) == -1) { + if (version_compare(VERSION_STATIC, $version_data['version']) == -1) { return $version_data; } } @@ -2902,7 +2902,6 @@ ttrss_tags WHERE post_int_id = (SELECT int_id FROM ttrss_user_entries WHERE ref_id = '$a_id' AND owner_uid = '$owner_uid' LIMIT 1) ORDER BY tag_name"; - $obj_id = md5("TAGS:$owner_uid:$id"); $tags = array(); /* check cache first */ @@ -3249,7 +3248,7 @@ function print_checkpoint($n, $s) { $ts = microtime(true); - echo sprintf("<!-- CP[$n] %.4f seconds -->", $ts - $s); + echo sprintf("<!-- CP[$n] %.4f seconds -->\n", $ts - $s); return $ts; } @@ -3392,47 +3391,22 @@ } function format_tags_string($tags, $id) { + if (!is_array($tags) || count($tags) == 0) { + return __("no tags"); + } else { + $maxtags = min(5, count($tags)); - $tags_str = ""; - $tags_nolinks_str = ""; - - $num_tags = 0; - - $tag_limit = 6; - - $formatted_tags = array(); - - foreach ($tags as $tag) { - $num_tags++; - $tag_escaped = str_replace("'", "\\'", $tag); - - if (mb_strlen($tag) > 30) { - $tag = truncate_string($tag, 30); - } - - $tag_str = "<a href=\"javascript:viewfeed('$tag_escaped')\">$tag</a>"; - - array_push($formatted_tags, $tag_str); - - $tmp_tags_str = implode(", ", $formatted_tags); - - if ($num_tags == $tag_limit || mb_strlen($tmp_tags_str) > 150) { - break; + for ($i = 0; $i < $maxtags; $i++) { + $tags_str .= "<a class=\"tag\" href=\"#\" onclick=\"viewfeed('".$tags[$i]."'\")>" . $tags[$i] . "</a>, "; } - } - $tags_str = implode(", ", $formatted_tags); + $tags_str = mb_substr($tags_str, 0, mb_strlen($tags_str)-2); - if ($num_tags < count($tags)) { - $tags_str .= ", …"; - } + if (count($tags) > $maxtags) + $tags_str .= ", …"; - if ($num_tags == 0) { - $tags_str = __("no tags"); + return $tags_str; } - - return $tags_str; - } function format_article_labels($labels, $id) { @@ -4125,7 +4099,7 @@ preg_match("/(Location:|URI:)[^(\n)]*/", $header, $matches); $url = trim(str_replace($matches[1],"",$matches[0])); $url_parsed = parse_url($url); - return (isset($url_parsed))? geturl($url, $referer):''; + return (isset($url_parsed))? geturl($url):''; } $oline=''; foreach($status as $key=>$eline){$oline.='['.$key.']'.$eline.' ';} |