mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-10-15 03:06:59 +00:00
Facebook: The system now tries to get the full resolution of an imported post. Additionally URLs are cleaned from tracking variables.
This commit is contained in:
parent
ccbcd2ab16
commit
76a8623053
2 changed files with 23 additions and 2 deletions
|
@ -967,8 +967,21 @@ function fbpost_cron($a,$b) {
|
|||
set_config('facebook','last_poll', time());
|
||||
}
|
||||
|
||||
function fbpost_cleanpicture($url) {
|
||||
require_once("include/Photo.php");
|
||||
|
||||
$urldata = parse_url($url);
|
||||
if (isset($urldata["query"])) {
|
||||
parse_str($urldata["query"], $querydata);
|
||||
if (isset($querydata["url"]) AND (get_photo_info($querydata["url"])))
|
||||
return($querydata["url"]);
|
||||
}
|
||||
return($url);
|
||||
}
|
||||
|
||||
function fbpost_fetchwall($a, $uid) {
|
||||
require_once("include/oembed.php");
|
||||
require_once("include/network.php");
|
||||
require_once('mod/item.php');
|
||||
|
||||
$access_token = get_pconfig($uid,'facebook','access_token');
|
||||
|
@ -1029,6 +1042,7 @@ function fbpost_fetchwall($a, $uid) {
|
|||
$type = "";
|
||||
|
||||
if(isset($item->name) and isset($item->link)) {
|
||||
$item->link = original_url($item->link);
|
||||
$oembed_data = oembed_fetch_url($item->link);
|
||||
$type = $oembed_data->type;
|
||||
$content = "[bookmark=".$item->link."]".$item->name."[/bookmark]";
|
||||
|
@ -1071,9 +1085,12 @@ function fbpost_fetchwall($a, $uid) {
|
|||
}
|
||||
}
|
||||
|
||||
if(($picture != "") && isset($item->link))
|
||||
$picture = fbpost_cleanpicture($picture);
|
||||
|
||||
if(($picture != "") && isset($item->link)) {
|
||||
$item->link = original_url($item->link);
|
||||
$content .= "\n".'[url='.$item->link.'][img]'.$picture.'[/img][/url]';
|
||||
else {
|
||||
} else {
|
||||
if ($picture != "")
|
||||
$content .= "\n".'[img]'.$picture.'[/img]';
|
||||
// if just a link, it may be a wall photo - check
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue