本文整理汇总了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);
}
}