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


PHP requestUtils::sendCachingHeaders方法代码示例

本文整理汇总了PHP中requestUtils::sendCachingHeaders方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::sendCachingHeaders方法的具体用法?PHP requestUtils::sendCachingHeaders怎么用?PHP requestUtils::sendCachingHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在requestUtils的用法示例。


在下文中一共展示了requestUtils::sendCachingHeaders方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dieError

 public static function dieError($errorCode, $message = null)
 {
     $description = self::$errorDescriptionMap[$errorCode];
     $args = func_get_args();
     if (count($args) > 1) {
         array_shift($args);
         $description = @call_user_func_array('sprintf', array_merge(array($description), $args));
     }
     if ($message) {
         $description .= ", {$message}";
     }
     KalturaLog::err("exiting on error {$errorCode} - {$description}");
     $headers = array();
     if (self::$responseCode) {
         $headers[] = self::$errorCodeMap[self::$responseCode];
     }
     $headers[] = "X-Kaltura-App: exiting on error {$errorCode} - {$description}";
     foreach ($headers as $header) {
         header($header);
     }
     header("X-Kaltura:error-{$errorCode}");
     $headers[] = "X-Kaltura:cached-error-{$errorCode}";
     self::terminateDispatch();
     if ($errorCode != self::ACCESS_CONTROL_RESTRICTED && $errorCode != self::IP_COUNTRY_BLOCKED && $_SERVER["REQUEST_METHOD"] == "GET") {
         requestUtils::sendCachingHeaders(self::CACHE_EXPIRY, true, time());
         if (function_exists('apc_store')) {
             $protocol = infraRequestUtils::getProtocol();
             $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
             $uri = $_SERVER["REQUEST_URI"];
             apc_store("exterror-{$protocol}://{$host}{$uri}", $headers, self::CACHE_EXPIRY);
         }
     }
     die;
 }
开发者ID:AdiTal,项目名称:server,代码行数:34,代码来源:KExternalErrors.class.php

示例2: 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

示例3: output

 /**
  * @param string $playbackContext
  */
 public function output($playbackContext)
 {
     if ($this->tokenizer) {
         $this->tokenizer->setPlaybackContext($playbackContext);
     }
     $this->tokenizeUrls();
     $headers = $this->getHeaders();
     foreach ($headers as $header) {
         header($header);
     }
     requestUtils::sendCachingHeaders(kApiCache::hasExtraFields() ? 0 : $this->cachingHeadersAge);
     echo $this->getBody();
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:kManifestRenderers.php

示例4: dieError

 public static function dieError($errorCode, $message = null)
 {
     $description = self::$errorDescriptionMap[$errorCode];
     $args = func_get_args();
     if (count($args) > 1) {
         array_shift($args);
         $description = @call_user_func_array('sprintf', array_merge(array($description), $args));
     }
     if ($message) {
         $description .= ", {$message}";
     }
     KalturaLog::err("exiting on error {$errorCode} - {$description}");
     header("X-Kaltura:error-{$errorCode}");
     header("X-Kaltura-App: exiting on error {$errorCode} - {$description}");
     if ($errorCode != self::ACCESS_CONTROL_RESTRICTED && $errorCode != self::IP_COUNTRY_BLOCKED) {
         requestUtils::sendCachingHeaders(60);
     }
     die;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:19,代码来源:KExternalErrors.class.php

示例5: 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();
 }
开发者ID:DBezemer,项目名称:server,代码行数:80,代码来源:embedIframeJsAction.class.php


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