]> git.mxchange.org Git - friendica-addons.git/blobdiff - twitter/twitter.php
Preparations for shared posts
[friendica-addons.git] / twitter / twitter.php
index 3fcaa1de33517e47d67fc3334e49a42cf073b9ca..ee3bd0fbda5467dcc85897f8e327a5bc9ff905c1 100755 (executable)
@@ -294,6 +294,9 @@ function twitter_shortenmsg($b) {
        $recycle = html_entity_decode("◌ ", ENT_QUOTES, 'UTF-8');
        $body = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', "\n", $body);
 
+       // remove the share element
+       $body = preg_replace("/\[share(.*?)\](.*?)\[\/share\]/ism","\n\n$2\n\n",$body);
+
        // At first convert the text to html
        $html = bbcode($body, false, false);
 
@@ -354,7 +357,7 @@ function twitter_shortenmsg($b) {
                $msg = substr($msg, 0, -1);
                $pos = strrpos($msg, "\n");
                if ($pos > 0)
-                       $msg = substr($msg, 0, $pos-1);
+                       $msg = substr($msg, 0, $pos);
                else if ($lastchar != "\n")
                        $msg = substr($msg, 0, -3)."...";
        }