本文整理汇总了PHP中asset::getFlavorParamsId方法的典型用法代码示例。如果您正苦于以下问题:PHP asset::getFlavorParamsId方法的具体用法?PHP asset::getFlavorParamsId怎么用?PHP asset::getFlavorParamsId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asset
的用法示例。
在下文中一共展示了asset::getFlavorParamsId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setContextDataFlavorAssets
private function setContextDataFlavorAssets($flavorTags)
{
$flavorParamsIds = null;
$flavorParamsNotIn = false;
if (!$this->isAdmin) {
foreach ($this->contextDataResult->getActions() as $action) {
if ($action->getType() == RuleActionType::BLOCK) {
//in case of block action do not set the list of flavors
return;
}
if ($action->getType() == RuleActionType::LIMIT_FLAVORS) {
/* @var $action kAccessControlLimitFlavorsAction */
$flavorParamsIds = explode(',', $action->getFlavorParamsIds());
$flavorParamsNotIn = $action->getIsBlockedList();
}
}
}
$flavorAssets = array();
if (is_null($this->asset)) {
if (count($flavorParamsIds)) {
$flavorAssets = assetPeer::retrieveReadyByEntryIdAndFlavorParams($this->entry->getId(), $flavorParamsIds, $flavorParamsNotIn);
} else {
$flavorAssets = assetPeer::retrieveFlavorsByEntryIdAndStatus($this->entry->getId(), null, array(flavorAsset::ASSET_STATUS_READY));
}
} else {
$flavorAllowed = true;
if (count($flavorParamsIds)) {
$flavorAllowed = $this->isFlavorAllowed($this->asset->getFlavorParamsId(), $flavorParamsIds, $flavorParamsNotIn);
}
if ($flavorAllowed) {
$flavorAssets[] = $this->asset;
}
}
$this->filterFlavorAssetsByTags($flavorAssets, $flavorTags);
}
示例2: setContextDataFlavorAssets
private function setContextDataFlavorAssets($flavorTags)
{
if ($this->entry->getType() == entryType::PLAYLIST && $this->entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_TEXT) {
list($entryIds, $durations, $mediaEntry) = myPlaylistUtils::executeStitchedPlaylist($this->entry);
if (!$mediaEntry) {
return;
}
$mediaEntryId = $mediaEntry->getId();
$this->msDuration = array_sum($durations);
} else {
$mediaEntryId = $this->entry->getId();
$this->msDuration = $this->entry->getLengthInMsecs();
}
$flavorParamsIds = null;
$flavorParamsNotIn = false;
if (!$this->isAdmin) {
foreach ($this->contextDataResult->getActions() as $action) {
if ($action->getType() == RuleActionType::BLOCK) {
//in case of block action do not set the list of flavors
return;
}
if ($action->getType() == RuleActionType::LIMIT_FLAVORS) {
/* @var $action kAccessControlLimitFlavorsAction */
$flavorParamsIds = explode(',', $action->getFlavorParamsIds());
$flavorParamsNotIn = $action->getIsBlockedList();
}
}
}
$flavorAssets = array();
if (is_null($this->asset)) {
if (count($flavorParamsIds)) {
$flavorAssets = assetPeer::retrieveReadyByEntryIdAndFlavorParams($mediaEntryId, $flavorParamsIds, $flavorParamsNotIn);
} else {
$flavorAssets = assetPeer::retrieveFlavorsByEntryIdAndStatus($mediaEntryId, null, array(flavorAsset::ASSET_STATUS_READY));
}
if ($mediaEntryId != $this->entry->getId()) {
// hack: setting the entry id of the flavors to the original playlist id
// since the player uses it in the playManifest url
foreach ($flavorAssets as $flavorAsset) {
$flavorAsset->setEntryId($this->entry->getId());
}
}
} else {
$flavorAllowed = true;
if (count($flavorParamsIds)) {
$flavorAllowed = $this->isFlavorAllowed($this->asset->getFlavorParamsId(), $flavorParamsIds, $flavorParamsNotIn);
}
if ($flavorAllowed) {
$flavorAssets[] = $this->asset;
}
}
$this->filterFlavorAssetsByTags($flavorAssets, $flavorTags);
}
示例3: enforceDelivery
/**
* Ensure the request for media arrived in a way approved by the partner.
* this may include restricting to a specific cdn, enforcing token usage etc..
* Die in case of a breach.
*
* @param entry $entry
* @param asset $asset
*/
public static function enforceDelivery($entry, $asset = null)
{
// block inactive partner
$partnerId = $entry->getPartnerId();
self::blockInactivePartner($partnerId);
// validate serve access control
$flavorParamsId = $asset ? $asset->getFlavorParamsId() : null;
$secureEntryHelper = new KSecureEntryHelper($entry, null, null, ContextType::SERVE);
$secureEntryHelper->validateForServe($flavorParamsId);
// enforce delivery
$partner = PartnerPeer::retrieveByPK($partnerId);
// Note: Partner was already loaded by blockInactivePartner, no need to check for null
$restricted = DeliveryProfilePeer::isRequestRestricted($partner);
if ($restricted) {
KalturaLog::log("DELIVERY_METHOD_NOT_ALLOWED partner [{$partnerId}]");
KExternalErrors::dieError(KExternalErrors::DELIVERY_METHOD_NOT_ALLOWED);
}
}
示例4: isAssetAllowed
public function isAssetAllowed(asset $asset)
{
if ($this->ks && $this->ks->verifyPrivileges(ks::PRIVILEGE_DOWNLOAD_ASSET, $asset->getId())) {
return true;
}
return $this->isFlavorParamsAllowed($asset->getFlavorParamsId());
}