$_REQUEST['body'] = $post->retweeted_status->text;
+ $picture = "";
+
// media
if (is_array($post->retweeted_status->entities->media)) {
foreach($post->retweeted_status->entities->media AS $media) {
switch($media->type) {
case 'photo':
- $_REQUEST['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $_REQUEST['body']);
- $has_picture = true;
+ //$_REQUEST['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $_REQUEST['body']);
+ //$has_picture = true;
+ $_REQUEST['body'] = str_replace($media->url, "", $_REQUEST['body']);
+ $picture = $media->media_url_https;
break;
}
}
}
- $converted = twitter_expand_entities($a, $_REQUEST['body'], $post->retweeted_status, true, $has_picture);
+ $converted = twitter_expand_entities($a, $_REQUEST['body'], $post->retweeted_status, true, $picture);
$_REQUEST['body'] = $converted["body"];
$_REQUEST['body'] = "[share author='".$post->retweeted_status->user->name.
} else {
$_REQUEST["body"] = $post->text;
+ $picture = "";
+
if (is_array($post->entities->media)) {
foreach($post->entities->media AS $media) {
switch($media->type) {
case 'photo':
- $_REQUEST['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $_REQUEST['body']);
- $has_picture = true;
+ //$_REQUEST['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $_REQUEST['body']);
+ //$has_picture = true;
+ $_REQUEST['body'] = str_replace($media->url, "", $_REQUEST['body']);
+ $picture = $media->media_url_https;
break;
}
}
}
- $converted = twitter_expand_entities($a, $_REQUEST["body"], $post, true, $has_picture);
+ $converted = twitter_expand_entities($a, $_REQUEST["body"], $post, true, $picture);
$_REQUEST['body'] = $converted["body"];
}
return $contact_id;
}
-function twitter_expand_entities($a, $body, $item, $no_tags = false, $dontincludemedia) {
+function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
require_once("include/oembed.php");
require_once("include/network.php");
$footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
$body = str_replace($url->url, $footerlink, $body);
- } elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) {
+ //} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) {
+ } elseif (($oembed_data->type == "photo") AND isset($oembed_data->url)) {
$body = str_replace($url->url,
"[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]",
$body);
- $dontincludemedia = true;
+ //$dontincludemedia = true;
} elseif ($oembed_data->type != "link")
$body = str_replace($url->url,
"[url=".$expanded_url."]".$expanded_url."[/url]",
if (substr($mime, 0, 6) == "image/") {
$type = "photo";
$body = str_replace($url->url, "[img]".$expanded_url."[/img]", $body);
- $dontincludemedia = true;
+ //$dontincludemedia = true;
} else {
$type = $oembed_data->type;
$footerurl = $expanded_url;
}
if ($footerurl != "")
- $footer = add_page_info($footerurl);
+ $footer = add_page_info($footerurl, false, $picture);
if (($footerlink != "") AND (trim($footer) != "")) {
$removedlink = trim(str_replace($footerlink, "", $body));
$body .= $footer;
}
+ if (($footer == "") AND ($picture != ""))
+ $body .= "\n\n[img]".$picture."[/img]\n";
+
if ($no_tags)
return(array("body" => $body, "tags" => ""));
$postarray['body'] = $post->text;
+ $picture = "";
+
// media
if (is_array($post->entities->media)) {
foreach($post->entities->media AS $media) {
switch($media->type) {
case 'photo':
- $postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
- $has_picture = true;
+ //$postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
+ //$has_picture = true;
+ $postarray['body'] = str_replace($media->url, "", $postarray['body']);
+ $picture = $media->media_url_https;
break;
default:
$postarray['body'] .= print_r($media, true);
}
}
- $converted = twitter_expand_entities($a, $postarray['body'], $post, false, $has_picture);
+ $converted = twitter_expand_entities($a, $postarray['body'], $post, false, $picture);
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];
$postarray['body'] = $post->retweeted_status->text;
+ $picture = "";
+
// media
if (is_array($post->retweeted_status->entities->media)) {
foreach($post->retweeted_status->entities->media AS $media) {
switch($media->type) {
case 'photo':
- $postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
- $has_picture = true;
+ //$postarray['body'] = str_replace($media->url, "\n\n[img]".$media->media_url_https."[/img]\n", $postarray['body']);
+ //$has_picture = true;
+ $postarray['body'] = str_replace($media->url, "", $postarray['body']);
+ $picture = $media->media_url_https;
break;
default:
$postarray['body'] .= print_r($media, true);
}
}
- $converted = twitter_expand_entities($a, $postarray['body'], $post->retweeted_status, false, $has_picture);
+ $converted = twitter_expand_entities($a, $postarray['body'], $post->retweeted_status, false, $picture);
$postarray['body'] = $converted["body"];
$postarray['tag'] = $converted["tags"];