SN addon: only shorteb links if neede
This commit is contained in:
parent
d61ce7709a
commit
439e62d1d4
|
@ -442,6 +442,7 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);
|
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);
|
||||||
// find all http or https links in the body of the entry and
|
// find all http or https links in the body of the entry and
|
||||||
// apply the shortener if the link is longer then 20 characters
|
// apply the shortener if the link is longer then 20 characters
|
||||||
|
if (( strlen($tmp)>$max_char ) && ( $max_char > 0 )) {
|
||||||
preg_match_all ( '/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', $tmp, $allurls );
|
preg_match_all ( '/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', $tmp, $allurls );
|
||||||
foreach ($allurls as $url) {
|
foreach ($allurls as $url) {
|
||||||
foreach ($url as $u) {
|
foreach ($url as $u) {
|
||||||
|
@ -451,6 +452,7 @@ function statusnet_post_hook(&$a,&$b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ok, all the links we want to send out are save, now strip
|
// ok, all the links we want to send out are save, now strip
|
||||||
// away the remaining bbcode
|
// away the remaining bbcode
|
||||||
$msg = strip_tags(bbcode($tmp));
|
$msg = strip_tags(bbcode($tmp));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user