Merge pull request #4211 from annando/develop

bookmark elements weren't always parsed correctly
This commit is contained in:
Hypolite Petovan 2018-01-11 17:51:10 -05:00 committed by GitHub
commit c4db9edbe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);