/** * * @param HttpResource $asset */ public function render($asset) { if ($asset->url_match('gmodules.com/ig/') && $asset->url_param('url') != false) { $url = $asset->url(); $title = $asset->url_param('title'); $title = ($title == '__MSG_title__') ? '' : $title; $embed = <<<EOT <script src="$url"></script> EOT; $result = array(); $result[self::EMBED_SNIPPET] = $embed; $result[self::TITLE] = $title; return $result; } if (!$asset->is_gadget()) { $url = $asset->url(); if (!$asset->url_match('google.com/ig/directory')) { return false; } if (!$asset->url_match('type=gadgets')) { return false; } $url = $asset->url_param('url'); if (empty($url)) { return false; } $asset = new HttpResource($url); if (!$asset->is_gadget()) { return false; } } $url = $asset->url(); if (strpos($url, 'http') !== 0) { $url = "http://$url"; } $url = urlencode($url); $title = $asset->title(); $title = $title ? $title : $asset->name(); $size = (int) $asset->config('size'); $size = (24 <= $size && $size <= 800) ? $size : 300; $embed = <<<EOT <script src="//www.gmodules.com/ig/ifr?url=$url&w=$size&output=js"></script> EOT; $result = array(); $result[self::EMBED_SNIPPET] = $embed; $result[self::TITLE] = $title; return $result; }