$siteinfo['type'] = $oembed_data->type;
}
- if (($oembed_data->type == 'link') && ($siteinfo['type'] != 'photo')) {
+ // See https://github.com/friendica/friendica/pull/5763#discussion_r217913178
+ if ($siteinfo['type'] != 'photo') {
if (isset($oembed_data->title)) {
$siteinfo['title'] = trim($oembed_data->title);
}
}
// Prevent to have a photo type without an image
- if (empty($siteinfo['image']) && ($siteinfo['type'] == 'photo')) {
+ if ((empty($siteinfo['image']) || !empty($siteinfo['text'])) && ($siteinfo['type'] == 'photo')) {
$siteinfo['type'] = 'link';
}
- if ((@$siteinfo['image'] == '') && !$no_guessing) {
+ if (empty($siteinfo['image']) && !$no_guessing) {
$list = $xpath->query('//img[@src]');
foreach ($list as $node) {
$img_tag = [];
$complete = $schemearr["scheme"]."://".$schemearr["host"];
- if (@$schemearr["port"] != "") {
+ if (!empty($schemearr["port"])) {
$complete .= ":".$schemearr["port"];
}
- if (strpos($urlarr["path"], "/") !== 0) {
- $complete .= "/";
- }
+ if (!empty($urlarr["path"])) {
+ if (strpos($urlarr["path"], "/") !== 0) {
+ $complete .= "/";
+ }
- $complete .= $urlarr["path"];
+ $complete .= $urlarr["path"];
+ }
- if (@$urlarr["query"] != "") {
+ if (!empty($urlarr["query"])) {
$complete .= "?".$urlarr["query"];
}
- if (@$urlarr["fragment"] != "") {
+ if (!empty($urlarr["fragment"])) {
$complete .= "#".$urlarr["fragment"];
}