From feaf938ffd4dc27f2c03b4a532f78b172ddb35e4 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 4 Feb 2010 03:17:48 +0000 Subject: [PATCH] Make Twitter bridge truncate and add a link back to the original notice when notice content is > 140c --- plugins/TwitterBridge/twitter.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 33dfb788bf..6944a1ace0 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -1,7 +1,7 @@ content); // Convert !groups to #hashes + + // XXX: Make this an optional setting? + $statustxt = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/', "\\1#\\2", $statustxt); + if (mb_strlen($statustxt) > 140) { + $noticeUrl = common_shorten_url($notice->uri); + $urlLen = mb_strlen($noticeUrl); + $statustxt = mb_substr($statustxt, 0, 140 - ($urlLen + 3)) . ' … ' . $noticeUrl; + } + return $statustxt; } -- 2.39.2