/** * Convert Vimeo links into embedded content * @since Version 3.10.0 * @param \DOMElement $e * @return \DOMElement */ public static function EmbedVimeo(DOMElement $e) { $timer = Debug::GetTimer(); $url = pq($e)->attr("href"); if (strpos($url, "vimeo.com") === false) { return $e; } // Fetch oEmbed $oembed = Url::oEmbedLookup(sprintf("https://vimeo.com/api/oembed.json?url=%s", $url)); if (!is_array($oembed) || !isset($oembed['html'])) { return $e; } $video_iframe = pq($oembed['html']); $video_iframe->addClass("content-iframe")->addClass("content-vimeo"); pq($e)->after("<br><br><a href='" . $url . "'>" . $oembed['title'] . " by " . $oembed['author_name'] . "</a>")->replaceWith($video_iframe); Debug::LogEvent(__METHOD__, $timer); return $e; }