- if (isset($j->provider_name)) $ret .= $j->provider_name.": ";
- $embedlink = (isset($j->title))?$j->title:$embedurl;
- $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
- if (isset($j->author_name)) $ret.=" (".$j->author_name.")";
+ if (isset($j->title)) {
+ if (isset($j->provider_name))
+ $ret .= $j->provider_name.": ";
+
+ $embedlink = (isset($j->title))?$j->title:$embedurl;
+ $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
+ 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>";
+ }