public function sendtoeditorAction()
 {
     wp_enqueue_style('media');
     wp_enqueue_script('kaltura-player-selector');
     $entryIds = isset($_GET['entryIds']) ? $_GET['entryIds'] : array();
     $entryId = null;
     if (is_array($entryIds) && count($entryIds) > 0) {
         $entryId = $entryIds[0];
     }
     if (is_null($entryId)) {
         wp_die('No entry specified');
     }
     if (!count($_POST)) {
         $kmodel = KalturaModel::getInstance();
         $entry = $kmodel->getEntry($entryId);
         $clientSideSession = $kmodel->getClientSideSession();
         $flashVars = KalturaHelpers::getKalturaPlayerFlashVars(null, $clientSideSession, $entryId);
         $thumbnail = KalturaHelpers::getPluginUrl() . '/thumbnails/get_preview_thumbnail.php?thumbnail_url=' . $entry->thumbnailUrl;
         $params['entry'] = $entry;
         $params['entryId'] = $entryId;
         $params['nextEntryIds'] = $entryIds;
         $params['flashVars'] = $flashVars;
         $params['flashVars']['autoPlay'] = 'true';
         $params['thumbnailPlaceHolderUrl'] = $thumbnail;
     } else {
         // update the entry name
         $kmodel = KalturaModel::getInstance();
         $baseEntry = new Kaltura_Client_Type_BaseEntry();
         $baseEntry->name = $_POST['ktitle'];
         $kmodel->updateBaseEntry($entryId, $baseEntry);
         array_shift($entryIds);
         // done with 1 entry, maybe we have more
         $width = $_POST['playerWidth'];
         $uiConfId = $_POST['uiConfId'];
         $playerRatio = $_POST['playerRatio'];
         $params['entryId'] = $entryId;
         $params['nextEntryIds'] = $entryIds;
         $params['playerWidth'] = $width;
         $params['playerHeight'] = KalturaHelpers::calculatePlayerHeight($uiConfId, $width, $playerRatio);
         $params['uiConfId'] = $uiConfId;
     }
     $this->renderView('library/send-to-editor.php', $params);
 }
 public static function getEmbedOptions($params)
 {
     // make sure that all keys exists in the array so we won't need to check with isset() for every array access
     $arrayKeys = array('size', 'width', 'height', 'uiconfid', 'align', 'wid', 'entryid', 'style');
     foreach ($arrayKeys as $key) {
         if (!isset($params[$key])) {
             $params[$key] = null;
         }
     }
     if ($params['size'] == 'comments') {
         $type = KalturaHelpers::getOption('kaltura_comments_player_type');
         $params['uiconfid'] = $type;
         $params['width'] = 250;
         $params['height'] = 244;
     } else {
         // backward compatibility
         switch ($params['size']) {
             case 'large':
                 $params['width'] = 410;
                 $params['height'] = 364;
                 break;
             case 'small':
                 $params['width'] = 250;
                 $params['height'] = 244;
                 break;
         }
         // if width is missing set some default
         if (!$params['width']) {
             $params['width'] = 400;
         }
         // if height is missing, recalculate it
         if (!$params['height']) {
             $params['height'] = KalturaHelpers::calculatePlayerHeight($params['uiconfid'], $params['width']);
         }
     }
     // align
     switch ($params['align']) {
         case 'r':
         case 'right':
             $align = 'right';
             break;
         case 'm':
         case 'center':
             $align = 'center';
             break;
         case 'l':
         case 'left':
             $align = 'left';
             break;
         default:
             $align = '';
     }
     if ($_SERVER['SERVER_PORT'] == 443) {
         $protocol = 'https://';
     } else {
         $protocol = 'http://';
     }
     $flashVarsStr = '';
     return array('flashVars' => $flashVarsStr, 'height' => $params['height'], 'width' => $params['width'], 'align' => $align, 'style' => $params['style'], 'wid' => $params['wid'], 'entryId' => $params['entryid'], 'uiconfid' => $params['uiconfid']);
 }