]> git.mxchange.org Git - friendica-addons.git/commitdiff
SN: if there is a title, include in into the outgoing dent
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 31 Mar 2012 06:04:45 +0000 (08:04 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 31 Mar 2012 06:04:45 +0000 (08:04 +0200)
statusnet/statusnet.php

index 8f2fbf8190965e9a95a0a2237e3985ae341d4b2d..9830c881b4564813ae4d84527ecaa24f35df9add 100755 (executable)
@@ -425,7 +425,12 @@ function statusnet_post_hook(&$a,&$b) {
                 // we can later send to StatusNet. 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