本文整理汇总了PHP中kFile::cacheRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP kFile::cacheRedirect方法的具体用法?PHP kFile::cacheRedirect怎么用?PHP kFile::cacheRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFile
的用法示例。
在下文中一共展示了kFile::cacheRedirect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$partner_host = myPartnerUtils::getHost($partner_id);
$partner_cdnHost = myPartnerUtils::getCdnHost($partner_id);
$use_cdn = $uiConf->getUseCdn();
$host = $use_cdn ? $partner_cdnHost : $partner_host;
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$url = $ui_conf_html5_url;
// absolute URL
} else {
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php";
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix
if (kString::endsWith($url, "mwEmbedLoader.php")) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
requestUtils::sendCachingHeaders(60);
header("Pragma:");
kFile::cacheRedirect($url);
header("Location:{$url}");
die;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:embedIframeJsAction.class.php
示例2: dumpFile
private function dumpFile($file_path, $file_name, $wams_asset_id = null, $wams_url = null)
{
$relocate = $this->getRequestParameter("relocate");
$directServe = $this->getRequestParameter("direct_serve");
if (!$relocate) {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "?") !== false) {
$url .= "&relocate=";
} else {
$url .= "/relocate/";
}
$url .= $this->encodeUrl($file_name);
kFile::cacheRedirect($url);
header("Location: {$url}");
die;
} else {
if (!$directServe) {
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
}
if (!empty($wams_asset_id)) {
$fileSync = FileSyncPeer::retrieveByWamsAssetId($wams_asset_id);
kWAMS::getInstance($fileSync->getPartnerId())->dumpFile($wams_asset_id, pathinfo($file_name, PATHINFO_EXTENSION));
} else {
$mime_type = kFile::mimeType($file_path);
kFile::dumpFile($file_path, $mime_type);
}
}
}
示例3: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$widget_id = $this->getRequestParameter("widget_id", '_' . $partner_id);
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "https" : "http";
$host = myPartnerUtils::getCdnHost($partner_id, $protocol, 'api');
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
$autoEmbed = $this->getRequestParameter('autoembed');
$iframeEmbed = $this->getRequestParameter('iframeembed');
$scriptName = $iframeEmbed ? 'mwEmbedFrame.php' : 'mwEmbedLoader.php';
if ($ui_conf_html5_url && $iframeEmbed) {
$ui_conf_html5_url = str_replace('mwEmbedLoader.php', 'mwEmbedFrame.php', $ui_conf_html5_url);
}
$relativeUrl = true;
// true if ui_conf html5_url is relative (doesnt start with an http prefix)
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$relativeUrl = false;
$url = $ui_conf_html5_url;
// absolute URL
} else {
if (!$iframeEmbed) {
$host = "{$protocol}://" . kConf::get('html5lib_host') . "/";
}
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/" . $scriptName;
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php/mwEmbedFrame.php suffix
if (kString::endsWith($url, $scriptName)) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
if (!$autoEmbed) {
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
}
header("pragma:");
if ($iframeEmbed) {
$url .= (strpos($url, "?") === false ? "?" : "&") . 'wid=' . $widget_id . '&' . $_SERVER["QUERY_STRING"];
} else {
$params = "protocol={$protocol}&" . $_SERVER["QUERY_STRING"];
$url .= (strpos($url, "?") === false ? "?" : "&") . $params;
if ($relativeUrl) {
header('Content-Type: application/javascript');
kFileUtils::dumpUrl($url, true, false, array("X-Forwarded-For" => requestUtils::getRemoteAddress()));
}
}
requestUtils::sendCachingHeaders(60, true, time());
kFile::cacheRedirect($url);
header("Location:{$url}");
KExternalErrors::dieGracefully();
}
示例4: dumpFile
private function dumpFile($file_path, $file_name, $limit_file_size = 0)
{
$file_name = str_replace("\n", ' ', $file_name);
$relocate = $this->getRequestParameter("relocate");
$directServe = $this->getRequestParameter("direct_serve");
if (!$relocate) {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "?") !== false) {
$url .= "&relocate=";
} else {
$url .= "/relocate/";
}
$url .= kString::stripInvalidUrlChars($file_name);
kFile::cacheRedirect($url);
header("Location: {$url}");
KExternalErrors::dieGracefully();
} else {
if (!$directServe) {
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
}
$mime_type = kFile::mimeType($file_path);
kFileUtils::dumpFile($file_path, $mime_type, null, $limit_file_size);
}
}