From 275a0af23de1cc679b5c4938fe5a41abcbf5a3a9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 6 Oct 2009 13:08:37 +0400 Subject: [PATCH] format_tags_string: improve detection of layout breaking extra-long tag strings --- functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index 32a5b2ec3..b67ff9570 100644 --- a/functions.php +++ b/functions.php @@ -6158,11 +6158,17 @@ $num_tags++; $tag_escaped = str_replace("'", "\\'", $tag); + if (mb_strlen($tag) > 30) { + $tag = truncate_string($tag, 30); + } + $tag_str = "$tag"; array_push($formatted_tags, $tag_str); + + $tmp_tags_str = implode(", ", $formatted_tags); - if ($num_tags == $tag_limit) { + if ($num_tags == $tag_limit || mb_strlen($tmp_tags_str) > 150) { break; } }