Merge pull request #4209 from annando/oembed-link
When no OEmbedding is wanted, the links are now created fine again
This commit is contained in:
commit
d74292b7e1
|
@ -75,7 +75,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
|
||||||
$return = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
$return = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if ($tryoembed) {
|
if ($tryoembed && OEmbed::isAllowedURL($data['url'])) {
|
||||||
$return = OEmbed::getHTML($data['url'], $data['title']);
|
$return = OEmbed::getHTML($data['url'], $data['title']);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('OEmbed is disabled for this attachment.');
|
throw new Exception('OEmbed is disabled for this attachment.');
|
||||||
|
@ -94,7 +94,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
|
||||||
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
|
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
|
||||||
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
||||||
} else {
|
} else {
|
||||||
$return .= sprintf('[bookmark=%s]%s[/bookmark]', $data['url'], $data['title']);
|
$return .= sprintf('<h4><a href="%s">%s</a></h4>', $data['url'], $data['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim($data["description"]) != "") {
|
if (trim($data["description"]) != "") {
|
||||||
|
|
|
@ -322,7 +322,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 = OEmbed::fetchURL($url);
|
$o = self::fetchURL($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);
|
||||||
|
@ -332,7 +332,7 @@ class OEmbed
|
||||||
$o->title = $title;
|
$o->title = $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = OEmbed::formatObject($o);
|
$html = self::formatObject($o);
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue