本文整理汇总了PHP中requestUtils::getCdnHost方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::getCdnHost方法的具体用法?PHP requestUtils::getCdnHost怎么用?PHP requestUtils::getCdnHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requestUtils
的用法示例。
在下文中一共展示了requestUtils::getCdnHost方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$limit = $this->getP("page_size", 20);
$limit = min($limit, 100);
$page = $this->getP("page", 1);
$offset = ($page - 1) * $limit;
$c = new Criteria();
$c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id);
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$c->addDescendingOrderByColumn(BatchJobPeer::ID);
$count = BatchJobPeer::doCount($c);
$c->setLimit($limit);
$c->setOffset($offset);
$jobs = BatchJobPeer::doSelect($c);
$obj = array();
foreach ($jobs as $job) {
$jobData = $job->getData();
if (!$jobData instanceof kBulkUploadJobData) {
continue;
}
$bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId());
$obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv");
}
$this->addMsg("count", $count);
$this->addMsg("page_size", $limit);
$this->addMsg("page", $page);
$this->addMsg("bulk_uploads", $obj);
}
示例2: fromObject
public function fromObject($batchJob)
{
if ($batchJob->getJobType() != BatchJobType::BULKUPLOAD) {
throw new Exception("Bulk upload object can be initialized from bulk upload job only");
}
$this->id = $batchJob->getId();
$this->uploadedOn = $batchJob->getCreatedAt(null);
$this->status = $batchJob->getStatus();
$this->error = $batchJob->getDescription();
$this->logFileUrl = requestUtils::getHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/log";
$this->csvFileUrl = requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/csv";
$jobData = $batchJob->getData();
if ($jobData instanceof kBulkUploadJobData) {
$this->uploadedBy = $jobData->getUploadedBy();
$this->uploadedByUserId = $jobData->getUserId();
$this->numOfEntries = $jobData->getNumOfEntries();
}
// $results = BulkUploadResultPeer::retrieveByBulkUploadId($this->id);
// $this->results = KalturaBulkUploadResultArray::fromBulkUploadResultArray($results);
}
示例3: getCdnHost
public static function getCdnHost($partner_id, $protocol = null, $hostType = null)
{
// in case the request came through https, force https url
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
}
// temporary default is http since the system is not aligned to use https in all of its components (e.g. kmc)
// right now, if a partner cdnHost is set to https:// the kmc wont work well if we reply with https prefix to its requests
if ($protocol === null) {
$protocol = 'http';
}
$partner = PartnerPeer::retrieveByPK($partner_id);
if ($partner) {
$whiteListHost = self::getWhiteListHost($partner);
if (!is_null($whiteListHost)) {
$cdnHost = $protocol . '://' . $whiteListHost;
if (isset($_SERVER['SERVER_PORT'])) {
$cdnHost .= ":" . $_SERVER['SERVER_PORT'];
}
return $cdnHost;
}
}
switch ($hostType) {
case 'thumbnail':
if ($partner && $partner->getThumbnailHost()) {
return preg_replace('/^https?/', $protocol, $partner->getThumbnailHost());
}
if ($partner && $partner->getCdnHost()) {
return preg_replace('/^https?/', $protocol, $partner->getCdnHost());
}
return requestUtils::getThumbnailCdnHost($protocol);
case 'api':
if ($protocol == 'https') {
$apiHost = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
return 'https://' . $apiHost;
} else {
$apiHost = kConf::hasParam('cdn_api_host') ? kConf::get('cdn_api_host') : kConf::get('www_host');
return 'http://' . $apiHost;
}
break;
default:
if ($partner && $partner->getCdnHost()) {
return preg_replace('/^https?/', $protocol, $partner->getCdnHost());
}
return requestUtils::getCdnHost($protocol);
}
}
示例4: getCdnHost
public static function getCdnHost($partner_id, $protocol = null)
{
// in case the request came through https, force https url
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
}
$partner = PartnerPeer::retrieveByPK($partner_id);
if (!$partner || !$partner->getCdnHost()) {
return requestUtils::getCdnHost($protocol === null ? 'http' : $protocol);
}
$cdnHost = $partner->getCdnHost();
// temporary default is http since the system is not aligned to use https in all of its components (e.g. kmc)
// right now, if a partner cdnHost is set to https:// the kmc wont work well if we reply with https prefix to its requests
if ($protocol === null) {
$protocol = 'http';
}
// if a protocol was set manually (or by the temporary http default above) use it instead of the partner setting
if ($protocol !== null) {
$cdnHost = preg_replace('/^https?/', $protocol, $cdnHost);
}
return $cdnHost;
}
示例5: execute
//.........这里部分代码省略.........
}
// use limelight mediavault if either security policy requires it or if we're trying to seek within the video
if ($entry->getSecurityPolicy() || $seek_from_bytes !== -1) {
// we have three options:
// arrived through limelight mediavault url - the url is secured
// arrived directly through limelight (not secured through mediavault) - enforce ks and redirect to mediavault url
// didnt use limelight - enforce ks
// the cdns are configured to authenticate request for /s/....
// check if we're already in a redirected secure link using the "/s/" prefix
$secure_request = substr($request, 0, 3) == "/s/";
if ($secure_request && ($cdn_name == "limelight" || $cdn_name == "level3")) {
// request was validated by cdn let it through
} else {
// extract ks
$ks_str = $this->getRequestParameter("ks", "");
if ($entry->getSecurityPolicy()) {
if (!$ks_str) {
$this->logMessage("flvclipper - no KS");
die;
}
$ks = kSessionUtils::crackKs($ks_str);
if (!$ks) {
$this->logMessage("flvclipper - invalid ks [{$ks_str}]");
die;
}
$matched_privs = $ks->verifyPrivileges("sview", $entry_id);
$this->logMessage("flvclipper - verifyPrivileges name [sview], priv [{$entry_id}] [{$matched_privs}]");
if (!$matched_privs) {
$this->logMessage("flvclipper - doesnt not match required privlieges [{$ks_str}]");
die;
}
}
if ($cdn_name == "limelight") {
$ll_url = requestUtils::getCdnHost() . "/s{$request}" . $flv_extension;
$secret = kConf::get("limelight_madiavault_password");
$expire = "&e=" . (time() + 120);
$ll_url .= $expire;
$fs = $seek_from_bytes == -1 ? "" : "&fs={$seek_from_bytes}";
$ll_url .= "&h=" . md5("{$secret}{$ll_url}") . $fs;
//header("Location: $ll_url");
$this->redirect($ll_url);
} else {
if ($cdn_name == "level3") {
$level3_url = $request . $flv_extension;
if ($entry->getSecurityPolicy()) {
$level3_url = "/s{$level3_url}";
// set expire time in GMT hence the date("Z") offset
$expire = "&nva=" . strftime("%Y%m%d%H%M%S", time() - date("Z") + 30);
$level3_url .= $expire;
$secret = kConf::get("level3_authentication_key");
$hash = "0" . substr(self::hmac('sha1', $secret, $level3_url), 0, 20);
$level3_url .= "&h={$hash}";
}
$level3_url .= $seek_from_bytes == -1 ? "" : "&start={$seek_from_bytes}";
header("Location: {$level3_url}");
die;
} else {
if ($cdn_name == "akamai") {
$akamai_url = $request . $flv_extension;
// if for some reason we didnt set our accurate $seek_from_timestamp reset it to the requested seek_from
if ($seek_from_timestamp == -1) {
$seek_from_timestamp = $seek_from;
}
$akamai_url .= $seek_from_bytes == -1 ? "" : "&aktimeoffset=" . floor($seek_from_timestamp / 1000);
header("Location: {$akamai_url}");
die;
示例6:
<div id="main">
<div id="flash_wrap" class="flash_wrap">
<div id="kcms"></div>
</div><!-- flash_wrap -->
<div id="server_wrap">
<iframe frameborder="0" id="server_frame" height="100%" width="100%"></iframe>
</div> <!-- server_wrap -->
</div><!-- main -->
<!--[if lte IE 7]>
<script type="text/javascript" src="<?php
echo requestUtils::getCdnHost(requestUtils::getRequestProtocol());
?>
/lib/js/json2.min.js"></script>
<script type="text/javascript" src="<?php
echo requestUtils::getCdnHost(requestUtils::getRequestProtocol());
?>
/lib/js/localStorage.min.js"></script>
<![endif]-->
<?php
if ($previewEmbedV2) {
?>
<!-- Preview & Embed Modal -->
<div id="previewModal" class="modal preview_embed" ng-controller="PreviewCtrl">
<div class="title clearfix">
<h2></h2>
<span class="close icon"></span>
<a class="help icon" href="javascript:kmc.utils.openHelp('section_pne');"></a>
</div>
<div class="content row-fluid">
<div class="span4 options form-horizontal">