private function getAutoEmbedCode()
 {
     $o = '';
     // Get the kWidget call ( pass along iframe payload path )
     $p = $this->getResultObject()->urlParameters;
     // Check required params:
     if (!isset($p['wid'])) {
         $this->setError("missing wid param");
         return '';
     }
     $wid = htmlspecialchars($p['wid']);
     if (!isset($p['uiconf_id'])) {
         $this->setError("missing uiconf_id param");
         return '';
     }
     $uiconf_id = htmlspecialchars($p['uiconf_id']);
     if (!isset($p['playerId'])) {
         $this->setError("missing playerId param");
         return '';
     }
     $playerId = $p['playerId'];
     // Check optional params
     $width = isset($p['width']) ? htmlspecialchars($p['width']) : 400;
     $height = isset($p['height']) ? htmlspecialchars($p['height']) : 330;
     // Get the iframe payload
     $kIframe = new kalturaIframeClass();
     // get the kIframe
     $json = array('content' => $kIframe->getIFramePageOutput());
     $o .= "kWidget.iframeAutoEmbedCache[ '{$playerId}' ] = " . json_encode($json) . ";\n";
     $o .= "document.write( '<div id=\"{$playerId}\" style=\"width:{$width}px;height:{$height}px\"></div>' );\n";
     $o .= "kWidget.embed( '{$playerId}', { \n" . "\t'wid': '{$wid}', \n" . "\t'uiconf_id' : '{$uiconf_id}'";
     // conditionally add in the entry id: ( no entry id in playlists )
     if (isset($p['entry_id'])) {
         $o .= ",\n\t'entry_id': '" . htmlspecialchars($p['entry_id']) . "'";
     }
     // conditionally output flashvars:
     if (isset($p['flashvars'])) {
         $o .= ",\n\t'flashvars': {";
         $coma = '';
         foreach ($p['flashvars'] as $fvKey => $fvValue) {
             $o .= $coma;
             $coma = ',';
             // check for json flavar and set acordingly
             if (is_object(json_decode(html_entity_decode($fvValue)))) {
                 $o .= "\n\t\t'{$fvKey}':";
                 $fvSet = json_decode(html_entity_decode($fvValue));
                 $o .= json_encode($fvSet);
             } else {
                 $o .= "\"{$fvKey}\"" . ':' . json_encode(KalturaResultObject::formatString($fvValue));
             }
         }
         $o .= '}';
     }
     $o .= "\n});";
     return $o;
 }
예제 #2
0
<?php

/**
 * KalturaIframe support
 */
