本文整理汇总了PHP中kCurrentContext类的典型用法代码示例。如果您正苦于以下问题:PHP kCurrentContext类的具体用法?PHP kCurrentContext怎么用?PHP kCurrentContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kCurrentContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doGetListResponse
protected function doGetListResponse(KalturaFilterPager $pager, $type = null)
{
$this->validateEntryIdFiltered();
$this->translateUserIds();
$c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
if ($type) {
$c->add(CuePointPeer::TYPE, $type);
}
$entryIds = null;
if ($this->entryIdEqual) {
$entryIds = array($this->entryIdEqual);
} else {
if ($this->entryIdIn) {
$entryIds = explode(',', $this->entryIdIn);
}
}
if (!is_null($entryIds)) {
$entryIds = entryPeer::filterEntriesByPartnerOrKalturaNetwork($entryIds, kCurrentContext::getCurrentPartnerId());
if (!$entryIds) {
return array(array(), 0);
}
$this->entryIdEqual = null;
$this->entryIdIn = implode(',', $entryIds);
}
$cuePointFilter = $this->toObject();
$cuePointFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$list = CuePointPeer::doSelect($c);
return array($list, $c->getRecordsCount());
}
示例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: validateForUpdate
public function validateForUpdate($sourceObject, $propertiesToSkip = array())
{
if (!WidevinePlugin::isAllowedPartner(kCurrentContext::getCurrentPartnerId()) || !WidevinePlugin::isAllowedPartner($sourceObject->getPartnerId())) {
throw new KalturaAPIException(KalturaErrors::PERMISSION_NOT_FOUND, 'Permission not found to use the Widevine feature.');
}
return parent::validateForUpdate($sourceObject, $propertiesToSkip);
}
示例4: createCustomData
public static function createCustomData($entryId, KalturaFlavorAssetArray $flavorAssets, $signingKey)
{
$flavorIds = "";
$first = true;
foreach ($flavorAssets as $flavor) {
/**
* @var asset $flavor
*/
if ($first) {
$first = false;
} else {
$flavorIds .= ",";
}
$flavorIds .= $flavor->id;
}
$innerData = array();
$innerData["ca_system"] = self::SYSTEM_NAME;
$innerData["user_token"] = kCurrentContext::$ks;
$innerData["account_id"] = kCurrentContext::getCurrentPartnerId();
$innerData["content_id"] = $entryId;
$innerData["files"] = $flavorIds;
$customData = array();
foreach ($flavorAssets as $flavor) {
/*
* we sign for each flavor asset in case that in the future someone will want to add data per flavor asset
*/
$innerDataJson = json_encode($innerData);
$innerDataSignature = self::signDataWithKey($innerDataJson, $signingKey);
$innerDataJsonEncoded = rawurlencode(base64_encode($innerDataJson));
$customData[$flavor->id] = array();
$customData[$flavor->id]["custom_data"] = $innerDataJsonEncoded;
$customData[$flavor->id]["signature"] = $innerDataSignature;
}
return $customData;
}
示例5: translateSphinxCriterion
public function translateSphinxCriterion(SphinxCriterion $crit)
{
$field = $crit->getTable() . '.' . $crit->getColumn();
$value = $crit->getValue();
$fieldName = null;
if ($field == TagPeer::OBJECT_TYPE) {
$fieldName = "TagPeer::OBJECT_TYPE";
}
if ($field == TagPeer::PRIVACY_CONTEXT) {
$fieldName = "TagPeer::PRIVACY_CONTEXT";
}
if ($fieldName) {
$partnerIdCrit = $this->getCriterion(TagPeer::PARTNER_ID);
if ($partnerIdCrit && $partnerIdCrit->getComparison() == Criteria::EQUAL) {
$partnerId = $partnerIdCrit->getValue();
} else {
$partnerId = kCurrentContext::getCurrentPartnerId();
}
$value = Tag::getIndexedFieldValue($fieldName, $value, $partnerId);
}
if ($field == TagPeer::TAG && in_array($crit->getComparison(), array(Criteria::EQUAL, Criteria::IN))) {
$value = str_replace(kTagFlowManager::$specialCharacters, kTagFlowManager::$specialCharactersReplacement, $value);
}
return array($field, $crit->getComparison(), $value);
}
示例6: processKs
protected function processKs($ksStr, $requiredPermission = null)
{
try {
kCurrentContext::initKsPartnerUser($ksStr);
} catch (Exception $ex) {
KalturaLog::err($ex);
return false;
}
if (kCurrentContext::$ks_object->type != ks::SESSION_TYPE_ADMIN) {
KalturaLog::err('Ks is not admin');
return false;
}
try {
kPermissionManager::init(kConf::get('enable_cache'));
} catch (Exception $ex) {
if (strpos($ex->getCode(), 'INVALID_ACTIONS_LIMIT') === false) {
KalturaLog::err($ex);
return false;
}
}
if ($requiredPermission) {
if (!kPermissionManager::isPermitted(PermissionName::ADMIN_PUBLISHER_MANAGE)) {
KalturaLog::err('Ks is missing "ADMIN_PUBLISHER_MANAGE" permission');
return false;
}
}
return true;
}
示例7: notifyAction
/**
* @action notify
* @disableTags TAG_WIDGET_SESSION,TAG_ENTITLEMENT_ENTRY,TAG_ENTITLEMENT_CATEGORY
* @param int $id integration job id
*/
public function notifyAction($id)
{
$coreType = IntegrationPlugin::getBatchJobTypeCoreValue(IntegrationBatchJobType::INTEGRATION);
$batchJob = BatchJobPeer::retrieveByPK($id);
$invalidJobId = false;
$invalidKs = false;
if (!self::validateKs($batchJob)) {
$invalidKs = true;
KalturaLog::err("ks not valid for notifying job [{$id}]");
} elseif (!$batchJob) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] not found");
} elseif ($batchJob->getJobType() != $coreType) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] wrong type [" . $batchJob->getJobType() . "] expected [" . $coreType . "]");
} elseif ($batchJob->getStatus() != KalturaBatchJobStatus::ALMOST_DONE) {
$invalidJobId = true;
KalturaLog::err("Job [{$id}] wrong status [" . $batchJob->getStatus() . "] expected [" . KalturaBatchJobStatus::ALMOST_DONE . "]");
} elseif ($batchJob->getPartnerId() != kCurrentContext::getCurrentPartnerId()) {
$invalidKs = true;
KalturaLog::err("Job [{$id}] of wrong partner [" . $batchJob->getPartnerId() . "] expected [" . kCurrentContext::getCurrentPartnerId() . "]");
}
if ($invalidJobId) {
throw new KalturaAPIException(KalturaErrors::INVALID_BATCHJOB_ID, $id);
}
if ($invalidKs) {
throw new KalturaAPIException(KalturaIntegrationErrors::INTEGRATION_NOTIFY_FAILED);
}
kJobsManager::updateBatchJob($batchJob, KalturaBatchJobStatus::FINISHED);
}
示例8: validateForResponseProfile
public function validateForResponseProfile()
{
if (kEntitlementUtils::getEntitlementEnforcement()) {
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENABLE_RESPONSE_PROFILE_USER_CACHE, kCurrentContext::getCurrentPartnerId())) {
KalturaResponseProfileCacher::useUserCache();
return;
}
throw new KalturaAPIException(KalturaErrors::CANNOT_LIST_RELATED_ENTITLED_WHEN_ENTITLEMENT_IS_ENABLE, get_class($this));
}
}
示例9: setDefaultCriteriaFilter
/**
* Creates default criteria filter
*/
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(KuserKgroupPeer::OM_CLASS);
$c->addAnd(KuserKgroupPeer::STATUS, array(KuserKgroupStatus::DELETED), Criteria::NOT_IN);
$c->addAnd(KuserKgroupPeer::PARTNER_ID, kCurrentContext::getCurrentPartnerId(), Criteria::EQUAL);
self::$s_criteria_filter->setFilter($c);
}
示例10: validateForUsage
public function validateForUsage($sourceObject, $propertiesToSkip = array())
{
parent::validateForUsage($sourceObject, $propertiesToSkip);
$this->validatePropertyNotNull('eventNotificationTemplateId');
myPartnerUtils::addPartnerToCriteria('EventNotificationTemplate', kCurrentContext::getCurrentPartnerId(), true);
$eventNotificationTemplate = EventNotificationTemplatePeer::retrieveByPK($this->eventNotificationTemplateId);
if (is_null($eventNotificationTemplate)) {
throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $this->eventNotificationTemplateId);
}
}
示例11: validateMetadataObjects
public static function validateMetadataObjects($profileField, $objectIds, &$errorMessage)
{
/** @var MetadataProfileField $profileField */
$partnerId = kCurrentContext::getCurrentPartnerId();
$dbObjects = kuserPeer::getKuserByPartnerAndUids($partnerId, $objectIds);
if (count($dbObjects) != count($objectIds)) {
$errorMessage = 'One of the following objects: ' . implode(', ', $objectIds) . ' was not found';
return false;
}
return true;
}
示例12: addAction
/**
* Add a new scheduled task profile
*
* @action add
* @param KalturaScheduledTaskProfile $scheduledTaskProfile
* @return KalturaScheduledTaskProfile
*
* @disableRelativeTime $scheduledTaskProfile
*/
public function addAction(KalturaScheduledTaskProfile $scheduledTaskProfile)
{
/* @var $dbScheduledTaskProfile ScheduledTaskProfile */
$dbScheduledTaskProfile = $scheduledTaskProfile->toInsertableObject();
$dbScheduledTaskProfile->setPartnerId(kCurrentContext::getCurrentPartnerId());
$dbScheduledTaskProfile->save();
// return the saved object
$scheduledTaskProfile = new KalturaScheduledTaskProfile();
$scheduledTaskProfile->fromObject($dbScheduledTaskProfile, $this->getResponseProfile());
return $scheduledTaskProfile;
}
示例13: validateForInsert
public function validateForInsert($propertiesToSkip = array())
{
$partnerId = kCurrentContext::getCurrentPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
throw new KalturaAPIException(KalturaErrors::PARTNER_NOT_FOUND, $partnerId);
}
if (!$partner->getPluginEnabled(FreewheelGenericDistributionPlugin::DEPENDENTS_ON_PLUGIN_NAME_CUE_POINT)) {
throw new KalturaAPIException(KalturaErrors::PLUGIN_NOT_AVAILABLE_FOR_PARTNER, FreewheelGenericDistributionPlugin::DEPENDENTS_ON_PLUGIN_NAME_CUE_POINT, $partnerId);
}
return parent::validateForInsert($propertiesToSkip);
}
示例14: setDefaultCriteriaFilter
public static function setDefaultCriteriaFilter()
{
if (self::$s_criteria_filter == null) {
self::$s_criteria_filter = new criteriaFilter();
}
$c = KalturaCriteria::create(UserEntryPeer::OM_CLASS);
// when session is not admin, allow access to user's userEntries only
if (kCurrentContext::$ks && !kCurrentContext::$is_admin_session) {
$c->addAnd(UserEntryPeer::KUSER_ID, kCurrentContext::getCurrentKsKuserId());
}
self::$s_criteria_filter->setFilter($c);
}
示例15: validateForUsage
public function validateForUsage($sourceObject, $propertiesToSkip = array())
{
parent::validateForUsage($sourceObject, $propertiesToSkip);
$this->validatePropertyNotNull('metadataProfileId');
$this->validatePropertyNotNull('metadataObjectType');
$this->validatePropertyNotNull('xslt');
myPartnerUtils::addPartnerToCriteria('MetadataProfile', kCurrentContext::getCurrentPartnerId(), true);
$metadataProfile = MetadataProfilePeer::retrieveByPK($this->metadataProfileId);
if (is_null($metadataProfile)) {
throw new KalturaAPIException(MetadataErrors::METADATA_PROFILE_NOT_FOUND, $this->metadataProfileId);
}
}