From: Andrew Dolgov Date: Thu, 25 Nov 2010 09:05:48 +0000 (+0300) Subject: tweak display of tweet button X-Git-Tag: 1.5.0~50 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=411fe209d642f64ee1f856908e6c1b4507893fcf;p=tt-rss.git tweak display of tweet button --- diff --git a/functions.php b/functions.php index 6b76cea3..888af566 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 "