bookmark elements weren't always parsed correctly

This commit is contained in:
Michael 2018-01-11 22:28:46 +00:00
parent 5f229e6030
commit e18e081b47

View file

@ -35,7 +35,7 @@ class OEmbed
public static function replaceCallback($matches) public static function replaceCallback($matches)
{ {
$embedurl = $matches[1]; $embedurl = $matches[1];
$j = self::fetchURL($embedurl); $j = self::fetchURL($embedurl, !self::isAllowedURL($embedurl));
$s = self::formatObject($j); $s = self::formatObject($j);
return $s; return $s;
@ -161,7 +161,7 @@ class OEmbed
return $j; return $j;
} }
public static function formatObject($j) private static function formatObject($j)
{ {
$embedurl = $j->embedurl; $embedurl = $j->embedurl;
$jhtml = $j->html; $jhtml = $j->html;
@ -195,9 +195,7 @@ class OEmbed
case "link": case "link":
break; break;
case "rich": case "rich":
if (self::isAllowedURL($embedurl)) { $ret .= proxy_parse_html($jhtml);
$ret .= proxy_parse_html($jhtml);
}
break; break;
} }
@ -322,7 +320,7 @@ class OEmbed
$url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
array("https://www.youtube.com/", "https://player.vimeo.com/"), $url); array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
$o = self::fetchURL($url); $o = self::fetchURL($url, !self::isAllowedURL($url));
if (!is_object($o) || $o->type == 'error') { if (!is_object($o) || $o->type == 'error') {
throw new Exception('OEmbed failed for URL: ' . $url); throw new Exception('OEmbed failed for URL: ' . $url);