本文整理汇总了PHP中kEntitlementUtils::getInitialized方法的典型用法代码示例。如果您正苦于以下问题:PHP kEntitlementUtils::getInitialized方法的具体用法?PHP kEntitlementUtils::getInitialized怎么用?PHP kEntitlementUtils::getInitialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kEntitlementUtils
的用法示例。
在下文中一共展示了kEntitlementUtils::getInitialized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterSelectResults
/**
* Override in order to filter objects returned from doSelect.
*
* @param array $selectResults The array of objects to filter.
* @param Criteria $criteria
*/
public static function filterSelectResults(&$selectResults, Criteria $criteria)
{
if (empty($selectResults)) {
return;
}
$partnerId = kCurrentContext::getCurrentPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if ($partner && $partner->getShouldApplyAccessControlOnEntryMetadata() && !kCurrentContext::$is_admin_session) {
if (is_null(self::$accessControlScope)) {
self::$accessControlScope = new accessControlScope();
self::$accessControlScope->setContexts(array(ContextType::METADATA));
}
$selectResults = array_filter($selectResults, array('entryPeer', 'filterByAccessControl'));
if ($criteria instanceof KalturaCriteria) {
$criteria->setRecordsCount(count($selectResults));
}
}
$removedRecordsCount = 0;
if (!kEntitlementUtils::getEntitlementEnforcement() && !is_null(kCurrentContext::$ks) || !self::$filerResults || !kEntitlementUtils::getInitialized()) {
// if initEntitlement hasn't run - skip filters.
return parent::filterSelectResults($selectResults, $criteria);
}
if (is_null(kCurrentContext::$ks) && count($selectResults)) {
$entry = $selectResults[0];
$partner = $entry->getPartner();
if (!$partner) {
throw new kCoreException('entry partner not found');
}
if (!$partner->getDefaultEntitlementEnforcement() || !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partner->getId())) {
return parent::filterSelectResults($selectResults, $criteria);
}
}
foreach ($selectResults as $key => $entry) {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
unset($selectResults[$key]);
$removedRecordsCount++;
}
}
if ($criteria instanceof KalturaCriteria) {
$recordsCount = $criteria->getRecordsCount();
$criteria->setRecordsCount($recordsCount - $removedRecordsCount);
}
self::$filerResults = false;
parent::filterSelectResults($selectResults, $criteria);
}
示例2: filterSelectResults
/**
* Override in order to filter objects returned from doSelect.
*
* @param array $selectResults The array of objects to filter.
* @param Criteria $criteria
*/
public static function filterSelectResults(&$selectResults, Criteria $criteria)
{
if (!kEntitlementUtils::getEntitlementEnforcement() && !is_null(kCurrentContext::$ks) || !self::$filerResults || !kEntitlementUtils::getInitialized()) {
// if initEntitlement hasn't run - skip filters.
return parent::filterSelectResults($selectResults, $criteria);
}
KalturaLog::debug('Entitlement: Filter Results');
if (is_null(kCurrentContext::$ks) && count($selectResults)) {
$entry = $selectResults[0];
$partner = $entry->getPartner();
if (!$partner) {
throw new kCoreException('entry partner not found');
}
if (!$partner->getDefaultEntitlementEnforcement() || !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partner->getId())) {
return parent::filterSelectResults($selectResults, $criteria);
}
}
$removedRecordsCount = 0;
foreach ($selectResults as $key => $entry) {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
unset($selectResults[$key]);
$removedRecordsCount++;
}
}
if ($criteria instanceof KalturaCriteria) {
$recordsCount = $criteria->getRecordsCount();
$criteria->setRecordsCount($recordsCount - $removedRecordsCount);
}
self::$filerResults = false;
parent::filterSelectResults($selectResults, $criteria);
KalturaLog::debug('Entitlement: Filter Results - done');
}