@ob_end_clean();
// Check for custom resource ps config file:
if (isset($wgKalturaPSHtml5SettingsPath) && is_file($wgKalturaPSHtml5SettingsPath)) {
    require_once $wgKalturaPSHtml5SettingsPath;
}
require_once 'kalturaIframeClass.php';
// Setup the kalturaIframe
$kIframe = new kalturaIframeClass();
// start gzip compression if available:
if (!ob_start("ob_gzhandler")) {
    ob_start();
}
// Support Etag and 304
if ($wgEnableScriptDebug == false && @trim($_SERVER['HTTP_IF_NONE_MATCH']) == $kIframe->getIframeOutputHash()) {
    header("HTTP/1.1 304 Not Modified");
    exit;
}
// Check if we are wrapping the iframe output in a callback
if (isset($_REQUEST['callback'])) {
    // check for json output mode ( either default raw content or 'parts' for sections
    $json = null;
    if (isset($_REQUEST['parts']) && $_REQUEST['parts'] == '1') {
        $json = array('rawHead' => $kIframe->outputIframeHeadCss(), 'rawScripts' => $kIframe->getKalturaIframeScripts() . $kIframe->getPlayerCheckScript());
    } else {
        // For full page replace:
        $json = array('content' => utf8_encode($kIframe->getIFramePageOutput()));
예제 #3
0
 private function getAutoEmbedCode()
 {
     $o = '';
     // Get the kWidget call ( pass along iframe payload path )
     // Check required params:
     $wid = $this->request()->get('wid');
     if (!$wid) {
         $this->setError("missing wid param");
         return '';
     }
     $wid = htmlspecialchars($wid);
     $uiconf_id = $this->request()->get('uiconf_id');
     if (!$uiconf_id) {
         $this->setError("missing uiconf_id param");
         return '';
     }
     $uiconf_id = htmlspecialchars($uiconf_id);
     $playerId = $this->request()->get('playerId');
     if (!$playerId) {
         $this->setError("missing playerId param");
         return '';
     }
     // Check optional params
     $width = $this->request()->get('width') ? htmlspecialchars($this->request()->get('width')) : 400;
     $height = $this->request()->get('height') ? htmlspecialchars($this->request()->get('height')) : 330;
     // Get the iframe payload
     $kIframe = new kalturaIframeClass();
     $this->iframeHeaders = $kIframe->getHeaders();
     // get the kIframe
     $json = array('content' => $kIframe->getIFramePageOutput());
     $o .= "kWidget.iframeAutoEmbedCache[ '{$playerId}' ] = " . json_encode($json) . ";\n";
     $o .= "if(!document.getElementById('{$playerId}')) { document.write( '<div id=\"{$playerId}\" style=\"width:{$width}px;height:{$height}px\"></div>' ); } \n";
     $o .= "kWidget.embed( '{$playerId}', { \n" . "\t'wid': '{$wid}', \n" . "\t'uiconf_id' : '{$uiconf_id}'";
     // conditionally add in the entry id: ( no entry id in playlists )
     if ($this->request()->get('entry_id') && !$this->getUiConfObject()->isPlaylist()) {
         $o .= ",\n\t'entry_id': '" . htmlspecialchars($this->request()->get('entry_id')) . "'";
     }
     $flashVars = $this->request()->getFlashVars();
     //$o.=",\n\t'width': {$width},\n\t'height': {$height}";
     // conditionally output flashvars:
     if ($flashVars && is_array($flashVars)) {
         $o .= ",\n\t'flashvars': {";
         $coma = '';
         foreach ($flashVars as $fvKey => $fvValue) {
             $o .= $coma;
             $coma = ',';
             // check for json flavar and set acordingly
             if (is_object(json_decode(html_entity_decode($fvValue)))) {
                 $o .= "\n\t\t'{$fvKey}':";
                 $fvSet = json_decode(html_entity_decode($fvValue));
                 $o .= json_encode($fvSet);
             } else {
                 $o .= "\"{$fvKey}\"" . ':' . json_encode($this->utility()->formatString($fvValue));
             }
         }
         $o .= '}';
     }
     $o .= "\n});";
     return $o;
 }
<?php

/**
 * KalturaIframe support
 */
@ob_end_clean();
// Check for custom resource ps config file:
if (isset($wgKalturaPSHtml5SettingsPath) && is_file($wgKalturaPSHtml5SettingsPath)) {
    require_once $wgKalturaPSHtml5SettingsPath;
}
require_once 'kalturaIframeClass.php';
// Setup the kalturaIframe
$kIframe = new kalturaIframeClass();
// start gzip compression if avaliable:
if (!ob_start("ob_gzhandler")) {
    ob_start();
}
// Check if we are wrapping the iframe output in a callback
if (isset($_REQUEST['callback'])) {
    // check for json output mode ( either default raw content or 'parts' for sections
    $json = null;
    if (isset($_REQUEST['parts']) && $_REQUEST['parts'] == '1') {
        $json = array('rawHead' => $kIframe->outputIframeHeadCss(), 'rawScripts' => $kIframe->getKalturaIframeScripts() . $kIframe->getPlayerCheckScript());
    } else {
        // For full page replace:
        $json = array('content' => utf8_encode($kIframe->getIFramePageOutput()));
    }
    // Set the iframe header:
    $kIframe->setIFrameHeaders();
    echo htmlspecialchars($_REQUEST['callback']) . '(' . json_encode($json) . ');';
    header('Content-Type: text/javascript');
<?php

/**
 * KalturaIframe support
 */
@ob_end_clean();
// Check for custom resource ps config file:
if (isset($wgKalturaPSHtml5SettingsPath) && is_file($wgKalturaPSHtml5SettingsPath)) {
    require_once $wgKalturaPSHtml5SettingsPath;
}
require_once 'kalturaIframeClass.php';
// Setup the kalturaIframe
$kIframe = new kalturaIframeClass();
// start gzip compression if avaliable:
if (!ob_start("ob_gzhandler")) {
    ob_start();
}
// Check if we are wrapping the iframe output in a callback
if (isset($_REQUEST['callback'])) {
    // check for json output mode ( either default raw content or 'parts' for sections
    $json = null;
    if (isset($_REQUEST['parts']) && $_REQUEST['parts'] == '1') {
        $json = array('rawHead' => $kIframe->outputIframeHeadCss(), 'rawScripts' => $kIframe->getKalturaIframeScripts());
    } else {
        // For full page replace:
        $json = array('content' => $kIframe->getIFramePageOutput());
    }
    // Set the iframe header:
    $kIframe->setIFrameHeaders();
    echo htmlspecialchars($_REQUEST['callback']) . '(' . json_encode($json) . ');';
    header('Content-Type: text/javascript');