本文整理匯總了PHP中kEntitlementUtils::entitlementEnforcement方法的典型用法代碼示例。如果您正苦於以下問題:PHP kEntitlementUtils::entitlementEnforcement方法的具體用法?PHP kEntitlementUtils::entitlementEnforcement怎麽用?PHP kEntitlementUtils::entitlementEnforcement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kEntitlementUtils
的用法示例。
在下文中一共展示了kEntitlementUtils::entitlementEnforcement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initEntitlementEnforcement
/**
* Set Entitlement Enforcement - if entitelement is enabled \ disabled in this session
* @param int $categoryId
* @param int $kuser
* @return bool
*/
public static function initEntitlementEnforcement($partnerId = null, $enableEntit = null)
{
self::$initialized = true;
if (is_null($partnerId)) {
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
}
if (is_null($partnerId)) {
return;
}
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
return;
}
if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partnerId)) {
return;
}
$partnerDefaultEntitlementEnforcement = $partner->getDefaultEntitlementEnforcement();
// default entitlement scope is true - enable.
if (is_null($partnerDefaultEntitlementEnforcement)) {
$partnerDefaultEntitlementEnforcement = true;
}
self::$entitlementEnforcement = $partnerDefaultEntitlementEnforcement;
$ksString = kCurrentContext::$ks ? kCurrentContext::$ks : '';
if ($ksString != '') {
$ks = ks::fromSecureString($ksString);
$enableEntitlement = $ks->getDisableEntitlement();
if ($enableEntitlement) {
self::$entitlementEnforcement = false;
}
$enableEntitlement = $ks->getEnableEntitlement();
if ($enableEntitlement) {
self::$entitlementEnforcement = true;
}
}
if (!is_null($enableEntit)) {
if ($enableEntit) {
self::$entitlementEnforcement = true;
} else {
self::$entitlementEnforcement = false;
}
}
if (self::$entitlementEnforcement) {
KalturaCriterion::enableTag(KalturaCriterion::TAG_ENTITLEMENT_ENTRY);
KalturaCriterion::enableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
}
}