url_match('https://mediaserver.unige.ch/play/') ||$asset->url_match('http://mediaserver.unige.ch/play/'); } /** * * @param HttpResource $asset */ public function render($asset) { if (!$this->accept($asset)) { return; } $width = (int) $asset->config('size'); $width = (24 <= $width && $width <= 800) ? $width : 300; $url = $asset->url(); $oembed = self::API_ENDPOINT . '?url=' . urlencode($url) . '&maxwidth=' . $width; $data = HttpResource::fetch_json($oembed); if (empty($data)) { return false; } $result[self::THUMBNAIL] = isset($data['thumbnail_url']) ? $data['thumbnail_url'] : ''; $result[self::TITLE] = isset($data['title']) ? $data['title'] : ''; $result[self::EMBED_SNIPPET] = isset($data['html']) ? $data['html'] : ''; return $result; } }