forked from GNUsocial/gnu-social
Make Twitter bridge truncate and add a link back to the original notice when notice content is > 140c
This commit is contained in:
parent
72f72d17db
commit
feaf938ffd
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2008, 2009, StatusNet, Inc.
|
||||
* Copyright (C) 2008-2010 StatusNet, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@ -295,8 +295,17 @@ function format_status($notice)
|
||||
$statustxt = preg_replace('/^@/', ' @', $notice->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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user