Пример #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;
 }