forked from friendica/friendica-addons
appnet/statusnet/twitter: Better detection for removable links.
This commit is contained in:
parent
31ab2a3cbf
commit
24de6d38a9
|
@ -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"]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue