本文整理汇总了PHP中requestUtils::getThumbnailCdnHost方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::getThumbnailCdnHost方法的具体用法?PHP requestUtils::getThumbnailCdnHost怎么用?PHP requestUtils::getThumbnailCdnHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requestUtils
的用法示例。
在下文中一共展示了requestUtils::getThumbnailCdnHost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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 || !$partner->getCdnHost()) {
return $hostType == "thumbnail" ? requestUtils::getThumbnailCdnHost($protocol) : requestUtils::getCdnHost($protocol);
}
$cdnHost = $partner->getCdnHost();
// if a protocol was set manually (or by the temporary http default above) use it instead of the partner setting
$cdnHost = preg_replace('/^https?/', $protocol, $cdnHost);
return $cdnHost;
}