Esempio n. 1
0
 /**
  *
  * Populate the uiconf from the config
  * @param Zend_Config_Ini $widget
  * @param string $baseSwfUrl
  * @param string $swfName
  * @param int $objType
  * @param bool $disableUrlHashing
  */
 public static function populateUiconfFromConfig($widget, $baseSwfUrl, $swfName, $objType, $disableUrlHashing)
 {
     $uiconf = new uiConf();
     if ($widget->conf_file) {
         $confFileContents = uiConfDeployment::readConfFileFromPath($widget->conf_file);
         if (!$confFileContents) {
             KalturaLog::debug("Unable to read xml file from: {$widget->conf_file}");
         }
         if ($disableUrlHashing) {
             $confFileContents = str_replace('<Plugin id="kalturaMix"', '<Plugin id="kalturaMix" disableUrlHashing="true" ', $confFileContents);
         }
         $uiconf->setConfFile($confFileContents);
     }
     if ($widget->config) {
         $uiconf->setConfig(@$widget->config);
     } else {
         if ($widget->config_file) {
             $configFileContents = uiConfDeployment::readConfFileFromPath($widget->config_file);
             if (!$configFileContents) {
                 KalturaLog::debug("Unable to read json file from: {$widget->config_file}");
             }
             $uiconf->setConfig($configFileContents);
         }
     }
     if ($uiconf->getConfFile() === FALSE && $uiconf->getConfig() === FALSE) {
         return FALSE;
         // conf file or config is a must, features is not.
     }
     if (isset($widget->features)) {
         $uiconf->setConfFileFeatures(uiConfDeployment::readConfFileFromPath($widget->features));
     }
     if ($uiconf->getConfFileFeatures() === FALSE) {
         KalturaLog::debug("missing features conf file for uiconf {$widget->name}");
         // conf file is a must, features is not.
     }
     //Set values to the ui conf
     $uiconf->setPartnerId(uiConfDeployment::$partnerId);
     $uiconf->setSubpId(uiConfDeployment::$subPartnerId);
     $uiconf->setCreationMode(uiConfDeployment::$creationMode);
     $uiconf->setUseCdn(uiConfDeployment::$useCdn);
     $uiconf->setObjType($objType);
     $uiconf->setName($widget->name);
     $uiconf->setSwfUrl($baseSwfUrl . $widget->version . '/' . $swfName);
     if ($widget->html5_version) {
         $uiconf->setHtml5Url("/html5/html5lib/" . $widget->html5_version . "/mwEmbedLoader.php");
     }
     $uiconf->setTags(uiConfDeployment::$defaultTags . ', ' . uiConfDeployment::$baseTag . '_' . $widget->usage);
     $uiconf->setWidth(@$widget->width);
     $uiconf->setHeight(@$widget->height);
     $uiconf->setConfVars(@$widget->conf_vars);
     $uiconf->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
     return $uiconf;
 }
Esempio n. 2
0
 public static function populateUiconfFromConfig($confConfigObj, $baseSwfUrl, $swfName, $objType, $disableUrlHashing)
 {
     global $defaultTags, $baseTag, $confObj, $kcw_for_editors, $kdp_for_studio;
     $uiconf = new uiConf();
     $confFileContents = uiConfDeployment::readConfFileFromPath($confConfigObj->conf_file);
     if ($disableUrlHashing) {
         $confFileContents = str_replace('<Plugin id="kalturaMix"', '<Plugin id="kalturaMix" disableUrlHashing="true" ', $confFileContents);
     }
     $uiconf->setConfFile($confFileContents);
     if ($uiconf->getConfFile() === FALSE) {
         return FALSE;
         // conf file is a must, features is not.
     }
     $replace_tag = '';
     if ($objType == uiConf::UI_CONF_TYPE_ADVANCED_EDITOR) {
         $replace_tag = 'uIConfigId';
     }
     if ($objType == uiConf::UI_CONF_TYPE_EDITOR) {
         $replace_tag = 'UIConfigId';
     }
     if ($replace_tag) {
         if (isset($confConfigObj->kcw_identifier) && isset($kcw_for_editors[$confConfigObj->kcw_identifier])) {
             $pattern = '/<' . $replace_tag . '>(.*)<\\/' . $replace_tag . '>/';
             $replacement = "<{$replace_tag}>{$kcw_for_editors[$confConfigObj->kcw_identifier]}</{$replace_tag}>";
             $uiconf->setConfFile(preg_replace($pattern, $replacement, $uiconf->getConfFile()));
         }
     }
     if (isset($confConfigObj->usage) && $confConfigObj->usage == 'templates') {
         foreach ($kdp_for_studio as $identifier => $confId) {
             $uiconf->setConfFile(str_replace('@@' . $identifier . '@@', $confId, $uiconf->getConfFile()));
         }
     }
     $uiconf->setConfFileFeatures(uiConfDeployment::readConfFileFromPath($confConfigObj->conf_file, true));
     if ($uiconf->getConfFileFeatures() === FALSE) {
         echo "missing features conf file for uiconf {$confConfigObj->name}" . PHP_EOL;
     }
     // conf file is a must, features is not.
     $uiconf->setPartnerId(0);
     $uiconf->setSubpId(0);
     $uiconf->setCreationMode(3);
     $uiconf->setUseCdn(1);
     $uiconf->setObjType($objType);
     $uiconf->setName($confConfigObj->name);
     $uiconf->setSwfUrl($baseSwfUrl . $confConfigObj->version . '/' . $swfName);
     $uiconf->setTags($defaultTags . ', ' . $baseTag . '_' . $confConfigObj->usage);
     $uiconf->setWidth(@$confConfigObj->width);
     $uiconf->setHeight(@$confConfigObj->height);
     $uiconf->setConfVars(@$confConfigObj->conf_vars);
     $uiconf->setDisplayInSearch(mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK);
     return $uiconf;
 }