本文整理汇总了PHP中kConf::getMap方法的典型用法代码示例。如果您正苦于以下问题:PHP kConf::getMap方法的具体用法?PHP kConf::getMap怎么用?PHP kConf::getMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kConf
的用法示例。
在下文中一共展示了kConf::getMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitLogger
/**
* @param $configName string
* @param $context string
*/
public static function InitLogger($configName, $context = null)
{
if (KalturaLog::getLogger()) {
// already initialized
return;
}
if (function_exists('apc_fetch')) {
$cacheKey = self::LOGGER_APC_CACHE_KEY_PREFIX . $configName;
$logger = apc_fetch($cacheKey);
if ($logger) {
list($logger, $cacheVersionId) = $logger;
if ($cacheVersionId == kConf::getCachedVersionId()) {
KalturaLog::setLogger($logger);
return;
}
}
}
try {
$config = new Zend_Config(kConf::getMap('logger'));
KalturaLog::initLog($config->{$configName});
if ($context) {
KalturaLog::setContext($context);
}
if (function_exists('apc_store')) {
apc_store($cacheKey, array(KalturaLog::getLogger(), kConf::getCachedVersionId()));
}
} catch (Zend_Config_Exception $ex) {
}
}
示例2: __construct
public function __construct()
{
// check that rabbit_mq.ini file exists
if (kConf::hasMap('rabbit_mq')) {
// check configuration is correctly set
$rabbitConfig = kConf::getMap('rabbit_mq');
if (isset($rabbitConfig['username'])) {
$this->username = $rabbitConfig['username'];
}
if (isset($rabbitConfig['password'])) {
$this->password = $rabbitConfig['password'];
}
if (isset($rabbitConfig['server'])) {
$this->MQserver = $rabbitConfig['server'];
}
if (isset($rabbitConfig['port'])) {
$this->port = $rabbitConfig['port'];
}
if (isset($rabbitConfig['curl_port'])) {
$this->curlPort = $rabbitConfig['curl_port'];
}
if (isset($rabbitConfig['timeout'])) {
$this->timeout = $rabbitConfig['timeout'];
}
} else {
KalturaLog::err("RabbitMQ configuration file (rabbit_mq.ini) wasn't found!");
}
}
示例3: getExcludeFileSyncMap
function getExcludeFileSyncMap()
{
$result = array();
$dcConfig = kConf::getMap("dc_config");
if (isset($dcConfig['sync_exclude_types'])) {
foreach ($dcConfig['sync_exclude_types'] as $syncExcludeType) {
$configObjectType = $syncExcludeType;
$configObjectSubType = null;
if (strpos($syncExcludeType, ':') > 0) {
list($configObjectType, $configObjectSubType) = explode(':', $syncExcludeType, 2);
}
// translate api dynamic enum, such as contentDistribution.EntryDistribution - {plugin name}.{object name}
if (!is_numeric($configObjectType)) {
$configObjectType = kPluginableEnumsManager::apiToCore('FileSyncObjectType', $configObjectType);
}
// translate api dynamic enum, including the enum type, such as conversionEngineType.mp4box.Mp4box - {enum class name}.{plugin name}.{object name}
if (!is_null($configObjectSubType) && !is_numeric($configObjectSubType)) {
list($enumType, $configObjectSubType) = explode('.', $configObjectSubType);
$configObjectSubType = kPluginableEnumsManager::apiToCore($enumType, $configObjectSubType);
}
if (!isset($result[$configObjectType])) {
$result[$configObjectType] = array();
}
if (!is_null($configObjectSubType)) {
$result[$configObjectType][] = $configObjectSubType;
}
}
}
return $result;
}
示例4: getForcedDeliveryTypeFromConfig
public static function getForcedDeliveryTypeFromConfig($key)
{
$playersConfig = kConf::getMap('players');
if (is_array($playersConfig) && isset($playersConfig['forced_delivery_types'])) {
$deliveryTypeConfig = $playersConfig['forced_delivery_types'];
if (isset($deliveryTypeConfig[$key])) {
return $deliveryTypeConfig[$key];
}
}
return null;
}
示例5: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$partner_host = myPartnerUtils::getHost($partner_id);
$partner_cdnHost = myPartnerUtils::getCdnHost($partner_id);
$use_cdn = $uiConf->getUseCdn();
$host = $use_cdn ? $partner_cdnHost : $partner_host;
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$url = $ui_conf_html5_url;
// absolute URL
} else {
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php";
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix
if (kString::endsWith($url, "mwEmbedLoader.php")) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
requestUtils::sendCachingHeaders(60);
header("Pragma:");
kFile::cacheRedirect($url);
header("Location:{$url}");
die;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:embedIframeJsAction.class.php
示例6: getConfigParam
public static function getConfigParam($configName, $key)
{
$config = kConf::getMap($configName);
if (!is_array($config)) {
KalturaLog::err($configName . ' config section is not defined');
return null;
}
if (!isset($config[$key])) {
KalturaLog::err('The key ' . $key . ' was not found in the ' . $configName . ' config section');
return null;
}
return $config[$key];
}
示例7: getPlaybackHost
public function getPlaybackHost($protocol = 'http', $format = null, $deliveryType = null)
{
$mediaServerGlobalConfig = array();
if (kConf::hasMap('media_servers')) {
$mediaServerGlobalConfig = array_merge($mediaServerGlobalConfig, kConf::getMap('media_servers'));
}
if ($this->partner_media_server_config) {
$mediaServerGlobalConfig = array_merge($mediaServerGlobalConfig, $this->partner_media_server_config);
}
$domain = $this->getDomainByProtocolAndFormat($mediaServerGlobalConfig, $protocol, $format);
$port = $this->getPortByProtocolAndFormat($mediaServerGlobalConfig, $protocol, $format);
$appPrefix = $this->getApplicationPrefix($mediaServerGlobalConfig);
return "{$domain}:{$port}/{$appPrefix}";
}
示例8: getAllDcs
public static function getAllDcs($include_current = false)
{
$dc_config = kConf::getMap("dc_config");
$dc_list = $dc_config["list"];
if ($include_current == false) {
unset($dc_list[$dc_config["current"]]);
}
$fixed_list = array();
foreach ($dc_list as $dc_id => $dc_props) {
$dc_props["id"] = $dc_id;
$fixed_list[] = $dc_props;
}
return $fixed_list;
}
示例9: setCacheExpiry
function setCacheExpiry($entriesCount, $feedId)
{
$expiryArr = kConf::hasMap("v3cache_getfeed_expiry") ? kConf::getMap("v3cache_getfeed_expiry") : array();
foreach ($expiryArr as $item) {
if ($item["key"] == "partnerId" && $item["value"] == kCurrentContext::$partner_id || $item["key"] == "feedId" && $item["value"] == $feedId) {
KalturaResponseCacher::setExpiry($item["expiry"]);
return;
}
}
$expiry = kConf::get("v3cache_getfeed_default_cache_time_frame", 'local', 86400);
if (kConf::hasParam("v3cache_getfeed_short_limits_array")) {
$shortLimits = kConf::get("v3cache_getfeed_short_limits_array");
} else {
$shortLimits = array(50 => 900, 100 => 1800, 200 => 3600, 400 => 7200);
}
foreach ($shortLimits as $numOfEntries => $cacheTimeFrame) {
if ($entriesCount <= $numOfEntries) {
$expiry = min($expiry, $cacheTimeFrame);
}
}
KalturaResponseCacher::setExpiry($expiry);
}
示例10: shouldSyncFileObjectType
/**
* Check if specific file sync that belong to object type and sub type should be synced
*
* @param int $objectType
* @param int $objectSubType
* @return bool
*/
public static function shouldSyncFileObjectType($fileSync)
{
if (is_null(self::$excludedSyncFileObjectTypes)) {
self::$excludedSyncFileObjectTypes = array();
$dcConfig = kConf::getMap("dc_config");
if (isset($dcConfig['sync_exclude_types'])) {
foreach ($dcConfig['sync_exclude_types'] as $syncExcludeType) {
$configObjectType = $syncExcludeType;
$configObjectSubType = null;
if (strpos($syncExcludeType, ':') > 0) {
list($configObjectType, $configObjectSubType) = explode(':', $syncExcludeType, 2);
}
// translate api dynamic enum, such as contentDistribution.EntryDistribution - {plugin name}.{object name}
if (!is_numeric($configObjectType)) {
$configObjectType = kPluginableEnumsManager::apiToCore('FileSyncObjectType', $configObjectType);
}
// translate api dynamic enum, including the enum type, such as conversionEngineType.mp4box.Mp4box - {enum class name}.{plugin name}.{object name}
if (!is_null($configObjectSubType) && !is_numeric($configObjectSubType)) {
list($enumType, $configObjectSubType) = explode('.', $configObjectSubType);
$configObjectSubType = kPluginableEnumsManager::apiToCore($enumType, $configObjectSubType);
}
if (!isset(self::$excludedSyncFileObjectTypes[$configObjectType])) {
self::$excludedSyncFileObjectTypes[$configObjectType] = array();
}
if (!is_null($configObjectSubType)) {
self::$excludedSyncFileObjectTypes[$configObjectType][] = $configObjectSubType;
}
}
}
}
if (!isset(self::$excludedSyncFileObjectTypes[$fileSync->getObjectType()])) {
return true;
}
if (count(self::$excludedSyncFileObjectTypes[$fileSync->getObjectType()]) && !in_array($fileSync->getObjectSubType(), self::$excludedSyncFileObjectTypes[$fileSync->getObjectType()])) {
return true;
}
return false;
}
示例11: wgGetUrl
if ($kConf->hasParam('remote_addr_header_salt')) {
$wgKalturaRemoteAddressSalt = $kConf->get('remote_addr_header_salt');
}
// Disable Apple HLS if defined in kConf
if ($kConf->hasParam('use_apple_adaptive')) {
$wgKalturaUseAppleAdaptive = $kConf->get('use_apple_adaptive');
}
// Get Kaltura Supported API Features
if ($kConf->hasParam('features')) {
$wgKalturaApiFeatures = $kConf->get('features');
}
// Allow Iframe to connect remote service
$wgKalturaAllowIframeRemoteService = true;
// Set debug for true (testing only)
$wgEnableScriptDebug = false;
// Get PlayReady License URL
if ($kConf->hasMap('playReady')) {
$playReadyMap = $kConf->getMap('playReady');
if ($playReadyMap) {
$wgKalturaLicenseServerUrl = $playReadyMap['license_server_url'];
}
}
// A helper function to get full URL of host
function wgGetUrl($hostKey = null)
{
global $wgHTTPProtocol, $wgServerPort, $kConf;
if ($hostKey && $kConf->hasParam($hostKey)) {
return $wgHTTPProtocol . '://' . $kConf->get($hostKey) . $wgServerPort;
}
return null;
}
示例12: getContextData
/**
* This action delivers entry-related data, based on the user's context: access control, restriction, playback format and storage information.
* @action getContextData
* @param string $entryId
* @param KalturaEntryContextDataParams $contextDataParams
* @return KalturaEntryContextDataResult
*/
public function getContextData($entryId, KalturaEntryContextDataParams $contextDataParams)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$ks = $this->getKs();
$isAdmin = false;
if ($ks) {
$isAdmin = $ks->isAdmin();
}
$accessControl = $dbEntry->getAccessControl();
/* @var $accessControl accessControl */
$result = new KalturaEntryContextDataResult();
$result->isAdmin = $isAdmin;
$result->isScheduledNow = $dbEntry->isScheduledNow($contextDataParams->time);
if ($dbEntry->getStartDate() && abs($dbEntry->getStartDate(null) - time()) <= 86400 || $dbEntry->getEndDate() && abs($dbEntry->getEndDate(null) - time()) <= 86400) {
KalturaResponseCacher::setConditionalCacheExpiry(600);
}
if ($accessControl && $accessControl->hasRules()) {
$disableCache = true;
if (kConf::hasMap("optimized_playback")) {
$partnerId = $accessControl->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$params = $optimizedPlayback[$partnerId];
if (array_key_exists('cache_kdp_acccess_control', $params) && $params['cache_kdp_acccess_control']) {
$disableCache = false;
}
}
}
$accessControlScope = $accessControl->getScope();
$contextDataParams->toObject($accessControlScope);
$accessControlScope->setEntryId($entryId);
$result->isAdmin = $accessControlScope->getKs() && $accessControlScope->getKs()->isAdmin();
$dbResult = new kEntryContextDataResult();
if ($accessControl->applyContext($dbResult) && $disableCache) {
KalturaResponseCacher::disableCache();
}
$result->fromObject($dbResult);
}
$partner = PartnerPeer::retrieveByPK($dbEntry->getPartnerId());
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_DELIVERY_PRIORITY, $dbEntry->getPartnerId()) && $partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
if (is_null($contextDataParams->flavorAssetId)) {
if ($contextDataParams->flavorTags) {
$assets = assetPeer::retrieveReadyByEntryIdAndTag($entryId, $contextDataParams->flavorTags);
$asset = reset($assets);
} else {
$asset = assetPeer::retrieveBestPlayByEntryId($entryId);
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND, $entryId);
}
} else {
$asset = assetPeer::retrieveByPK($contextDataParams->flavorAssetId);
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $contextDataParams->flavorAssetId);
}
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $entryId);
}
$assetSyncKey = $asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSyncs = kFileSyncUtils::getAllReadyExternalFileSyncsForKey($assetSyncKey);
$storageProfilesXML = new SimpleXMLElement("<StorageProfiles/>");
foreach ($fileSyncs as $fileSync) {
$storageProfileId = $fileSync->getDc();
$storageProfile = StorageProfilePeer::retrieveByPK($storageProfileId);
if (!$storageProfile->getDeliveryRmpBaseUrl() && (!$contextDataParams->streamerType || $contextDataParams->streamerType == StorageProfile::PLAY_FORMAT_AUTO)) {
$contextDataParams->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
$contextDataParams->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$storageProfileXML = $storageProfilesXML->addChild("StorageProfile");
$storageProfileXML->addAttribute("storageProfileId", $storageProfileId);
$storageProfileXML->addChild("Name", $storageProfile->getName());
$storageProfileXML->addChild("SystemName", $storageProfile->getSystemName());
}
$result->storageProfilesXML = $storageProfilesXML->saveXML();
}
if ($contextDataParams->streamerType && $contextDataParams->streamerType != StorageProfile::PLAY_FORMAT_AUTO) {
$result->streamerType = $contextDataParams->streamerType;
$result->mediaProtocol = $contextDataParams->mediaProtocol ? $contextDataParams->mediaProtocol : $contextDataParams->streamerType;
} else {
$result->streamerType = $this->getPartner()->getStreamerType();
if (!$result->streamerType) {
$result->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
}
$result->mediaProtocol = $this->getPartner()->getMediaProtocol();
if (!$result->mediaProtocol) {
$result->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
}
return $result;
//.........这里部分代码省略.........
示例13: enforceEncryption
protected function enforceEncryption()
{
$playbackParams = array();
if (kConf::hasMap("optimized_playback")) {
$partnerId = $this->entry->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$playbackParams = $optimizedPlayback[$partnerId];
}
}
// TODO add protocol limitation action to access control
if (array_key_exists('enforce_encryption', $playbackParams) && $playbackParams['enforce_encryption']) {
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted manifest request - forbidden');
}
$allowedProtocols = array('https', 'rtmpe', 'rtmpte');
if (!in_array(strtolower($this->deliveryAttributes->getMediaProtocol()), $allowedProtocols)) {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted playback protocol - forbidden');
}
}
}
示例14: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$widget_id = $this->getRequestParameter("widget_id", '_' . $partner_id);
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "https" : "http";
$host = myPartnerUtils::getCdnHost($partner_id, $protocol, 'api');
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
$autoEmbed = $this->getRequestParameter('autoembed');
$iframeEmbed = $this->getRequestParameter('iframeembed');
$scriptName = $iframeEmbed ? 'mwEmbedFrame.php' : 'mwEmbedLoader.php';
if ($ui_conf_html5_url && $iframeEmbed) {
$ui_conf_html5_url = str_replace('mwEmbedLoader.php', 'mwEmbedFrame.php', $ui_conf_html5_url);
}
$relativeUrl = true;
// true if ui_conf html5_url is relative (doesnt start with an http prefix)
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$relativeUrl = false;
$url = $ui_conf_html5_url;
// absolute URL
} else {
if (!$iframeEmbed) {
$host = "{$protocol}://" . kConf::get('html5lib_host') . "/";
}
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/" . $scriptName;
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php/mwEmbedFrame.php suffix
if (kString::endsWith($url, $scriptName)) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
if (!$autoEmbed) {
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
}
header("pragma:");
if ($iframeEmbed) {
$url .= (strpos($url, "?") === false ? "?" : "&") . 'wid=' . $widget_id . '&' . $_SERVER["QUERY_STRING"];
} else {
$params = "protocol={$protocol}&" . $_SERVER["QUERY_STRING"];
$url .= (strpos($url, "?") === false ? "?" : "&") . $params;
if ($relativeUrl) {
header('Content-Type: application/javascript');
kFileUtils::dumpUrl($url, true, false, array("X-Forwarded-For" => requestUtils::getRemoteAddress()));
}
}
requestUtils::sendCachingHeaders(60, true, time());
kFile::cacheRedirect($url);
header("Location:{$url}");
KExternalErrors::dieGracefully();
}
示例15: array
$configDir->close();
//try
//{
// $config = new Zend_Config(kConf::getAll());
// $configWriter = new Zend_Config_Writer_Xml();
// $configWriter->write($xmlFilename, $config);
// KalturaLog::info("Saved config to history [$xmlFilename]");
//}
//catch(Exception $e)
//{
// KalturaLog::err($e->getMessage());
//}
$reports = array();
foreach ($tamplates as $mapName => $tamplate) {
try {
$map = kConf::getMap($mapName);
} catch (Exception $e) {
$msg = $e->getMessage();
$reports[] = $msg;
KalturaLog::debug($msg);
continue;
}
$iniFile = realpath("{$configPath}/{$mapName}.ini");
$mapReports = compareMaps($mapName, $tamplate, $map);
if (count($mapReports)) {
$reports[] = "Config map [{$mapName}] file [{$iniFile}] issues:";
foreach ($mapReports as $report) {
$reports[] = " - {$report}";
}
$reports[] = '';
} else {