+ return allowed_domain($domain, $allowed);\r
+ }\r
+\r
+ public static function getHTML($url, $title = null)\r
+ {\r
+ // Always embed the SSL version\r
+ $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),\r
+ array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);\r
+\r
+ $o = OEmbed::fetchURL($url);\r
+\r
+ if (!is_object($o) || $o->type == 'error') {\r
+ throw new Exception('OEmbed failed for URL: ' . $url);\r
+ }\r
+\r
+ if (x($title)) {\r
+ $o->title = $title;\r
+ }\r
+\r
+ $html = OEmbed::formatObject($o);\r
+\r
+ return $html;\r