diff --git a/functions.php b/functions.php index 6b76cea30..888af5667 100644 --- a/functions.php +++ b/functions.php @@ -2002,9 +2002,9 @@ } } - function truncate_string($str, $max_len) { + function truncate_string($str, $max_len, $suffix = '…') { if (mb_strlen($str, "utf-8") > $max_len - 3) { - return mb_substr($str, 0, $max_len, "utf-8") . "…"; + return mb_substr($str, 0, $max_len, "utf-8") . $suffix; } else { return $str; } @@ -4577,6 +4577,15 @@ print "
" . truncate_string(strip_tags($line['title']), 15) . "
"; + $tweet_title = htmlspecialchars( + truncate_string(strip_tags($line['title']), 100, '...')); + + $tweet_link = htmlspecialchars($line['link']); + + print ""; + print json_encode(array("title" => $tweet_title, "link" => $tweet_link)); + print ""; + print "
"; /* print "
"; } + if (ENABLE_TWEET_BUTTON) { + print "Zoom"; + } + print "Tweet"; - print "
"; print "
"; @@ -5227,11 +5235,14 @@ $short_title = truncate_string( strip_tags($line['title']), 90); - print "
Tweet"; + $tweet_title = htmlspecialchars( + truncate_string(strip_tags($line['title']), 100, '...')); + + $tweet_link = htmlspecialchars($line['link']); + + print ""; + print json_encode(array("title" => $tweet_title, "link" => $tweet_link)); + print ""; print ""; @@ -5253,6 +5264,13 @@ alt='Zoom' title='".__('Open article in new tab')."'>"; + $note_escaped = htmlspecialchars($line['note'], ENT_QUOTES); + + print "PubNote"; + if (DIGEST_ENABLE) { print "Zoom"; } - $note_escaped = htmlspecialchars($line['note'], ENT_QUOTES); - - print "PubNote"; + if (ENABLE_TWEET_BUTTON) { + print "Zoom"; + } print "