mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-12-22 15:10:21 +00:00
fromgplus: This addon is now enabled to cooperate with "leistungsschutzrecht" as well.
This commit is contained in:
parent
225aabf5bb
commit
f296b5b4d6
1 changed files with 52 additions and 26 deletions
|
@ -275,29 +275,35 @@ function fromgplus_cleantext($text) {
|
||||||
|
|
||||||
function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
|
function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
|
||||||
require_once("include/Photo.php");
|
require_once("include/Photo.php");
|
||||||
|
require_once("include/items.php");
|
||||||
|
|
||||||
$post = "";
|
$post = "";
|
||||||
$quote = "";
|
$quote = "";
|
||||||
$type = "";
|
$pagedata = array();
|
||||||
|
$pagedata["type"] = "";
|
||||||
|
|
||||||
foreach ($item->object->attachments as $attachment) {
|
foreach ($item->object->attachments as $attachment) {
|
||||||
switch($attachment->objectType) {
|
switch($attachment->objectType) {
|
||||||
case "video":
|
case "video":
|
||||||
$post .= "\n[class=type-video][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n[/class]";
|
$pagedata["type"] = "video";
|
||||||
|
$pagedata["url"] = $attachment->url;
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "article":
|
case "article":
|
||||||
$post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
$pagedata["type"] = "link";
|
||||||
|
$pagedata["url"] = $attachment->url;
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
|
|
||||||
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
|
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
|
||||||
if ($images["full"] != "")
|
if ($images["full"] != "")
|
||||||
$post .= "\n[img]".$images["full"]."[/img]";
|
$pagedata["images"][0]["src"] = $images["full"];
|
||||||
|
|
||||||
$quote = trim(fromgplus_html2bbcode($attachment->content));
|
$quote = trim(fromgplus_html2bbcode($attachment->content));
|
||||||
if ($quote != "")
|
|
||||||
$quote = "\n[quote]".$quote."[/quote]";
|
|
||||||
|
|
||||||
$quote .= "[/class]";
|
if ($quote != "")
|
||||||
|
$pagedata["text"] = $quote;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "photo":
|
case "photo":
|
||||||
|
@ -311,52 +317,72 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
|
||||||
$images = store_photo($a, $uid, "", $attachment->image->url);
|
$images = store_photo($a, $uid, "", $attachment->image->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($images["preview"] != "")
|
if ($images["preview"] != "") {
|
||||||
$post .= "\n[url=".$images["page"]."][img]".$images["preview"]."[/img][/url]\n";
|
$post .= "\n[url=".$images["page"]."][img]".$images["preview"]."[/img][/url]\n";
|
||||||
elseif ($images["full"] != "")
|
$pagedata["images"][0]["src"] = $images["preview"];
|
||||||
|
$pagedata["url"] = $images["page"];
|
||||||
|
} elseif ($images["full"] != "") {
|
||||||
$post .= "\n[img]".$images["full"]."[/img]\n";
|
$post .= "\n[img]".$images["full"]."[/img]\n";
|
||||||
|
$pagedata["images"][0]["src"] = $images["full"];
|
||||||
|
|
||||||
if (($attachment->displayName != "") AND (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext)))
|
if ($images["preview"] != "")
|
||||||
|
$pagedata["images"][1]["src"] = $images["preview"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($attachment->displayName != "") AND (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext))) {
|
||||||
$post .= fromgplus_html2bbcode($attachment->displayName)."\n";
|
$post .= fromgplus_html2bbcode($attachment->displayName)."\n";
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "photo-album":
|
case "photo-album":
|
||||||
|
$pagedata["url"] = $attachment->url;
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
||||||
|
|
||||||
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
|
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
|
||||||
if ($images["preview"] != "")
|
|
||||||
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
|
|
||||||
elseif ($images["full"] != "")
|
|
||||||
$post .= "\n[img]".$images["full"]."[/img]\n";
|
|
||||||
|
|
||||||
|
if ($images["preview"] != "") {
|
||||||
|
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
|
||||||
|
$pagedata["images"][0]["src"] = $images["preview"];
|
||||||
|
$pagedata["url"] = $images["full"];
|
||||||
|
} elseif ($images["full"] != "") {
|
||||||
|
$post .= "\n[img]".$images["full"]."[/img]\n";
|
||||||
|
$pagedata["images"][0]["src"] = $images["full"];
|
||||||
|
|
||||||
|
if ($images["preview"] != "")
|
||||||
|
$pagedata["images"][1]["src"] = $images["preview"];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "album":
|
case "album":
|
||||||
$post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]";
|
$pagedata["type"] = "link";
|
||||||
|
$pagedata["url"] = $attachment->url;
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
|
|
||||||
$thumb = $attachment->thumbnails[0];
|
$thumb = $attachment->thumbnails[0];
|
||||||
$post .= "\n[img]".$thumb->image->url."[/img]";
|
$pagedata["images"][0]["src"] = $thumb->image->url;
|
||||||
|
|
||||||
$quote = trim(fromgplus_html2bbcode($thumb->description));
|
$quote = trim(fromgplus_html2bbcode($thumb->description));
|
||||||
if ($quote != "")
|
if ($quote != "")
|
||||||
$quote = "\n[quote]".$quote."[/quote]";
|
$pagedata["text"] = $quote;
|
||||||
|
|
||||||
//foreach($attachment->thumbnails as $thumb) {
|
|
||||||
// $preview = "/w".$thumb->image->width."-h".$thumb->image->height."/";
|
|
||||||
// $preview2 = "/w".$thumb->image->width."-h".$thumb->image->height."-p/";
|
|
||||||
// $image = str_replace(array($preview, $preview2), array("/", "/"), $thumb->image->url);
|
|
||||||
|
|
||||||
// $post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
|
|
||||||
//}
|
|
||||||
$quote .= "[/class]";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "audio":
|
case "audio":
|
||||||
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
|
$pagedata["url"] = $attachment->url;
|
||||||
|
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
|
||||||
|
$post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//default:
|
//default:
|
||||||
// die($attachment->objectType);
|
// die($attachment->objectType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($pagedata["type"] != "")
|
||||||
|
return(add_page_info_data($pagedata));
|
||||||
|
|
||||||
return($post.$quote);
|
return($post.$quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue