public function addcommentAction()
 {
     $jsError = $this->validateVideoComment();
     $params = array();
     if (!$jsError) {
         $kmodel = KalturaModel::getInstance();
         $ks = $kmodel->getClientSideSession();
         if (!$ks) {
             $jsError = __('Failed to start new session.');
         } else {
             $params['swfUrl'] = KalturaHelpers::getContributionWizardUrl(KalturaHelpers::getOption('kcw_ui_conf_comments'));
             $params['flashVars'] = KalturaHelpers::getContributionWizardFlashVars($ks);
             $params['postId'] = $_GET['postid'];
         }
     }
     $params['jsError'] = $jsError;
     $this->renderView('front-end/add-comment.php', $params);
 }
 public function execute()
 {
     if (!current_user_can('manage_options')) {
         wp_die('Access denied');
     }
     wp_enqueue_script('kaltura-admin');
     wp_enqueue_script('kaltura-jquery-validate');
     $kalturaPartnerId = KalturaHelpers::getOption('kaltura_partner_id');
     $partnerLogin = isset($_GET['partner_login']) ? $_GET['partner_login'] : null;
     $forceRegistration = isset($_GET['force_registration']) ? $_GET['force_registration'] : null;
     if ($partnerLogin == "true") {
         $this->partnerLoginAction();
     } else {
         if (!$kalturaPartnerId || $forceRegistration) {
             $this->registerAction();
         } else {
             $this->infoAction();
         }
     }
 }
 public function updatethumbnailAction()
 {
     $entryId = isset($_GET['entryid']) ? $_GET['entryid'] : null;
     if (!$entryId) {
         wp_die(__('The video is missing or invalid.'));
     }
     $uiConfId = KalturaHelpers::getOption('thumbnail_player_ui_conf_id');
     KalturaHelpers::enqueueHtml5Lib($uiConfId);
     wp_enqueue_script('jquery');
     $kmodel = KalturaModel::getInstance();
     $ks = $kmodel->getAdminSession();
     $flashVars = array();
     $flashVars['ks'] = $ks;
     $params = array('widgetId' => '_' . KalturaHelpers::getOption("kaltura_partner_id"), 'uiConfId' => $uiConfId, 'entryId' => $entryId, 'flashVars' => $flashVars);
     $this->renderView('library/update-thumbnail.php', $params);
     $kmodel = KalturaModel::getInstance();
 }
}
?>
</ul>
<table id="kaltura-cms-login">
	<tr class="kalturaFirstRow">
		<th align="left"><?php 
_e('Partner ID');
?>
:</th>
		<td style="padding-right: 90px;"><strong><?php 
echo KalturaHelpers::getOption("kaltura_partner_id");
?>
</strong></td>
	</tr>
	<tr>
		<th align="left"><?php 
_e('KMC username');
?>
:</th>
		<td style="padding-right: 90px;"><strong><?php 
echo KalturaHelpers::getOption("kaltura_cms_user");
?>
</strong></td>
	</tr>
	<tr class="kalturaLastRow">
		<td colspan="2" align="left" style="padding-top: 10px;padding-left:10px">
			<a href="http://www.kaltura.com/index.php/kmc" target="_blank">Login</a> to the Kaltura Management Console (KMC) for advanced <br />media management<br />
			Learn more about the <a href="http://corp.kaltura.com/Products/Video-Applications/WordPress-Video-Plugin" target="_blank">new plugin features</a>
		</td>
	</tr>
</table>
 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']);
 }
    echo KalturaHelpers::getOption("kaltura_user_identifier", 'user_login') == "user_id" ? "checked=\"checked\"" : "";
    ?>
 />
						<label for="kaltura_user_identifier_user_login"><?php 
    _e("ID");
    ?>
</label>
						<br />
						<div class="user_identifier_desc">
							<?php 
    _e("This identifier was used in previous versions of Kaltura All in One WordPress plugin. Choose this option if you have upgraded from a previous version of Kaltura and want to keep the existing media content associated with the users that uploaded it.");
    ?>
						</div>

						<input type="radio" id="kaltura_user_identifier_user_id" name="kaltura_user_identifier" value="user_login" <?php 
    echo KalturaHelpers::getOption("kaltura_user_identifier", 'user_login') == "user_login" ? "checked=\"checked\"" : "";
    ?>
 />
						<label for="kaltura_user_identifier_user_id"><?php 
    _e("user_login");
    ?>
</label>
						<br />
						<div class="user_identifier_desc">
							<?php 
    _e("This identifier is a unique identifier across WordPress Multisite. Choose this option if this is a new installation of Kaltura All in one WordPress plugin.");
    ?>
						</div>
						<br />
						<br />
					</td>
 public function savePost($postId)
 {
     if (!KalturaHelpers::getOption('kaltura_save_permalink')) {
         return;
     }
     // ignore revisions
     if (wp_is_post_revision($postId)) {
         return;
     }
     try {
         $kmodel = KalturaModel::getInstance();
         $kmodel->updateEntryPermalink($postId);
     } catch (Exception $ex) {
         error_log('An error occurred while updating entry\'s permalink - ' . $ex->getMessage() . ' - ' . $ex->getTraceAsString());
     }
 }
 public function updateEntryPermalink($postId)
 {
     $metadataProfileId = KalturaHelpers::getOption('kaltura_permalink_metadata_profile_id');
     $metadataFieldsResponse = $this->getMetadataProfileFields($metadataProfileId);
     // the metadata profile should have only one field.
     if ($metadataFieldsResponse->totalCount != 1) {
         return;
     }
     $metadataField = $metadataFieldsResponse->objects[0];
     $permalink = get_permalink($postId);
     if (isset($_POST['content']) && !empty($_POST['content'])) {
         $content = $_POST['content'];
         $matches = null;
         if (preg_match_all('/entryid=\\\\"([^\\\\]*)/', $content, $matches)) {
             foreach ($matches[1] as $entryId) {
                 $this->updateEntryPermalinkMetadata($entryId, $permalink, $metadataProfileId, $metadataField->key);
             }
         }
     }
 }