From: vinz Date: Wed, 8 Nov 2017 21:50:00 +0000 (+0100) Subject: fixed hard coded twitter char limit X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5af96d3ec72f0561d7b3cb931a88dd07fa0b11b8;p=quix0rs-gnu-social.git fixed hard coded twitter char limit --- diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php index 20793784ae..dbc46bafb5 100644 --- a/plugins/TwitterBridge/twitter.php +++ b/plugins/TwitterBridge/twitter.php @@ -401,11 +401,11 @@ function format_status($notice) $statusWithoutLinks = preg_replace('`((http|https|ftp)://[^\s<]+[^\s<\.)])`i', '', $statustxt); $statusLength = mb_strlen($statusWithoutLinks) + $numberOfLinks * 23; - // Twitter still has a 140-char hardcoded max. - if ($statusLength > 140) { + // Twitter raised it but still has a 280-char hardcoded max. + if ($statusLength > 280) { $noticeUrl = common_shorten_url($notice->getUrl()); // each link uses 23 chars on twitter + 3 for the ' … ' => 26 - $statustxt = mb_substr($statustxt, 0, 140 - 26) . ' … ' . $noticeUrl; + $statustxt = mb_substr($statustxt, 0, 280 - 26) . ' … ' . $noticeUrl; } return $statustxt;