appnet/statusnet/twitter: Better detection for removable links.

This commit is contained in:
Michael Vogel 2014-07-27 22:04:04 +02:00
parent 31ab2a3cbf
commit 24de6d38a9
3 changed files with 4 additions and 8 deletions

View File

@ -968,16 +968,12 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
if (sizeof($links)) {
$link = array_pop($links);
$url = "[url=".$link."]".$link."[/url]";
$removedlink = trim(str_replace($url, "", $postarray['body']));
$url = str_replace(array('/', '.'), array('\/', '\.'), $link);
$removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']);
if (($removedlink == "") OR strstr($postarray['body'], $removedlink))
$postarray['body'] = $removedlink;
if (($removedlink == "") OR strstr("[url]".$postarray['body']."[/url]", $removedlink))
$postarray['body'] = $removedlink;
$page_info = add_page_info($link, false, $photo["url"]);
}

View File

@ -1538,7 +1538,7 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
if (($footerlink != "") AND (trim($footer) != "")) {
$removedlink = trim(str_replace($footerlink, "", $body));
if (strstr($body, $removedlink))
if (($removedlink == "") OR strstr($body, $removedlink))
$body = $removedlink;
$body .= $footer;

View File

@ -1142,7 +1142,7 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
if (($footerlink != "") AND (trim($footer) != "")) {
$removedlink = trim(str_replace($footerlink, "", $body));
if (strstr($body, $removedlink))
if (($removedlink == "") OR strstr($body, $removedlink))
$body = $removedlink;
$body .= $footer;