You are here

function soembed_get_contents in Simple oEmbed 7

Locally create HTML after pattern study for sites that don't support oEmbed.

1 call to soembed_get_contents()
soembed_filter_embed in ./soembed.module
Make request against provider to get embedded code.

File

./soembed.module, line 150
Lets author embed rich media by inserting URL using oEmbed techonology.

Code

function soembed_get_contents($provider, $url) {
  $width = variable_get('soembed_maxwidth', 0);
  switch ($provider) {
    case 'google-maps':

      //$url    = str_replace('&', '&', $url); Though Google encodes ampersand, it seems to work without it.
      $height = (int) ($width / 1.3);
      $embed = "<iframe width='{$width}' height='{$height}' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='{$url}&output=embed'></iframe><br /><small><a href='{$url}&source=embed' style='color:#0000FF;text-align:left'>View Larger Map</a></small>";
      break;
    case 'google-docs':
      $height = (int) ($width * 1.5);
      $embed = "<iframe width='{$width}' height='{$height}' frameborder='0' src='{$url}&widget=true'></iframe>";
      break;
    default:
      $embed = $url;
  }
  return $embed;
}