本文整理汇总了PHP中assetPeer::retrieveByEntryIdAndExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveByEntryIdAndExtension方法的具体用法?PHP assetPeer::retrieveByEntryIdAndExtension怎么用?PHP assetPeer::retrieveByEntryIdAndExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveByEntryIdAndExtension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$wams_asset_id = NULL;
$wams_url = NULL;
$entry_id = $this->getRequestParameter("entry_id");
$type = $this->getRequestParameter("type");
$ks = $this->getRequestParameter("ks");
$file_sync = null;
$ret_file_name = "name";
$referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($referrer);
if (!is_string($referrer)) {
// base64_decode can return binary data
$referrer = "";
}
$request_file_name = $this->getRequestParameter("file_name");
if ($request_file_name) {
$ret_file_name = $request_file_name;
}
$direct_serve = $this->getRequestParameter("direct_serve");
$entry = null;
if ($ks) {
try {
kCurrentContext::initKsPartnerUser($ks);
} catch (Exception $ex) {
KExternalErrors::dieError(KExternalErrors::INVALID_KS);
}
} else {
$entry = kCurrentContext::initPartnerByEntryId($entry_id);
if (!$entry) {
die;
}
}
kEntitlementUtils::initEntitlementEnforcement();
if (!$entry) {
$entry = entryPeer::retrieveByPK($entry_id);
if (!$entry) {
die;
}
} else {
if (!kEntitlementUtils::isEntryEntitled($entry)) {
die;
}
}
myPartnerUtils::blockInactivePartner($entry->getPartnerId());
$securyEntryHelper = new KSecureEntryHelper($entry, $ks, $referrer, accessControlContextType::DOWNLOAD);
$securyEntryHelper->validateForDownload();
// Rmoved by Tan-Tan - asked by Eran
// // allow access only via cdn unless these are documents (due to the current implementation of convert ppt2swf)
// if ($entry->getType() != entryType::DOCUMENT && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_IMAGE)
// {
// requestUtils::enforceCdnDelivery($entry->getPartnerId());
// }
// relocate = did we use the redirect and added the extension to the name
$relocate = $this->getRequestParameter("relocate");
if ($ret_file_name == "name") {
$ret_file_name = $entry->getName();
}
if ($ret_file_name) {
//rawurlencode to content-disposition filename to handle spaces and other characters across different browsers
//$name = rawurlencode($ret_file_name);
// 19.04.2009 (Roman) - url encode is not needed when the filename in Content-Disposition header is in quotes
// IE6/FF3/Chrome - Will show the filename correctly
// IE7 - Will show the filename with underscores instead of spaces (this is better than showing %20)
$name = $ret_file_name;
if ($name) {
if ($relocate) {
// if we have a good file extension (from the first time) - use it in the content-disposition
// in some browsers it will be stronger than the URL's extension
$file_ext = pathinfo($relocate, PATHINFO_EXTENSION);
$name .= ".{$file_ext}";
}
if (!$direct_serve) {
header("Content-Disposition: attachment; filename=\"{$name}\"");
}
}
} else {
$ret_file_name = $entry_id;
}
$format = $this->getRequestParameter("format");
if ($type == "download" && $format && $entry->getType() != entryType::DOCUMENT) {
// this is a video for a specifc extension - use the proper flavorAsset
$flavor_asset = assetPeer::retrieveByEntryIdAndExtension($entry_id, $format);
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, true);
} else {
header('KalturaRaw: no flavor asset for extension');
header("HTTP/1.0 404 Not Found");
die;
}
$archive_file = $file_sync->getFullPath();
$mime_type = kFile::mimeType($archive_file);
kFile::dumpFile($archive_file, $mime_type);
}
// TODO - move to a different action - document should be plugin
if ($entry->getType() == entryType::DOCUMENT) {
//.........这里部分代码省略.........