public function shortcodeHandler($attrs) { // prevent xss foreach ($attrs as $key => $value) { $attrs[$key] = esc_js($value); } if (!isset($attrs['entryid'])) { return ''; } // get the embed options from the attributes $embedOptions = KalturaHelpers::getEmbedOptions($attrs); $isComment = isset($attrs['size']) && $attrs['size'] == 'comments' ? true : false; $wid = $embedOptions['wid'] ? $embedOptions['wid'] : '_' . KalturaHelpers::getOption('kaltura_partner_id'); $entryId = $embedOptions['entryId']; $width = $embedOptions['width']; $height = $embedOptions['height']; $randId = md5($wid . $entryId . rand(0, time())); $divId = 'kaltura_wrapper_' . $randId; $thumbnailDivId = 'kaltura_thumbnail_' . $randId; $playerId = 'kaltura_player_' . $randId; $link = ''; $link .= '<a href="http://corp.kaltura.com/Products/Features/Video-Management">Video Management</a>, '; $link .= '<a href="http://corp.kaltura.com/Products/Features/Video-Hosting">Video Hosting</a>, '; $link .= '<a href="http://corp.kaltura.com/Products/Features/Video-Streaming">Video Streaming</a>, '; $link .= '<a href="http://corp.kaltura.com/products/video-platform-features">Video Platform</a>'; $html = '<script src="' . KalturaHelpers::getServerUrl() . '/p/' . KalturaHelpers::getOption("kaltura_partner_id") . '/sp/' . KalturaHelpers::getOption("kaltura_partner_id") . '00/embedIframeJs/uiconf_id/' . $embedOptions['uiconfid'] . '/partner_id/' . KalturaHelpers::getOption("kaltura_partner_id") . '"></script>'; $poweredByBox = '<div class="kaltura-powered-by" style="width: ' . $embedOptions["width"] . 'px; "><div><a href="http://corp.kaltura.com/Products/Features/Video-Player" target="_blank">Video Player</a> by <a href="http://corp.kaltura.com/" target="_blank">Kaltura</a></div></div>'; if ($isComment) { $embedOptions['flashVars'] .= '"autoPlay":"true",'; $html .= ' <div id="' . $thumbnailDivId . '" style="width:' . $width . 'px;height:' . $height . 'px;">' . $link . '</div> <script> kWidget.thumbEmbed({ "targetId": "' . $thumbnailDivId . '", "wid": "' . $wid . '", "uiconf_id": "' . $embedOptions['uiconfid'] . '", "flashvars": {' . $embedOptions["flashVars"] . '}, "entry_id": "' . $entryId . '" }); </script> '; } else { $style = ''; $style .= 'width:' . $width . 'px;'; $style .= 'height:' . ($height + 10) . 'px;'; // + 10 is for the powered by div if (isset($embedOptions['align'])) { $style .= 'float:' . $embedOptions['align'] . ';'; } // append the manual style properties if (isset($embedOptions['style'])) { $style .= $embedOptions['style']; } $html .= ' <div id="' . $playerId . '_wrapper" class="kaltura-player-wrapper"><div id="' . $playerId . '" style="' . $style . '">' . $link . '</div>' . $poweredByBox . '</div> <script> kWidget.embed({ "targetId": "' . $playerId . '", "wid": "' . $wid . '", "uiconf_id": "' . $embedOptions['uiconfid'] . '", "flashvars": {' . $embedOptions['flashVars'] . '}, "entry_id": "' . $entryId . '" });'; //$html .= 'alert(document.getElementById("'.$playerId.'_wrapper").innerHTML);jQuery("#'.$playerId.'_wrapper").append("'.str_replace("\"", "\\\"", $powerdByBox).'");'; $html .= '</script>'; } return $html; }