summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php48
1 files changed, 11 insertions, 37 deletions
diff --git a/include/functions.php b/include/functions.php
index c39b4938c..15a875746 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -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 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 .= ", &hellip;";
- }
+ if (count($tags) > $maxtags)
+ $tags_str .= ", &hellip;";
- if ($num_tags == 0) {
- $tags_str = __("no tags");
+ return $tags_str;
}
-
- return $tags_str;
-
}
function format_article_labels($labels, $id) {