// That means that we have to decode all image-urls
$image = htmlspecialchars_decode($image);
- if ($b["title"] == "")
- $body = $b["body"];
- else
- $body = $b["title"];
+ $body = $b["body"];
+ if ($b["title"] != "")
+ $body = $b["title"]."\n\n".$body;
// remove the recycle signs and the names since they aren't helpful on twitter
// recycle 1
$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);
while (strpos($msg, " ") !== false)
$msg = str_replace(" ", " ", $msg);
+ // Removing URLs
+ $msg = preg_replace('/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/i', "", $msg);
+
$msg = trim($msg);
$link = '';
$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)."...";
}