当前位置: 首页>>代码示例>>PHP>>正文


PHP requestUtils::getThumbnailCdnHost方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:dozernz,项目名称:server,代码行数:47,代码来源:myPartnerUtils.class.php

示例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;
 }
开发者ID:AdiTal,项目名称:server,代码行数:20,代码来源:myPartnerUtils.class.php


注:本文中的requestUtils::getThumbnailCdnHost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。