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


PHP Zend_Controller_Request_Abstract::isSecure方法代码示例

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


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

示例1: postDispatch

 /**
  * Trigger post dispatch plugins hooks
  *
  * @param Zend_Controller_Request_Abstract $request
  */
 public function postDispatch(Zend_Controller_Request_Abstract $request)
 {
     $this->_callPlugins(self::POSTDISPATCH_METHOD);
     //replace http with https for internal links if requested via https
     if ($request->isSecure()) {
         $websiteConfig = Zend_Registry::get('website');
         $body = strtr($this->_response->getBody(), array(Zend_Controller_Request_Http::SCHEME_HTTP . '://' . $websiteConfig['url'] => Zend_Controller_Request_Http::SCHEME_HTTPS . '://' . $websiteConfig['url']));
         $this->_response->setBody($body);
     }
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:15,代码来源:Plugin.php

示例2: _secureUrl

 /**
  * Check the request to see if it is secure.  If it isn't
  * rebuild a secure url, redirect and exit.
  *
  * @param Zend_Controller_Request_Abstract $request
  * @return void
  * @author Travis Boudreaux
  */
 protected function _secureUrl(Zend_Controller_Request_Abstract $request)
 {
     $server = $request->getServer();
     $hostname = $server['HTTP_HOST'];
     if (!$request->isSecure()) {
         //url scheme is not secure so we rebuild url with secureScheme
         $url = Zend_Controller_Request_Http::SCHEME_HTTPS . "://" . $hostname . $request->getPathInfo();
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         $redirector->setGoToUrl($url);
         $redirector->redirectAndExit();
     }
 }
开发者ID:abtris,项目名称:zfcore,代码行数:20,代码来源:Ssl.php

示例3: checkRequest

 /**
  * Only GET requests can be processed.
  * Also check headers for HTTPS and ignore caching for sessions.
  *
  * @param \Zend_Controller_Request_Abstract $request
  */
 protected function checkRequest(\Zend_Controller_Request_Abstract $request)
 {
     if (!$request->isGet()) {
         $this->ignored = true;
     }
     if (!$request->isSecure()) {
         if (isset($_SERVER["HTTP_CACHE_CONTROL"]) && $_SERVER["HTTP_CACHE_CONTROL"] === "no-cache") {
             $this->ignored = true;
         }
         if (isset($_SERVER["HTTP_PRAGMA"]) && $_SERVER["HTTP_PRAGMA"] === "no-cache") {
             $this->ignored = true;
         }
     }
     if (session_id() || isset($_COOKIE['pimcore_admin_sid'])) {
         $this->ignored = true;
     }
 }
开发者ID:luklewluk,项目名称:SupercachePlugin,代码行数:23,代码来源:Cache.php

示例4: routeStartup

 /**
  * @param \Zend_Controller_Request_Abstract $request
  * @return bool|void
  */
 public function routeStartup(\Zend_Controller_Request_Abstract $request)
 {
     $requestUri = $request->getRequestUri();
     $excludePatterns = array();
     // only enable GET method
     if (!$request->isGet()) {
         return $this->disable();
     }
     // disable the output-cache if browser wants the most recent version
     // unfortunately only Chrome + Firefox if not using SSL
     if (!$request->isSecure()) {
         if (isset($_SERVER["HTTP_CACHE_CONTROL"]) && $_SERVER["HTTP_CACHE_CONTROL"] == "no-cache") {
             return $this->disable("HTTP Header Cache-Control: no-cache was sent");
         }
         if (isset($_SERVER["HTTP_PRAGMA"]) && $_SERVER["HTTP_PRAGMA"] == "no-cache") {
             return $this->disable("HTTP Header Pragma: no-cache was sent");
         }
     }
     try {
         $conf = \Pimcore\Config::getSystemConfig();
         if ($conf->cache) {
             $conf = $conf->cache;
             if (!$conf->enabled) {
                 return $this->disable();
             }
             if (\Pimcore::inDebugMode()) {
                 return $this->disable("in debug mode");
             }
             if ($conf->lifetime) {
                 $this->setLifetime((int) $conf->lifetime);
             }
             if ($conf->excludePatterns) {
                 $confExcludePatterns = explode(",", $conf->excludePatterns);
                 if (!empty($confExcludePatterns)) {
                     $excludePatterns = $confExcludePatterns;
                 }
             }
             if ($conf->excludeCookie) {
                 $cookies = explode(",", strval($conf->excludeCookie));
                 foreach ($cookies as $cookie) {
                     if (!empty($cookie) && isset($_COOKIE[trim($cookie)])) {
                         return $this->disable("exclude cookie in system-settings matches");
                     }
                 }
             }
             // output-cache is always disabled when logged in at the admin ui
             if (isset($_COOKIE["pimcore_admin_sid"])) {
                 return $this->disable("backend user is logged in");
             }
         } else {
             return $this->disable();
         }
     } catch (\Exception $e) {
         \Logger::error($e);
         return $this->disable("ERROR: Exception (see debug.log)");
     }
     foreach ($excludePatterns as $pattern) {
         if (@preg_match($pattern, $requestUri)) {
             return $this->disable("exclude path pattern in system-settings matches");
         }
     }
     $deviceDetector = Tool\DeviceDetector::getInstance();
     $device = $deviceDetector->getDevice();
     $deviceDetector->setWasUsed(false);
     $this->defaultCacheKey = "output_" . md5($request->getHttpHost() . $requestUri);
     $cacheKeys = [$this->defaultCacheKey . "_" . $device, $this->defaultCacheKey];
     $cacheItem = null;
     foreach ($cacheKeys as $cacheKey) {
         $cacheItem = CacheManager::load($cacheKey, true);
         if ($cacheItem) {
             break;
         }
     }
     if (is_array($cacheItem) && !empty($cacheItem)) {
         header("X-Pimcore-Output-Cache-Tag: " . $cacheKey, true, 200);
         header("X-Pimcore-Output-Cache-Date: " . $cacheItem["date"]);
         foreach ($cacheItem["rawHeaders"] as $header) {
             header($header);
         }
         foreach ($cacheItem["headers"] as $header) {
             header($header['name'] . ': ' . $header['value'], $header['replace']);
         }
         echo $cacheItem["content"];
         exit;
     } else {
         // set headers to tell the client to not cache the contents
         // this can/will be overwritten in $this->dispatchLoopShutdown() if the cache is enabled
         $date = new \Zend_Date(1);
         $this->getResponse()->setHeader("Expires", $date->get(\Zend_Date::RFC_1123), true);
         $this->getResponse()->setHeader("Cache-Control", "max-age=0, no-cache", true);
     }
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:96,代码来源:Cache.php

示例5: addHistory

 /**
  * addMessage() - Add an current navigation on history
  *
  * @param  Zend_Controller_Request_Abstract $oRequest
  * @param  string $layout
  * @return ZLayer_Controller_Request_History Provides a fluent interface
  */
 public function addHistory(Zend_Controller_Request_Abstract $oRequest, $layout)
 {
     if (!is_array(self::$_session->history)) {
         self::$_session->history = array();
     }
     $params = $oRequest->getParams();
     if (isset($params['__format'])) {
         $context = $params['__format'];
     } else {
         $context = 'default';
     }
     $array = array("action" => $oRequest->getActionName(), "controller" => $oRequest->getControllerName(), "module" => $oRequest->getModuleName(), "layout" => $layout, "params" => $oRequest->getParams(), "method" => $oRequest->getMethod(), "context" => $context, "secure" => $oRequest->isSecure(), "xmlHttpRequest" => $oRequest->isXmlHttpRequest(), "flashRequest" => $oRequest->isFlashRequest());
     self::$_session->history[] = $array;
     $histAr = self::$_session->history;
     $revAr = array_reverse($histAr);
     $limitRevAr = array_slice($revAr, 0, 10);
     $newHistAr = array_reverse($limitRevAr);
     self::$_session->history = $newHistAr;
     return $this;
 }
开发者ID:BGCX261,项目名称:zlayer-svn-to-git,代码行数:27,代码来源:History.php


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