function create_swfdoc($ppt_id, $video_id, $name, $path) { global $USER; $kClient = KalturaHelpers::getKalturaClient(); $real_path = $kClient->getConfig()->serviceUrl . '/index.php/extwidget/raw/entry_id/' . $ppt_id . '/p/' . $kClient->getConfig()->partnerId . '/sp/' . $kClient->getConfig()->partnerId * 100 . '/type/download/format/swf/direct_serve/1'; $entry_id = $video_id; // $path = $_SESSION[$_POST["ppt"]]; if (strpos($kClient->getConfig()->serviceUrl, 'www.kaltura.com') && strpos($path, 'www.kaltura.com')) { $real_path = str_replace('www.kaltura.com', 'cdn.kaltura.com', $real_path); } $xml = '<sync><video><entryId>' . $entry_id . '</entryId></video><slide><path>' . $real_path . '</path></slide>'; $xml .= '<times></times></sync>'; $entry = new KalturaDataEntry(); $entry->dataContent = $xml; $entry->mediaType = KalturaEntryType::DOCUMENT; $result = $kClient->data->add($entry); // Insert the entry into kaltura_entries /* $entry = new stdClass; $entry->media_type = '10'; $entry->entry_id = $result["result"]["entry"]["id"]; $entry->parent_id = $entry->entry_id; $entry->title = mysql_real_escape_string($name); $entry->user_id = $USER->id; $entry->created = time(); $newId = insert_record('kaltura_entries', $entry); */ return $result->id; }
public function loginAction() { $params['error'] = null; $params['success'] = false; if (count($_POST)) { $email = KalturaHelpers::getRequestPostParam('email'); $password = KalturaHelpers::getRequestPostParam('password'); $partnerId = KalturaHelpers::getRequestPostParam('partner_id'); $config = KalturaHelpers::getKalturaConfiguration(); $config->partnerId = $partnerId; $kmodel = KalturaModel::getInstance(); try { $partner = $kmodel->getSecrets($partnerId, $email, $password); } catch (Exception $ex) { $params['error'] = $ex->getMessage(); } if (!$params['error']) { $partnerId = $partner->id; $secret = $partner->secret; $adminSecret = $partner->adminSecret; $cmsUser = $partner->adminEmail; // save partner details update_site_option('kaltura_partner_id', $partnerId); update_site_option('kaltura_secret', $secret); update_site_option('kaltura_admin_secret', $adminSecret); update_site_option('kaltura_cms_user', $cmsUser); $params['success'] = true; } } $this->renderView('network-admin/login.php', $params); }
function check_video_status($entryId) { try { $client = KalturaHelpers::getKalturaClient(); $entry = $client->baseEntry->get($entryId); if ($entry->status == KalturaEntryStatus::READY) { echo 'y:<img src="' . KalturaHelpers::getThumbnailUrl(null, $entryId, 140, 105) . '" />'; } else { echo 'n:'; } } catch (Exception $exp) { die('e:' . $exp->getMessage()); } }
protected function validateVideoComment() { $js_error = ''; // wordpress validation code from wp-comments-post (with slight changes) $comment_author = trim(strip_tags($_GET['author'])); $comment_author_email = trim($_GET['email']); $user = wp_get_current_user(); if ($user->ID) { global $wpdb; $comment_author = $wpdb->escape($user->display_name); $comment_author_email = $wpdb->escape($user->user_email); } else { if (get_option('comment_registration')) { return __('Sorry, you must be logged in to post a comment.'); } } if (get_option('require_name_email') && !$user->ID) { if (6 > strlen($comment_author_email) || '' == $comment_author) { return __('Error: please fill the required fields (name, email).'); } elseif (!is_email($comment_author_email)) { return __('Error: please enter a valid email address.'); } } // end of wordpress validation code if (!KalturaHelpers::videoCommentsEnabled()) { return __('You do not have sufficient permissions to access this page.'); } if (!KalturaHelpers::anonymousCommentsAllowed() && !$user->ID) { return __('You must be logged in to post a comment.'); } $post_id = $_GET['postid']; if (!$post_id) { return __('Invalid post id.'); } return ''; }
function hasMobileFlavores() { try { $kaltura_client = KalturaHelpers::getKalturaClient(TRUE); $session_user = KalturaHelpers::getSessionUser(); $filter = new KalturaPermissionFilter(); // Class KalturaPermissionName don't exist in later versions of client // library, so just replace the needed property with its value. $filter->nameEqual = 'FEATURE_MOBILE_FLAVORS'; // create a permission service object $permissionService = new KalturaPermissionService($kaltura_client); $res = $permissionService->listAction($filter); if ($res->totalCount == 1) { // expected only one permission or no permissions at all if ($res->objects[0]->status == KalturaPermissionStatus::ACTIVE) { return TRUE; } } } catch (Exception $e) { watchdog_exception('kaltura', $e); } return FALSE; }
/** * get a show * @param $kalturaClient * @param $kshowId * @return unknown_type */ function getKshow($kalturaClient, $kshowId) { $sessionUser = KalturaHelpers::kalturaGetSessionUser(); $result = $kalturaClient->getKShow($sessionUser, $kshowId, true); return @$result["result"]["kshow"]; }
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()); } }
?> :</th> <td><input type="text" id="partner_id" name="partner_id" value="" size="10" /></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Email"); ?> :</th> <td><input type="text" id="email" name="email" value="" size="40" /></td> </tr> <tr valign="top"> <th scope="row"><?php _e("Password"); ?> :</th> <td><input type="password" id="password" name="password" value="" size="20" /> <a href="<?php echo KalturaHelpers::getServerUrl(); ?> /index.php/kmc">forgot password?</a></td> </tr> </table> <p class="submit" style="text-align: left; "><input type="submit" name="Submit" value="<?php _e('Complete installation'); ?> " /></p> </form> </div> <?php }
<?php require_once "../../config.php"; require_once 'lib.php'; if (isset($_POST["email"])) { try { $kClient = new KalturaClient(KalturaHelpers::getServiceConfiguration()); $ksId = $kClient->adminUser->login($_POST["email"], $_POST["password"]); $kClient->setKs($ksId); $kInfo = $kClient->partner->getInfo(); $entry = new stdClass(); $entry->plugin = "kaltura"; $entry->name = "secret"; $entry->value = $kInfo->secret; insert_record("config_plugins", $entry); $entry->name = "adminsecret"; $entry->value = $kInfo->adminSecret; insert_record("config_plugins", $entry); $entry->name = "partner_id"; $entry->value = $kInfo->id; insert_record("config_plugins", $entry); die('y:'); } catch (Exception $exp) { die('n:' . $exp->getMessage()); } } else { // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); //$meta = '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/kaltura/styles.php" />'."\n"; //$meta = '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/kaltura/css/kaltura.css" />'."\n";
<?php require_once "../../config.php"; require_once 'lib.php'; try { $kClient = new KalturaClient(KalturaHelpers::getServiceConfiguration()); $kalturaUser = KalturaHelpers::getPlatformKey("user", ""); $kalturaSecret = KalturaHelpers::getPlatformKey("secret", ""); $ksId = $kClient->session->start($kalturaSecret, $kalturaUser, KalturaSessionType::USER); $kClient->setKs($ksId); $mix = new KalturaMixEntry(); // $mix -> name = "Editable video"; $mix->name = empty($_POST["name"]) ? "Editable video" : $_POST["name"]; $mix->editorType = KalturaEditorType::ADVANCED; $mix = $kClient->mixing->add($mix); $arrEntries = explode(',', $_POST['entries']); foreach ($arrEntries as $index => $entryId) { if (!empty($entryId)) { $kClient->mixing->appendMediaEntry($mix->id, $entryId); } } echo 'y:' . $mix->id; } catch (Exception $exp) { die('n:' . $exp->getMessage()); }
function getKalturaClient($isAdmin = false, $privileges = null) { // get the configuration to use the kaltura client $kalturaConfig = KalturaHelpers::getServiceConfiguration(); $sessionUser = KalturaHelpers::getSessionUser(); if (!$privileges) { $privileges = 'edit:*'; } // inititialize the kaltura client using the above configurations $kalturaClient = new KalturaClient($kalturaConfig); // get the current logged in user // $user = KalturaHelpers::getPlatformKey("user", ""); $user = $sessionUser->userId; if ($isAdmin) { $adminSecret = KalturaHelpers::getPlatformKey("admin_secret", ""); $ksId = $kalturaClient->session->start($adminSecret, $user, KalturaSessionType::ADMIN, -1, 86400, $privileges); } else { $secret = KalturaHelpers::getPlatformKey("secret", ""); $ksId = $kalturaClient->session->start($secret, $user, KalturaSessionType::USER, -1, 86400, $privileges); } $kalturaClient->setKs($ksId); return $kalturaClient; }
<?php } ?> <?php $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'total' => $this->totalPages, 'current' => $this->page)); if ($page_links) { echo "<div class=\"kaltura-pager\">{$page_links}</div>"; } ?> <ul id="kaltura-browse"> <?php foreach ($this->result->objects as $mediaEntry) { ?> <li> <?php $sendToEditorUrl = KalturaHelpers::generateTabUrl(array("tab" => "kaltura_browse", "kaction" => "sendtoeditor", "entryIds" => array($mediaEntry->id))); ?> <div id="entryId_<?php echo $mediaEntry->id; ?> " class="showName" title="<?php _e('Click to edit'); ?> "> <?php echo $mediaEntry->name; ?> <br /> </div> <div class="thumb">
function kaltura_process_options(&$config) { global $CFG; if (!empty($config->ceurl) && !empty($config->ceadminemail) && !empty($config->cecmspass)) { try { KalturaHelpers::importCE($config->ceurl, $config->ceadminemail, $config->cecmspass, $secret, $adminSecret, $partner); $entry = new stdClass(); $entry->plugin = "kaltura"; $entry->name = "secret"; $entry->value = $secret; insert_record("config_plugins", $entry); $entry->name = "adminsecret"; $entry->value = $adminSecret; insert_record("config_plugins", $entry); $entry->name = "partner_id"; $entry->value = $partner; insert_record("config_plugins", $entry); $entry = get_record("config_plugins", "plugin", "kaltura", "name", "server_uri"); $entry->value = $config->ceurl; update_record("config_plugins", $entry); } catch (Exception $exp) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationfailed", "kaltura") . $exp->getMessage(), 5); exit; } } else { if (empty($config->username) || empty($config->email) || empty($config->phone) || empty($config->descself) || empty($config->weburl) || empty($config->adult) || empty($config->purpose) || empty($config->webcontent)) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura&err=mand", get_string("registrationfailed", "kaltura"), 5); exit; } else { if (empty($config->accpetterms)) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura&err=terms", get_string("registrationfailed", "kaltura"), 5); exit; } else { try { KalturaHelpers::register($config->username, $config->email, $secret, $adminSecret, $partner, $config->phone, $config->purpose, $CFG->version, $config->descself, $config->weburl, $config->webcontent, $config->adult == "Yes" ? true : false); $entry = new stdClass(); $entry->plugin = "kaltura"; $entry->name = "secret"; $entry->value = $secret; insert_record("config_plugins", $entry); $entry->name = "adminsecret"; $entry->value = $adminSecret; insert_record("config_plugins", $entry); $entry->name = "partner_id"; $entry->value = $partner; insert_record("config_plugins", $entry); } catch (Exception $exp) { redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationfailed", "kaltura") . $exp->getMessage(), 5); exit; } } } } redirect("{$CFG->wwwroot}/{$CFG->admin}/module.php?module=kaltura", get_string("registrationsucced", "kaltura"), 5); exit; }
<?php require_once "../../config.php"; require_once 'lib.php'; // Hide Kampyle feedback button $CFG->kampyle_hide_button = true; // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); $meta = '<link rel="stylesheet" type="text/css" href="' . $CFG->wwwroot . '/mod/kaltura/styles.php" />' . "\n"; //$meta = '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/kaltura/css/kaltura.css" />'."\n"; print_header('Kaltura Editor', '', '', '', $meta); $id = ''; if (isset($_GET['entry_id'])) { $id = $_GET['entry_id']; } if (empty($id)) { die('missing id'); } echo get_se_js_functions(KalturaHelpers::getThumbnailUrl(null, $id, 140, 105)); echo get_se_wizard("divKalturaSe", 890, 546, $id); print_footer();
function hasMobileFlavores() { $kaltura_client = KalturaHelpers::getKalturaClient(TRUE); $session_user = KalturaHelpers::getSessionUser(); $filter = new KalturaPermissionFilter(); $filter->nameEqual = KalturaPermissionName::FEATURE_MOBILE_FLAVORS; // create a permission service object $permissionService = new KalturaPermissionService($kaltura_client); $res = $permissionService->listAction($filter); if ($res->totalCount == 1) { // expected only one permission or no permissions at all if ($res->objects[0]->status == KalturaPermissionStatus::ACTIVE) { return TRUE; } } return FALSE; }
function getKalturaClient($isAdmin = false, $privileges = null) { // get the configuration to use the kaltura client $kalturaConfig = KalturaHelpers::getServiceConfiguration(); if (!$privileges) { $privileges = 'edit:*'; } // inititialize the kaltura client using the above configurations $kalturaClient = new KalturaClient($kalturaConfig); // get the current logged in user $sessionUser = KalturaHelpers::getSessionUser(); // get the variables requireed to start a session $partnerId = variable_get('kaltura_partner_id', ''); $secret = variable_get('kaltura_secret', ''); $adminSecret = variable_get('kaltura_admin_secret', ''); if ($isAdmin) { $result = $kalturaClient->session->start($adminSecret, $sessionUser->id, KalturaSessionType::ADMIN, $partnerId, 86400, $privileges); } else { $result = $kalturaClient->session->start($secret, $sessionUser->id, KalturaSessionType::USER, $partnerId, 86400, $privileges); } $len = strlen($result); /** proper method for error checking please if ($len!=116) { watchdog("kaltura", $result ); return null; }else{ */ // set the session so we can use other service methods $kalturaClient->setKs($result); //} return $kalturaClient; }
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']); }
} ?> </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 function infoAction() { $params = array(); $params['error'] = null; $params['showMessage'] = false; if (count($_POST)) { $enableVideoComments = KalturaHelpers::getRequestPostParam('enable_video_comments') ? true : false; $allowAnonymousComments = KalturaHelpers::getRequestPostParam('allow_anonymous_comments') ? true : false; $defaultPlayerType = KalturaHelpers::getRequestPostParam('default_player_type'); $commentsPlayerType = KalturaHelpers::getRequestPostParam('comments_player_type'); $userIdentifier = KalturaHelpers::getRequestPostParam('kaltura_user_identifier'); $permalinkMetadataProfileId = KalturaHelpers::getRequestPostParam('permalink_metadata_profile_id'); $savePermalink = KalturaHelpers::getRequestPostParam('save_permalink'); update_option('kaltura_enable_video_comments', $enableVideoComments); update_option('kaltura_allow_anonymous_comments', $allowAnonymousComments); update_option('kaltura_default_player_type', $defaultPlayerType); update_option('kaltura_comments_player_type', $commentsPlayerType); update_option('kaltura_user_identifier', $userIdentifier); update_option('kaltura_permalink_metadata_profile_id', $permalinkMetadataProfileId); update_option('kaltura_save_permalink', $savePermalink); $params['showMessage'] = true; } else { $kmodel = KalturaModel::getInstance(); try { $kmodel->pingTest(); } catch (Kaltura_Client_Exception $ex) { $params['error'] = $ex->getMessage() . ' - ' . $ex->getCode(); } } $kmodel = KalturaModel::getInstance(); $players = $kmodel->listPlayersUiConfs(); $metadataProfilesResponse = $kmodel->getMetadataProfilesTypeEntry(); $params['players'] = $players; $params['metadataProfilesResponse'] = $metadataProfilesResponse; $this->renderView('admin/info.php', $params); }
function sendToEditor(entryIds, ignoreStatus) { if (!entryIds) { entryIds = getSelectedIds(); } if (entryIds.length == 0) { alert('<?php _e('Please select at least one item'); ?> '); return; } var url = "<?php echo KalturaHelpers::generateTabUrl(array("tab" => "kaltura_upload", "kaction" => "sendtoeditor", "firstedit" => "true")); ?> "; var entryIdsParams = '&entryIds[]='; entryIdsParams += entryIds.join('&entryIds[]='); url += entryIdsParams; window.location.href = url; } function refreshButtonsState() { if (jQuery('ul li input[type=checkbox]:checked').size() == 0) { jQuery('.options a').attr('disabled', true); } else { jQuery('.options a').removeAttr('disabled');
function calculatePlayerHeight($type, $width) { $player = KalturaHelpers::getPlayerByType($type); $aspectRatio = @$player["videoAspectRatio"] ? $player["videoAspectRatio"] : "4:3"; $hSpacer = @$player["horizontalSpacer"] ? $player["horizontalSpacer"] : 0; $vSpacer = @$player["verticalSpacer"] ? $player["verticalSpacer"] : 0; switch ($aspectRatio) { case "4:3": $screenHeight = ($width - $hSpacer) / 4 * 3; $height = $screenHeight + $vSpacer; break; case "16:9": $screenHeight = ($width - $hSpacer) / 16 * 9; $height = $screenHeight + $vSpacer; break; } return round($height); }
function setup_elements(&$mform) { global $CFG, $RESOURCE_WINDOW_OPTIONS; if (KalturaHelpers::getPlatformKey("partner_id", "none") == "none") { // $basic = get_string('needreg', 'kaltura'); // $str = str_replace("##SERVER##", $CFG->wwwroot . "/admin/settings.php?section=modsettingkaltura", $basic); // $mform->addElement('static', 'pleasereg',$str, ''); redirect($CFG->wwwroot . "/admin/module.php?module=kaltura"); die; // return; } if (isset($_GET['update'])) { $item_id = $_GET['update']; $result = get_record('course_modules', 'id', $item_id); $result = get_record('resource', 'id', $result->instance); $entry = get_record('kaltura_entries', 'context', "R_" . "{$result->id}"); $default_entry = $entry; } else { $last_entry_id = get_field('kaltura_entries', 'max(id)', 'id', 'id'); if (!empty($last_entry_id)) { $default_entry = get_record('kaltura_entries', 'id', "{$last_entry_id}"); $default_entry->title = ""; } else { $default_entry = new kaltura_entry(); } } $hidden_alltext = new HTML_QuickForm_hidden('alltext', $default_entry->dimensions, array('id' => 'id_alltext')); $mform->addElement($hidden_alltext); $hidden_popup = new HTML_QuickForm_hidden('popup', '', array('id' => 'id_popup')); $mform->addElement($hidden_popup); $hidden_dimensions = new HTML_QuickForm_hidden('dimensions', $default_entry->dimensions, array('id' => 'id_dimensions')); $mform->addElement($hidden_dimensions); $hidden_size = new HTML_QuickForm_hidden('size', $default_entry->size, array('id' => 'id_size')); $mform->addElement($hidden_size); $hidden_custom_width = new HTML_QuickForm_hidden('custom_width', $default_entry->custom_width, array('id' => 'id_custom_width')); $mform->addElement($hidden_custom_width); $hidden_design = new HTML_QuickForm_hidden('design', $default_entry->design, array('id' => 'id_design')); $mform->addElement($hidden_design); $hidden_title = new HTML_QuickForm_hidden('title', $default_entry->title, array('id' => 'id_title')); $mform->addElement($hidden_title); $hidden_entry_type = new HTML_QuickForm_hidden('entry_type', $default_entry->entry_type, array('id' => 'id_entry_type')); $mform->addElement($hidden_entry_type); $text_video = new HTML_QuickForm_static('video_text', null, '<span id="spanExplain"><table style="width:100%;font-size:9px;"><tr><td width="25%">' . get_string('videotext', 'resource_kalturavideo') . '</td><td style="width:40%;padding-left:25px;">' . get_string('videoremixtext', 'resource_kalturavideo') . '</td><td width="35%"> </td></tr></table></span>'); // $text_video_remix = new HTML_QuickForm_static('video_text_remix',null, 'bbb'); $button = new HTML_QuickForm_input(); $button->setName('addvid'); $button->setType('button'); $button->setValue('Add Video'); $button_editable = new HTML_QuickForm_input(); $button_editable->setName('addeditvid'); $button_editable->setType('button'); $button_editable->setValue('Add Editable Video'); $button_replace = new HTML_QuickForm_input(); $button_replace->setName('replacevid'); $button_replace->setType('button'); $button_replace->setValue('Replace Video'); $button_preview = new HTML_QuickForm_input(); $button_preview->setName('previewvid'); $button_preview->setType('button'); $button_preview->setValue('Preview Video'); $button_preview_edit = new HTML_QuickForm_input(); $button_preview_edit->setName('previeweditvid'); $button_preview_edit->setType('button'); $button_preview_edit->setValue('Preview & Edit Video'); $videolabel = get_string('addvideo', 'resource_kalturavideo'); $videoeditablelabel = get_string('editablevideo', 'resource_kalturavideo'); $replacelabel = get_string('replacevideo', 'resource_kalturavideo'); $previewlabel = get_string('previewvideo', 'resource_kalturavideo'); $previeweditlabel = get_string('previeweditvideo', 'resource_kalturavideo'); $cw_url = $CFG->wwwroot . '/mod/kaltura/kcw.php?'; $cw_url_init = $cw_url; $edit_url = $CFG->wwwroot . '/mod/kaltura/keditor.php?'; $edit_url_init = $edit_url; $preview_url = $CFG->wwwroot . '/mod/kaltura/kpreview.php?'; $preview_url_init = $preview_url; if (!empty($entry)) { $cw_url_init .= 'id=' . $entry->id; $preview_url_init .= 'entry_id=' . $entry->entry_id . '&design=' . $entry->design . '&width=' . get_width($entry) . '&dimensions=' . $entry->dimensions; $edit_url_init .= 'entry_id=' . $entry->entry_id; } $button_attributes = array('type' => 'button', 'onclick' => 'set_entry_type(' . KalturaEntryType::MEDIA_CLIP . ');kalturaInitModalBox(\'' . $cw_url_init . '&upload_type=video' . '\', {width:760, height:422});', 'id' => 'id_addvideo', 'value' => $videolabel, 'style' => empty($entry) ? 'display:inline' : 'display:none'); $button_attributes_editable = array('type' => 'button', 'onclick' => 'set_entry_type(' . KalturaEntryType::MIX . ');kalturaInitModalBox(\'' . $cw_url_init . '&upload_type=mix' . '\', {width:760, height:422});', 'id' => 'id_addeditablevideo', 'value' => $videoeditablelabel, 'style' => empty($entry) ? 'display:inline;margin-left:90px;' : 'display:none'); $button_attributes_replace = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $cw_url_init . (empty($entry) ? '' : ($entry->entry_type == KalturaEntryType::MEDIA_CLIP ? '&upload_type=video' : '&upload_type=mix')) . '\', {width:760, height:422});', 'id' => 'id_replace', 'value' => $replacelabel, 'style' => empty($entry) ? 'display:none' : 'display:inline'); $button_attributes_preview = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $preview_url_init . '\', ' . (empty($entry) ? '{width:400, height:382}' : '{width:' . get_width($entry) . ', height:' . (get_height($entry) + 50) . '}') . ');', 'id' => 'id_preview', 'value' => $previewlabel, 'style' => empty($entry) || $entry->entry_type != KalturaEntryType::MEDIA_CLIP ? 'display:none' : 'display:inline'); $button_attributes_preview_edit = array('type' => 'button', 'onclick' => 'kalturaInitModalBox(\'' . $edit_url_init . '\', {width:890, height:546});', 'id' => 'id_preview_edit', 'value' => $previeweditlabel, 'style' => empty($entry) || $entry->entry_type != KalturaEntryType::MIX ? 'display:none' : 'display:inline'); $resource = $this->resource; $thumbnail = ""; if (isset($_GET['update'])) { if (!empty($entry)) { $thumbnail = '<img id="id_thumb" src="' . KalturaHelpers::getThumbnailUrl(null, $entry->entry_id, 140, 105) . '" />'; // $mform->addElement('static', 'video_thumb', get_string('video', 'resource_kalturavideo'), $thumbnail); } } $button->setAttributes($button_attributes); $button_editable->setAttributes($button_attributes_editable); $button_replace->setAttributes($button_attributes_replace); $button_preview->setAttributes($button_attributes_preview); $button_preview_edit->setAttributes($button_attributes_preview_edit); $objs = array(); $objs[] =& $button; $objs[] =& $button_editable; $objs[] =& $button_replace; $objs[] =& $button_preview; $objs[] =& $button_preview_edit; $text_objs = array(); $text_objs[] = $text_video; $divWait = '<div style="border:1px solid #bcbab4;background-color:#f5f1e9;width:140px;height:105px;float:left;text-align:center;;font-size:85%;display:' . (empty($thumbnail) ? 'none' : 'inline') . '" id="divWait">' . $thumbnail . '</div> <script type="text/javascript"> function set_entry_type(type) { document.getElementById("id_entry_type").value = type; } function get_height() { if (get_field("id_dimensions") == "' . KalturaAspectRatioType::ASPECT_4_3 . '") { switch(get_field("id_size")) { case "' . KalturaPlayerSize::LARGE . '": return 445; break; case "' . KalturaPlayerSize::SMALL . '": return 340; break; case "' . KalturaPlayerSize::CUSTOM . '": return parseInt(get_field("id_custom_width"))*3/4 + 65 + 80; break; default: return 445; break; } } else { switch(get_field("id_size")) { case "' . KalturaPlayerSize::LARGE . '": return 370; break; case "' . KalturaPlayerSize::SMALL . '": return 291; break; case "' . KalturaPlayerSize::CUSTOM . '": return parseInt(get_field("id_custom_width"))*9/16 + 65 + 80; break; default: return 370; break; } } } function get_width() { switch(get_field("id_size")) { case "' . KalturaPlayerSize::LARGE . '": return 450; break; case "' . KalturaPlayerSize::SMALL . '": return 310; break; case "' . KalturaPlayerSize::CUSTOM . '": return parseInt(get_field("id_custom_width")) + 50; break; default: return 450; break; } } function do_on_wait() { var entryId = document.getElementById("id_alltext").value; document.getElementById("id_addvideo").style.display="none"; document.getElementById("id_addeditablevideo").style.display="none"; document.getElementById("id_replace").style.display="inline"; if (document.getElementById("spanExplain") != null) { document.getElementById("spanExplain").style.display = "none"; } if (document.getElementById("id_entry_type").value == ' . KalturaEntryType::MEDIA_CLIP . ') { var design = get_field("id_design"); var width = get_width(); var dimensions = get_field("id_dimensions"); document.getElementById("id_preview").style.display="inline"; // document.getElementById("id_preview").onclick=new Function("kalturaInitModalBox(\'' . $preview_url . 'entry_id=" + entryId + "\', {width:400, height:382})"); document.getElementById("id_preview").onclick=new Function("kalturaInitModalBox(\'' . $preview_url . 'entry_id=" + entryId + "&design=" + design + "&width=" + width + "&dimensions=" + dimensions + "\', {width:get_width(), height:get_height()})"); //width:get_width()+10 } else { document.getElementById("id_preview_edit").style.display="inline"; document.getElementById("id_preview_edit").onclick=new Function("kalturaInitModalBox(\'' . $edit_url . 'entry_id=" + entryId + "\', {width:890, height:546})"); document.getElementById("id_replace").onclick=new Function("kalturaInitModalBox(\'' . $cw_url . '&upload_type=mix\', {width:760, height:422})"); } } </script>'; $mform->addElement('static', 'divWait', '', get_wait_image("divWait", "id_alltext")); $mform->addElement('static', 'please_wait', empty($entry) ? '' : get_string('video', 'resource_kalturavideo'), $divWait); $mform->addElement('group', 'videogroup', empty($entry) ? get_string('video', 'resource_kalturavideo') : '', $objs); if (!isset($_GET['update'])) { $mform->addElement('group', 'videotextgroup', '', $text_objs); } $mform->addElement('header', 'displaysettings', get_string('display', 'resource')); return; }
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(); }
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 commentPost($comment_id, $approved) { if ($approved) { global $kaltura_comment_id; $kaltura_comment_id = $comment_id; $comment = get_comment($comment_id); KalturaHelpers::runKalturaShortcode($comment->comment_content, $this->callback('findCommentWidgets')); } }
function getKalturaClient($isAdmin = false, $privileges = null) { // get the configuration to use the kaltura client $kalturaConfig = KalturaHelpers::getServiceConfiguration(); if (!$privileges) { $privileges = 'edit:*'; } // inititialize the kaltura client using the above configurations $kalturaClient = new KalturaClient($kalturaConfig); // get the current logged in user $sessionUser = KalturaHelpers::getSessionUser(); if ($isAdmin) { $adminSecret = variable_get("kaltura_admin_secret", ""); $result = $kalturaClient->startSession($sessionUser, $adminSecret, true, $privileges); } else { $secret = variable_get("kaltura_secret", ""); $result = $kalturaClient->startSession($sessionUser, $secret, false, $privileges); } if (count(@$result["error"])) { watchdog("kaltura", $result["error"][0]["code"] . " - " . $result["error"][0]["desc"]); return null; } else { // now lets get the session key $session = $result["result"]["ks"]; // set the session so we can use other service methods $kalturaClient->setKs($session); } return $kalturaClient; }
<?php KalturaHelpers::protectView($this); ?> <style> html.wp-toolbar { margin: 0; padding: 0; } </style>
function setup_elements(&$mform) { global $CFG, $RESOURCE_WINDOW_OPTIONS; $isNew = true; if (KalturaHelpers::getPlatformKey("partner_id", "none") == "none") { // $basic = get_string('needreg', 'kaltura'); // $str = str_replace("##SERVER##", $CFG->wwwroot . "/admin/settings.php?section=modsettingkaltura", $basic); // $mform->addElement('static', 'pleasereg',$str, ''); redirect($CFG->wwwroot . "/admin/module.php?module=kaltura"); die; // return; } if (isset($_GET['update'])) { $isNew = false; $item_id = $_GET['update']; $result = get_record('course_modules', 'id', $item_id); $result = get_record('resource', 'id', $result->instance); $entry = get_record('kaltura_entries', 'context', "R_" . "{$result->id}"); $default_entry = $entry; $url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?entry_id=' . $entry->entry_id . '&context=' . $this->course->id; $editSyncButton = '<button onclick="kalturaInitModalBox(\'' . $url . '\', {width:780, height:400});return false;">' . get_string('editsyncpoints', 'kaltura') . '</button>'; $mform->addElement('static', 'edit_sync', get_string('editsyncpoints', 'kaltura'), $editSyncButton); } else { $last_entry_id = get_field('kaltura_entries', 'max(id)', 'id', 'id'); if (!empty($last_entry_id)) { $default_entry = get_record('kaltura_entries', 'id', "{$last_entry_id}"); $default_entry->title = ""; } else { $default_entry = new kaltura_entry(); } } $hidden_alltext = new HTML_QuickForm_hidden('alltext', $default_entry->dimensions, array('id' => 'id_alltext')); $mform->addElement($hidden_alltext); $hidden_popup = new HTML_QuickForm_hidden('popup', '', array('id' => 'id_popup')); $mform->addElement($hidden_popup); $hidden_dimensions = new HTML_QuickForm_hidden('dimensions', $default_entry->dimensions, array('id' => 'id_dimensions')); $mform->addElement($hidden_dimensions); $hidden_size = new HTML_QuickForm_hidden('size', $default_entry->size, array('id' => 'id_size')); $mform->addElement($hidden_size); $hidden_custom_width = new HTML_QuickForm_hidden('custom_width', $default_entry->custom_width, array('id' => 'id_custom_width')); $mform->addElement($hidden_custom_width); $hidden_design = new HTML_QuickForm_hidden('design', $default_entry->design, array('id' => 'id_design')); $mform->addElement($hidden_design); $hidden_title = new HTML_QuickForm_hidden('title', $default_entry->title, array('id' => 'id_title')); $mform->addElement($hidden_title); $hidden_entry_type = new HTML_QuickForm_hidden('entry_type', $default_entry->entry_type, array('id' => 'id_entry_type')); $mform->addElement($hidden_entry_type); $hidden_ppt = new HTML_QuickForm_hidden('ppt_input', $ppt_id, array('id' => 'id_ppt_input')); $mform->addElement($hidden_ppt); $hidden_video = new HTML_QuickForm_hidden('video_input', $video_id, array('id' => 'id_video_input')); $mform->addElement($hidden_video); $hidden_ppt_dnld = new HTML_QuickForm_hidden('ppt_dnld_url', $dnld_url, array('id' => 'id_ppt_dnld_url')); $mform->addElement($hidden_ppt_dnld); $cw_url = $CFG->wwwroot . '/mod/kaltura/kcw.php?mod=ppt_resource'; $resource = $this->resource; $kaltura_client = KalturaHelpers::getKalturaClient(); $thumbnail = ""; $ppt_id = $video_id = $dnld_url = ''; $vid_thumb = ''; $has_ppt = $has_video = '0'; if ($isNew) { $uploader = '<div id="swfdoc_section"> <div style="border:1px solid #bcbab4;background-color:#f5f1e9;width:140px;height:105px;float:left;margin-right:80px;text-align:center;font-size:85%" id="thumb_video_holder"> ' . $vid_thumb . ' </div> <div style="border:1px solid #bcbab4;background-color:#f5f1e9;width:140px;height:105px;float:left;text-align:center;font-size:85%" id="thumb_doc_holder">' . $ppt_thumb . ' </div><br/> <div style="width:140px;float:left;margin-right:80px;text-align:center;margin-top:10px;"> <input type="button" id="btn_selectvideo" value="' . get_string("selectvideo", "resource_kalturaswfdoc") . '" onclick="kalturaInitModalBox(\'' . $cw_url . '\', {width:760, height:422});return false;"> </div> <div id="flashContainer" style="width:140px;float:left;text-align:center;margin-top:10px;"> <script> pptIdHolder = document.getElementById("id_ppt_input"); pptThumbHolder = document.getElementById("thumb_doc_holder"); videoIdHolder = document.getElementById("id_video_input"); videoThumbHolder = document.getElementById("thumb_video_holder"); pptDnldUrlHolder = document.getElementById("id_ppt_dnld_url"); var has_ppt = ' . $has_ppt . '; var has_video = ' . $has_video . '; $("document").ready(function(){ if(has_ppt && has_video) document.getElementById("sync_btn").disabled = false; }); txt_document = "<br/>The Document is now being converted.<br/><br/><a href=\\"javascript:check_ready(\'ppt\')\\">Click here</a> to check if conversion is done"; function check_ready(theType){ if (theType == "ppt") { theId = pptIdHolder.value; theThumb = pptThumbHolder; theUrl = pptDnldUrlHolder.value; } var ksoa = new SWFObject("' . $CFG->wwwroot . '/mod/kaltura/images/Pleasewait.swf", "kwait", "140", "105", "9", "#ffffff"); ksoa.addParam("allowScriptAccess", "always"); ksoa.addParam("allowFullScreen", "TRUE"); ksoa.addParam("allowNetworking", "all"); ksoa.addParam("wmode","transparent"); if(ksoa.installedVer.major >= 9) { ksoa.write("thumb_doc_holder"); } $.ajax({ type: "POST", url: "' . $CFG->wwwroot . '/mod/kaltura/kcheck_status.php", data: "type=ppt&downloadUrl="+theUrl, success: function(msg){ if (msg == "200") { if (theType != "ppt") { theThumb.innerHTML = "<img src=\\"' . $kaltura_cdn_url . '/p/' . $CFG->kaltura_partner_id . '/sp/' . $CFG->kaltura_subp_id . '/thumbnail/entry_id/"+theId+"/width/140/height/105/type/3/bgcolor/ffffff\\">"; has_video = 1; if (has_ppt) { document.getElementById("sync_btn").disabled = false; } } else { theThumb.innerHTML = "<img src=\\"' . $CFG->wwwroot . '/mod/kaltura/images/V_ico.png\\" style=\\"margin:12px;\\">"; has_ppt = 1; if (has_video) { document.getElementById("sync_btn").disabled = false; } } } else { document.getElementById("thumb_doc_holder").innerHTML = txt_document; } } }); } var has_swfdoc = false; function set_has_swfdoc(val) { has_swfdoc = val; } function create_swfdoc(){ if (has_swfdoc) { entry_id = document.getElementById("id_alltext").value; url = "' . $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?entry_id=" + entry_id + "&context=' . $this->course->id . '"; kalturaInitModalBox(url, {width:780, height:400}); } else { $.ajax({ type: "POST", url: "' . $CFG->wwwroot . '/mod/kaltura/kcreate.php", data: "action=swfdoc&ppt=" + document.getElementById("id_ppt_input").value + "&video=" + document.getElementById("id_video_input").value + "&name=" + document.getElementById("id_name").value + "&downloadUrl="+pptDnldUrlHolder.value, success: function(entry_id){ if (entry_id){ set_has_swfdoc(true); document.getElementById("id_alltext").value = entry_id; url = "' . $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?entry_id=" + entry_id + "&context=' . $this->course->id . '"; kalturaInitModalBox(url, {width:780, height:400}); } } }); } } function user_selected() { document.getElementById("uploader").upload(); } function uploaded() { document.getElementById("uploader").addEntries(); } function uploading(){ has_ppt = 0; var ksoa = new SWFObject("' . $CFG->wwwroot . '/mod/kaltura/images/Pleasewait.swf", "kwait", "140", "105", "9", "#ffffff"); ksoa.addParam("allowScriptAccess", "always"); ksoa.addParam("allowFullScreen", "TRUE"); ksoa.addParam("allowNetworking", "all"); ksoa.addParam("wmode","transparent"); if(ksoa.installedVer.major >= 9) { ksoa.write("thumb_doc_holder"); } } function entries_added(obj) { document.getElementById("thumb_doc_holder").innerHTML = txt_document; myobj = obj[0]; document.getElementById("id_ppt_input").value = myobj.entryId; $.ajax({ type: "POST", url: "' . $CFG->wwwroot . '/mod/kaltura/kcreate.php", data: "action=ppt&ppt=" + document.getElementById("id_ppt_input").value, success: function(url){ if( url.substring(0,2) == "y:") { pptDnldUrlHolder.value = url.substring(2); } } }); document.getElementById("uploader").removeFiles(0,0); } delegate = { selectHandler: user_selected, progressHandler: uploading, allUploadsCompleteHandler: uploaded, entriesAddedHandler: entries_added }; </script> <span><input type="button" id="btn_uploaddoc" value="' . get_string("uploaddocument", "resource_kalturaswfdoc") . '."> <span style="border: 0px solid black; position: relative; top: -20px; width: 110px;" id="divKalturaKupload"> <script type="text/javascript"> var kso = new SWFObject("' . $kaltura_client->getConfig()->serviceUrl . '/kupload/ui_conf_id/1002613", "uploader", "110", "25", "9", "#ffffff"); kso.addParam("flashVars", "ks=' . $kaltura_client->getKs() . '&uid=' . $USER->id . '&partnerId=' . $CFG->kaltura_partner_id . '&subPId=' . $CFG->kaltura_subp_id . '&entryId=-2&conversionProfile=5&maxUploads=10&maxFileSize=128&maxTotalSize=200&uiConfId=1002613&jsDelegate=delegate"); kso.addParam("allowScriptAccess", "always"); kso.addParam("allowFullScreen", "TRUE"); kso.addParam("allowNetworking", "all"); kso.addParam("wmode","transparent"); if(kso.installedVer.major >= 9) { kso.write("divKalturaKupload"); } else { document.getElementById("divKalturaKupload").innerHTML = "Flash player version 9 and above is required. <a href=\\"http://get.adobe.com/flashplayer/\\">Upgrade your flash version</a>"; } function do_on_wait() { has_video = 1; if(has_ppt && has_video) document.getElementById("sync_btn").disabled = false; } </script> </span></span> </div> <script> function save_sync() { create_swfdoc(); document.getElementById("btn_uploaddoc").disabled = true; document.getElementById("btn_selectvideo").disabled = true; document.getElementById("divKalturaKupload").innerHTML = ""; } </script> <div style="clear:both;text-align:center;width:370px;padding-top:20px;margin:0 auto;margin-left:-10px">' . get_string('syncdescription', 'resource_kalturaswfdoc') . '</div> <div style="clear:both;text-align:center;width:370px;padding-top:20px"><input type="button" id="sync_btn" onclick="save_sync()" value="' . get_string('syncpoints', 'kaltura') . '" DISABLED></div> </div>'; $mform->addElement('static', 'divWait', '', get_wait_image("thumb_video_holder", "id_video_input")); $mform->addElement('static', 'ppt_thing', '', $uploader); } $mform->addElement('header', 'displaysettings', get_string('display', 'resource')); }
$post = get_post($post_id); ?> <?php $comment = get_comment($comment_id); ?> <li> <div class="thumb"> <a href="<?php echo get_permalink($post_id); ?> #comment-<?php echo $comment_id; ?> "> <img src="<?php echo KalturaHelpers::getThumbnailUrl($widget["id"], $widget["entry_id"], 120, 90, null); ?> " width="120" height="90" /> </a> </div> Reply to <a href="<?php echo get_permalink($post_id); ?> "><?php echo $post->post_title; ?> </a><br /> <?php echo $comment->comment_author . ", " . mysql2date("M j", $comment->comment_date); ?> </li>
{ jQuery("#playerCustomWidth").css("background-color", "red"); return false; } } return true; }); jQuery.kalturaPlayerSelector({ url: ajaxurl+'?action=kaltura_ajax&kaction=getplayers', defaultId: '<?php echo get_option("kaltura_default_player_type", $KALTURA_DEFAULT_PLAYERS[0]['id']); ?> ', swfBaseUrl: '<?php echo KalturaHelpers::getSwfUrlForWidget(); ?> ', previewId: 'divKalturaPlayer', entryId: '<?php echo $this->entry->id; ?> ', playersList: '#uiConfId', dimensions: 'input[name=playerRatio]', submit: 'input[name=sendToEditorButton]', onSelect: function() { fixHeight(); } });