Merge pull request #4221 from annando/oembed-no-title
Better treatment of Oembed detection with no OEmbed data and not title
This commit is contained in:
commit
779f6601f4
|
@ -202,23 +202,22 @@ class OEmbed
|
||||||
// add link to source if not present in "rich" type
|
// add link to source if not present in "rich" type
|
||||||
if ($j->type != 'rich' || !strpos($j->html, $embedurl)) {
|
if ($j->type != 'rich' || !strpos($j->html, $embedurl)) {
|
||||||
$ret .= '<h4>';
|
$ret .= '<h4>';
|
||||||
if (isset($j->title)) {
|
if (!empty($j->title)) {
|
||||||
if (isset($j->provider_name)) {
|
if (!empty($j->provider_name)) {
|
||||||
$ret .= $j->provider_name . ": ";
|
$ret .= $j->provider_name . ": ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$embedlink = (isset($j->title)) ? $j->title : $embedurl;
|
$ret .= '<a href="' . $embedurl . '" rel="oembed">' . $j->title . '</a>';
|
||||||
$ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedlink . '</a>';
|
if (!empty($j->author_name)) {
|
||||||
if (isset($j->author_name)) {
|
|
||||||
$ret .= ' (' . $j->author_name . ')';
|
$ret .= ' (' . $j->author_name . ')';
|
||||||
}
|
}
|
||||||
} elseif (isset($j->provider_name) || isset($j->author_name)) {
|
} elseif (!empty($j->provider_name) || !empty($j->author_name)) {
|
||||||
$embedlink = "";
|
$embedlink = "";
|
||||||
if (isset($j->provider_name)) {
|
if (!empty($j->provider_name)) {
|
||||||
$embedlink .= $j->provider_name;
|
$embedlink .= $j->provider_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($j->author_name)) {
|
if (!empty($j->author_name)) {
|
||||||
if ($embedlink != "") {
|
if ($embedlink != "") {
|
||||||
$embedlink .= ": ";
|
$embedlink .= ": ";
|
||||||
}
|
}
|
||||||
|
@ -230,6 +229,8 @@ class OEmbed
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedlink . '</a>';
|
$ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedlink . '</a>';
|
||||||
|
} else {
|
||||||
|
$ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedurl . '</a>';
|
||||||
}
|
}
|
||||||
$ret .= "</h4>";
|
$ret .= "</h4>";
|
||||||
} elseif (!strpos($j->html, $embedurl)) {
|
} elseif (!strpos($j->html, $embedurl)) {
|
||||||
|
|
Loading…
Reference in a new issue