You are here

function kaltura_get_embed_options in Kaltura 5

Same name and namespace in other branches
  1. 6.2 includes/kaltura.themeing.inc \kaltura_get_embed_options()
  2. 6 includes/kaltura.themeing.inc \kaltura_get_embed_options()
1 call to kaltura_get_embed_options()
kaltura_replace_tags in includes/kaltura.themeing.inc

File

includes/kaltura.themeing.inc, line 515

Code

function kaltura_get_embed_options($params) {
  switch ($params["align"]) {
    case 'r':
      $align = "right";
      break;
    case 'm':
      $align = "center";
      break;
    case 'l':
      $align = "left";
      break;
    default:
      $align = "";
      break;
  }
  if ($params['id']) {
    $div_id = $params['id'];
  }
  if ($params['custom_style']) {
    $custom_style = $params['custom_style'];
  }
  if ($_SERVER["SERVER_PORT"] == 443) {
    $protocol = "https://";
  }
  else {
    $protocol = "http://";
  }
  if ($params['uiconf_id']) {
    $uicid = $params['uiconf_id'];
    $theme_uicid = TRUE;
  }
  $wid = '_' . variable_get('kaltura_partner_id', '');
  $widescreen = '';
  if ($params["entry"]) {
    $uicid = kaltura_use_uiconf($uicid, 'entry', $theme_uicid, $params['media_type']);
    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid . '_' . $uicid . '/entry_id/' . $params["entry"] . '/uiconf_id/' . $uicid);
    $media_id = $params["entry"];
    if ($params['media_type'] == 'video') {
      if (variable_get('kaltura_video_entry_player_ratio', 0) == 1) {
        $widescreen = '&widescreen=1';
      }
    }
    $player_size = kaltura_calculate_player_size('entry', $params['size'], $params['width'], $params['height']);
  }
  elseif ($params["kid"]) {
    $uicid = kaltura_use_uiconf($uicid, 'mix', $theme_uicid);
    $kshow = TRUE;
    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid . '_' . $uicid . '/kid/' . $params["kid"] . '/uiconf_id/' . $uicid);
    $media_id = $params["kid"];
    $player_size = kaltura_calculate_player_size('mix', $params['size'], $params['width'], $params['height']);
  }
  elseif ($params["mix"]) {
    $uicid = kaltura_use_uiconf($uicid, 'mix', $theme_uicid);
    $roughcut = TRUE;
    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid . '_' . $uicid . '/entry_id/' . $params["mix"] . '/uiconf_id/' . $uicid);
    $media_id = $params["mix"];
    $player_size = kaltura_calculate_player_size('mix', $params['size'], $params['width'], $params['height']);
  }
  elseif ($params["comment"]) {
    $uicid = kaltura_use_uiconf($uicid, 'entry', $theme_uicid, 'comment');
    $swf_url = KalturaHelpers::getSwfUrlForWidget($wid . '_' . $uicid . '/entry_id/' . $params["comment"] . '/uiconf_id/' . $uicid);
    $media_id = $params["comment"];
    $player_size = kaltura_calculate_player_size('comment', $params['size'], $params['width'], $params['height']);
  }
  $finish_f = '';
  if ($params['finishF']) {
    $finish_f = '&finishF=' . $params['finishF'];
  }
  $flash_vars_str = "layoutId=" . $player_size['layout_id'] . "&pd_original_url=" . urlencode($protocol . $_SERVER["HTTP_HOST"] . request_uri()) . $widescreen . $finish_f;
  return array(
    "flashVars" => $flash_vars_str,
    "height" => $player_size["height"],
    "width" => $player_size["width"],
    "custom_style" => $custom_style,
    "align" => $align,
    "media_id" => $media_id,
    "js_events" => $events,
    "wid" => $wid,
    "uiconf" => $uicid,
    "roughcut" => $roughcut,
    "kshow" => $kshow,
    "swfUrl" => $swf_url,
    "div_id" => $div_id,
  );
}