From: Tobias Diekershoff Date: Sat, 31 Mar 2012 06:06:07 +0000 (+0200) Subject: Twitter: if there is a title include it into the outgoing tweet X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c388a7f6c9cd7628ca844a9ad670f23bb3bb3ab9;p=friendica-addons.git Twitter: if there is a title include it into the outgoing tweet --- diff --git a/twitter/twitter.php b/twitter/twitter.php index 4f4d7280..acd60fb2 100755 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -291,7 +291,12 @@ function twitter_post_hook(&$a,&$b) { // we can later send to Twitter. This way we can "gain" some // information during shortening of potential links but do not // shorten all the links in a 200000 character long essay. - $tmp = substr($b['body'], 0, 2*$max_char); + if (! $b['title']=='') { + $tmp = $b['title'] . ' : '. $b['body']; + $tmp = substr($tmp, 0, 2*$max_char); + } else { + $tmp = substr($b['body'], 0, 2*$max_char); + } // if [url=bla][img]blub.png[/img][/url] get blub.png $tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\]\[img\](\\w+.*?)\\[\\/img\]\\[\\/url\]/i', '$2', $tmp); // preserve links to images, videos and audios