本文整理汇总了PHP中kConf类的典型用法代码示例。如果您正苦于以下问题:PHP kConf类的具体用法?PHP kConf怎么用?PHP kConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kConf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$widgetId = $this->getRequestParameter("wid");
$widget = widgetPeer::retrieveByPK($widgetId);
if (!$widget) {
KalturaLog::err("Widget id [{$widgetId}] not found");
die;
}
$entry = $widget->getentry();
$entryId = $widget->getEntryId();
if (!$entry) {
KalturaLog::err("Entry id [{$entryId}] not found");
die;
}
$uiConf = $widget->getuiConf();
$uiConfId = $widget->getUiConfId();
if (!$uiConf) {
KalturaLog::err("UI Conf id [{$uiConfId}] not found");
die;
}
$widgetPath = "/kwidget/wid/{$widgetId}/entry_id/{$entryId}/ui_conf/{$uiConfId}";
$this->widget = $widget;
$this->entry = $entry;
$this->uiConf = $uiConf;
$this->entryThumbUrl = $entry->getThumbnailUrl();
$this->entryThumbSecureUrl = $entry->getThumbnailUrl(null, 'https');
$this->widgetUrl = 'http://' . kConf::get('www_host') . $widgetPath;
$this->widgetSecureUrl = 'https://' . kConf::get('www_host') . $widgetPath;
}
示例2: isRelativeTimeEnabled
public static function isRelativeTimeEnabled()
{
if (!kConf::hasParam('disable_relative_time_partners')) {
return true;
}
return !in_array(kCurrentContext::getCurrentPartnerId(), kConf::get('disable_relative_time_partners'));
}
示例3: partnerPermissionEnabled
protected function partnerPermissionEnabled(Partner $partner)
{
$templatePartner = PartnerPeer::retrieveByPK($partner->getI18nTemplatePartnerId() ? $partner->getI18nTemplatePartnerId() : kConf::get('template_partner_id'));
if ($templatePartner) {
$this->copyEventNotificationTemplates($templatePartner, $partner, true);
}
}
示例4: getAuditTrailConfig
/**
* @param int $partnerId
* @param string $objectType
* @return AuditTrailConfig
*/
protected static function getAuditTrailConfig($partnerId, $objectType)
{
$config = null;
if (isset(self::$cachedPartnerConfig[$partnerId])) {
$config = self::$cachedPartnerConfig[$partnerId];
} else {
$cacheFolder = kConf::get("cache_root_path") . "/audit";
if (!is_dir($cacheFolder)) {
mkdir($cacheFolder, 0777);
}
$cachePath = "{$cacheFolder}/{$partnerId}.cfg";
if (file_exists($cachePath)) {
$config = unserialize(file_get_contents($cachePath));
} else {
$auditTrailConfigs = AuditTrailConfigPeer::retrieveByPartnerId($partnerId);
$config = array();
if (count($auditTrailConfigs)) {
foreach ($auditTrailConfigs as $auditTrailConfig) {
$config[$auditTrailConfig->getObjectType()] = $auditTrailConfig;
}
}
file_put_contents($cachePath, serialize($config));
}
self::$cachedPartnerConfig[$partnerId] = $config;
}
if (!isset($config[$objectType])) {
KalturaLog::info("Object type [{$objectType}] not audited");
return null;
}
return $config[$objectType];
}
示例5: execute
public function execute()
{
$this->result = 0;
if (@$_REQUEST["exit"] == "true") {
$this->systemLogout();
$login = NULL;
$password = NULL;
} else {
$login = @$_REQUEST["login"];
$password = @$_REQUEST["pwd"];
}
//echo "login: $login, password: $password";
$this->login = $login;
$this->sign_in_referer = @$_REQUEST["sign_in_referer"];
if (empty($this->sign_in_referer)) {
$this->sign_in_referer = $this->getFlash("sign_in_referer");
}
if (empty($login) || empty($password)) {
$this->result = 0;
} else {
if (kConf::hasParam("system_pages_login_password") && sha1($password) == kConf::get("system_pages_login_password")) {
$this->systemAuthenticated();
if (empty($this->sign_in_referer)) {
// should go back - the original hit was to this page - no reason to go back or refresh
$this->result = 2;
} else {
$this->result = 1;
}
} else {
$this->result = -1;
}
}
}
示例6: parse
private static function parse($content)
{
$items = array();
$message = '';
$doc = new DOMDocument();
if ($doc->loadXML($content)) {
$xpath = new DOMXPath($doc);
$itemNodes = $xpath->query("//item");
if (!$itemNodes->length) {
$status = "error";
} else {
foreach ($itemNodes as $itemNode) {
$ns = "http://search.yahoo.com/mrss/";
$id = self::getXmlNodeValue($itemNode, "id");
$title = self::getXmlNodeValue($itemNode, "title");
$thumbnail = "http://s.mcstatic.com/thumb/" . $id . ".jpg";
$duration = self::getXmlNodeValue($itemNode, "content", "duration", $ns);
$description = self::getXmlNodeValue($itemNode, "description", null, $ns);
$description = strip_tags($description);
$tags = self::getXmlNodeValue($itemNode, "keywords", null, $ns);
$credit = self::getXmlNodeValue($itemNode, "credit", null, $ns);
$link = self::getXmlNodeValue($itemNode, "link");
$items[] = array('id' => $id, 'title' => $title, 'thumb' => $thumbnail, 'description' => $description, 'tags' => $tags, 'license' => '', 'credit' => $credit, 'source_link' => $link, 'url' => "http://" . kConf::get("www_host") . "/index.php/extservices/metacafeRedirect/itemId/" . $id);
}
$status = "ok";
}
} else {
$status = "error";
}
return array('status' => $status, 'message' => $message, 'objects' => $items, "needMediaInfo" => self::$NEED_MEDIA_INFO);
}
示例7: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$ui_conf_id = $this->getRequestParameter("ui_conf_id");
$uiConf = uiConfPeer::retrieveByPK($ui_conf_id);
if (!$uiConf) {
die;
}
$partner_id = $uiConf->getPartnerId();
$subp_id = $uiConf->getSubpId();
$host = myPartnerUtils::getHost($partner_id);
$ui_conf_swf_url = $uiConf->getSwfUrl();
if (!$ui_conf_swf_url) {
$ui_conf_swf_url = "/swf/simpleeditor.swf";
}
if (kString::beginsWith($ui_conf_swf_url, "http")) {
$swf_url = $ui_conf_swf_url;
// absolute URL
} else {
$use_cdn = $uiConf->getUseCdn();
$cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id);
$swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url;
// relative to the current host
}
// handle buggy case for backward compatiblity
$partner_host = $host;
if ($partner_host == "http://www.kaltura.com") {
$partner_host = 1;
}
// otherwise the kse will build a flawed url with [[IMPORT]]
$params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id . "&disableurlhashing=" . kConf::get('disable_url_hashing');
$wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('editors_flex_wrapper_version') . "/FlexWrapper.swf";
$this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}");
}
示例8: myCache
public function myCache($namespace, $expiry = NULL)
{
$this->m_namespace = $namespace;
if (self::$s_memcache == NULL) {
if (!function_exists('memcache_connect')) {
return;
}
self::$s_memcache = new Memcache();
//self::$s_memcache->pconnect(self::SERVER, self::PORT) // this will use a persistent connection
try {
$res = @self::$s_memcache->connect(kConf::get("memcache_host"), kConf::get("memcache_port"));
} catch (Exception $e) {
$res = false;
}
if (!$res) {
kLog::log("ERROR: Error while trying to connect to memcache. Make sure it is properly running on " . kConf::get("memcache_host") . ":" . kConf::get("memcache_port"));
//throw new Exception ("Error while trying to connect to memcache. Make sure it is properly running on " . self::SERVER . ":" . self::PORT );
} else {
self::$s_ready = true;
}
// or die ("Error while trying to connect to memcache. Make sure it is properly running on " . self::SERVER . ":" . self::PORT );
}
if ($expiry != null) {
$this->m_expiry = $expiry;
}
if ($this->calculateStats()) {
$this->m_stats = $this->getStatsObj();
if ($this->m_stats == NULL) {
$this->m_stats = new cacheStats();
}
} else {
$this->m_stats = new cacheStats();
}
}
示例9: validateNestedObjects
protected function validateNestedObjects($maxPageSize = null, $maxNestingLevel = null)
{
$relatedProfiles = $this->relatedProfiles;
if (!$relatedProfiles) {
return;
}
if (is_null($maxPageSize)) {
$maxPageSize = kConf::get('response_profile_max_page_size', 'local', 100);
}
if (is_null($maxNestingLevel)) {
$maxNestingLevel = kConf::get('response_profile_max_nesting_level', 'local', 2);
}
if ($maxNestingLevel > 0) {
foreach ($relatedProfiles as $relatedProfile) {
/* @var $relatedProfile KalturaDetachedResponseProfile */
$relatedProfile->validateNestedObjects($maxPageSize, $maxNestingLevel - 1);
$pager = $relatedProfile->pager;
if ($pager) {
$pager->validatePropertyMaxValue('pageSize', $maxPageSize, true);
}
}
} elseif (count($relatedProfiles)) {
throw new KalturaAPIException(KalturaErrors::RESPONSE_PROFILE_MAX_NESTING_LEVEL);
}
}
示例10: 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;
}
示例11: __construct
public function __construct(KalturaDistributionJobData $distributionJobData = null)
{
parent::__construct($distributionJobData);
$this->notificationBaseUrl = 'http://' . kConf::get('cdn_api_host');
if (!$distributionJobData) {
return;
}
if (!$distributionJobData->distributionProfile instanceof KalturaUnicornDistributionProfile) {
return;
}
$entryDistributionDb = EntryDistributionPeer::retrieveByPK($distributionJobData->entryDistributionId);
$distributionProfileDb = DistributionProfilePeer::retrieveByPK($distributionJobData->distributionProfileId);
/* @var $distributionProfileDb UnicornDistributionProfile */
$flavorAssetIds = explode(',', $entryDistributionDb->getFlavorAssetIds());
$flavorAssetId = reset($flavorAssetIds);
$flavorAsset = assetPeer::retrieveById($flavorAssetId);
$flavorAssetOldVersion = $entryDistributionDb->getFromCustomData(kUnicornDistributionJobProviderData::CUSTOM_DATA_FLAVOR_ASSET_OLD_VERSION);
$flavorAssetNewVersion = null;
if ($flavorAsset) {
$flavorAssetNewVersion = $flavorAsset->getVersion();
}
$values = $distributionProfileDb->getAllFieldValues($entryDistributionDb);
$this->catalogGuid = $values[UnicornDistributionField::CATALOG_GUID];
$this->title = $values[UnicornDistributionField::TITLE];
$this->flavorAssetVersion = $flavorAssetNewVersion;
$this->mediaChanged = $flavorAssetOldVersion != $flavorAssetNewVersion;
}
示例12: __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!");
}
}
示例13: addAction
/**
* Add new CategoryUser
*
* @action add
* @param KalturaCategoryUser $categoryUser
* @return KalturaCategoryUser
*/
function addAction(KalturaCategoryUser $categoryUser)
{
$dbCategoryKuser = $categoryUser->toInsertableObject();
/* @var $dbCategoryKuser categoryKuser */
$category = categoryPeer::retrieveByPK($categoryUser->categoryId);
if (!$category) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $categoryUser->categoryId);
}
$maxUserPerCategory = kConf::get('max_users_per_category');
if ($category->getMembersCount() >= $maxUserPerCategory) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_MAX_USER_REACHED, $maxUserPerCategory);
}
$currentKuserCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($categoryUser->categoryId, kCurrentContext::getCurrentKsKuserId());
if (!kEntitlementUtils::getEntitlementEnforcement()) {
$dbCategoryKuser->setStatus(CategoryKuserStatus::ACTIVE);
$dbCategoryKuser->setPermissionLevel($categoryUser->permissionLevel);
} elseif ($currentKuserCategoryKuser && $currentKuserCategoryKuser->getPermissionLevel() == CategoryKuserPermissionLevel::MANAGER) {
//Current Kuser is manager
$dbCategoryKuser->setStatus(CategoryKuserStatus::ACTIVE);
} elseif ($category->getUserJoinPolicy() == UserJoinPolicyType::AUTO_JOIN) {
$dbCategoryKuser->setPermissionLevel($category->getDefaultPermissionLevel());
$dbCategoryKuser->setStatus(CategoryKuserStatus::ACTIVE);
} elseif ($category->getUserJoinPolicy() == UserJoinPolicyType::REQUEST_TO_JOIN) {
$dbCategoryKuser->setPermissionLevel($category->getDefaultPermissionLevel());
$dbCategoryKuser->setStatus(CategoryKuserStatus::PENDING);
} else {
throw new KalturaAPIException(KalturaErrors::CATEGORY_USER_JOIN_NOT_ALLOWED, $categoryUser->categoryId);
}
$dbCategoryKuser->setCategoryFullIds($category->getFullIds());
$dbCategoryKuser->setPartnerId($this->getPartnerId());
$dbCategoryKuser->save();
$categoryUser->fromObject($dbCategoryKuser, $this->getResponseProfile());
return $categoryUser;
}
示例14: getCache
/**
* @param int $type
* @return kBaseCacheWrapper or null on error
*/
public static function getCache($type)
{
if (array_key_exists($type, self::$caches)) {
return self::$caches[$type];
}
if (!array_key_exists($type, self::$cacheConfigs)) {
return null;
}
$config = self::$cacheConfigs[$type];
$className = "k{$config[0]}CacheWrapper";
require_once dirname(__FILE__) . '/' . $className . '.php';
$cache = new $className();
// get required kConf params
$config = array_slice($config, 1);
foreach ($config as $index => $value) {
if (is_string($value) && substr($value, 0, strlen(self::KCONF_PARAM_PREFIX)) == self::KCONF_PARAM_PREFIX) {
$value = substr($value, strlen(self::KCONF_PARAM_PREFIX));
if (!kConf::hasParam($value)) {
self::$caches[$type] = null;
return null;
}
$config[$index] = kConf::get($value);
}
}
// initialize the cache
if (call_user_func_array(array($cache, 'init'), $config) === false) {
$cache = null;
}
self::$caches[$type] = $cache;
return $cache;
}
示例15: init
protected function init()
{
if (!parent::init()) {
return false;
}
// ignore params which may hurt caching such as callback, playSessionId
if (kConf::hasParam('playmanifest_ignore_params')) {
$ignoreParams = kConf::get('playmanifest_ignore_params');
foreach ($ignoreParams as $paramName) {
unset($this->_params[$paramName]);
}
}
$this->_playbackContext = isset($this->_params['playbackContext']) ? $this->_params['playbackContext'] : null;
unset($this->_params['playbackContext']);
$this->_deliveryCode = isset($this->_params['deliveryCode']) ? $this->_params['deliveryCode'] : null;
unset($this->_params['deliveryCode']);
// take only the hostname part of the referrer parameter of baseEntry.getContextData
if (isset($this->_params['referrer'])) {
$referrer = base64_decode(str_replace(" ", "+", $this->_params['referrer']));
if (!is_string($referrer)) {
$referrer = "";
}
unset($this->_params['referrer']);
} else {
$referrer = self::getHttpReferrer();
}
$this->_referrers[] = $referrer;
$this->finalizeCacheKey();
$this->addExtraFields();
return true;
}