1
0
Fork 0

oembed: Option to disallow displaying of "rich" content and some beautification for titles that are only links

This commit is contained in:
Michael Vogel 2014-01-26 09:59:20 +01:00
parent a7079d4327
commit a0de28c491

View file

@ -105,16 +105,34 @@ function oembed_format_object($j){
}; break; }; break;
case "rich": { case "rich": {
// not so safe.. // not so safe..
if (!get_config("system","no_oembed_rich_content"))
$ret.= $jhtml; $ret.= $jhtml;
}; break; }; break;
} }
// 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) ){
if (isset($j->provider_name)) $ret .= $j->provider_name.": "; if (isset($j->title)) {
if (isset($j->provider_name))
$ret .= $j->provider_name.": ";
$embedlink = (isset($j->title))?$j->title:$embedurl; $embedlink = (isset($j->title))?$j->title:$embedurl;
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>"; $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
if (isset($j->author_name)) $ret.=" (".$j->author_name.")"; if (isset($j->author_name))
$ret.=" (".$j->author_name.")";
} elseif (isset($j->provider_name) OR isset($j->author_name)) {
$embedlink = "";
if (isset($j->provider_name))
$embedlink .= $j->provider_name;
if (isset($j->author_name)) {
if ($embedlink != "")
$embedlink .= ": ";
$embedlink .= $j->author_name;
}
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
}
//if (isset($j->author_name)) $ret.=" by ".$j->author_name; //if (isset($j->author_name)) $ret.=" by ".$j->author_name;
//if (isset($j->provider_name)) $ret.=" on ".$j->provider_name; //if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else { } else {