public static function formatObject($j)\r
{\r
$embedurl = $j->embedurl;\r
- $jhtml = self::iframe($j->embedurl, (isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null));\r
- $ret = "<span class='oembed " . $j->type . "'>";\r
+ $jhtml = $j->html;\r
+ $ret = '<div class="oembed ' . $j->type . '">';\r
switch ($j->type) {\r
case "video":\r
if (isset($j->thumbnail_url)) {\r
$th = 120;\r
$tw = $th * $tr;\r
$tpl = get_markup_template('oembed_video.tpl');\r
- $ret.=replace_macros($tpl, array(\r
+ $ret .= replace_macros($tpl, array(\r
'$baseurl' => System::baseUrl(),\r
'$embedurl' => $embedurl,\r
'$escapedhtml' => base64_encode($jhtml),\r
} else {\r
$ret = $jhtml;\r
}\r
- //$ret.="<br>";\r
break;\r
case "photo":\r
- $ret.= "<img width='" . $j->width . "' src='" . proxy_url($j->url) . "'>";\r
+ $ret .= '<img width="' . $j->width . '" src="' . proxy_url($j->url) . '">';\r
break;\r
case "link":\r
break;\r
case "rich":\r
- // not so safe..\r
if (self::isAllowedURL($embedurl)) {\r
$ret .= proxy_parse_html($jhtml);\r
}\r
break;\r
}\r
\r
+ $ret .= '</div>';\r
// add link to source if not present in "rich" type\r
if ($j->type != 'rich' || !strpos($j->html, $embedurl)) {\r
- $ret .= "<h4>";\r
+ $ret .= '<h4>';\r
if (isset($j->title)) {\r
if (isset($j->provider_name)) {\r
$ret .= $j->provider_name . ": ";\r
}\r
\r
$embedlink = (isset($j->title)) ? $j->title : $embedurl;\r
- $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";\r
+ $ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedlink . '</a>';\r
if (isset($j->author_name)) {\r
- $ret.=" (" . $j->author_name . ")";\r
+ $ret .= ' (' . $j->author_name . ')';\r
}\r
} elseif (isset($j->provider_name) || isset($j->author_name)) {\r
$embedlink = "";\r
$embedlink = $embedurl;\r
}\r
\r
- $ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";\r
+ $ret .= '<a href="' . $embedurl . '" rel="oembed">' . $embedlink . '</a>';\r
}\r
- //if (isset($j->author_name)) $ret.=" by ".$j->author_name;\r
- //if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;\r
$ret .= "</h4>";\r
- } else {\r
+ } elseif (!strpos($j->html, $embedurl)) {\r
// add <a> for html2bbcode conversion\r
- $ret .= "<a href='$embedurl' rel='oembed'>$embedurl</a>";\r
+ $ret .= '<a href="' . $embedurl . '" rel="oembed">' . $j->title . '</a>';\r
}\r
- $ret.="</span>";\r
+\r
$ret = str_replace("\n", "", $ret);\r
return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));\r
}\r
$xpath = new DOMXPath($dom);\r
\r
$xattr = self::buildXPath("class", "oembed");\r
- $entries = $xpath->query("//span[$xattr]");\r
+ $entries = $xpath->query("//div[$xattr]");\r
\r
$xattr = "@rel='oembed'"; //oe_build_xpath("rel","oembed");\r
foreach ($entries as $e) {\r
* Since the iframe is automatically resized on load, there are no need for ugly\r
* and impractical scrollbars.\r
*\r
+ * @todo This function is currently unused until someoneā¢ adds support for a separate OEmbed domain\r
+ *\r
* @param string $src Original remote URL to embed\r
* @param string $width\r
* @param string $height\r
}\r
$width = '100%';\r
\r
- // Only proxy OEmbed URLs to avoid mixed-content errors\r
- if (Config::get('system', 'ssl_policy') == SSL_POLICY_FULL && parse_url($src, PHP_URL_SCHEME) !== 'https') {\r
- $src = System::baseUrl() . '/oembed/' . base64url_encode($src);\r
- }\r
+ $src = System::baseUrl() . '/oembed/' . base64url_encode($src);\r
return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $src . '" allowfullscreen scrolling="no" frameborder="no">' . t('Embedded content') . '</iframe>';\r
}\r
\r