當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Http::isSecure方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\Request\Http::isSecure方法的典型用法代碼示例。如果您正苦於以下問題:PHP Http::isSecure方法的具體用法?PHP Http::isSecure怎麽用?PHP Http::isSecure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\Request\Http的用法示例。


在下文中一共展示了Http::isSecure方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process

 /**
  * Handle private content version cookie
  * Set cookie if it is not set.
  * Increment version on post requests.
  * In all other cases do nothing.
  *
  * @return void
  */
 public function process()
 {
     if ($this->request->isPost()) {
         $publicCookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration(self::COOKIE_PERIOD)->setPath('/')->setSecure($this->request->isSecure())->setHttpOnly(false);
         $this->cookieManager->setPublicCookie(self::COOKIE_NAME, $this->generateValue(), $publicCookieMetadata);
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:15,代碼來源:Version.php

示例2: testIsSecure

 /**
  * @dataProvider isSecureDataProvider
  *
  * @param bool $isSecure expected output of isSecure method
  * @param string $serverHttps value of $_SERVER['HTTPS']
  * @param string $headerOffloadKey <Name-Of-Offload-Header>
  * @param string $headerOffloadValue value of $_SERVER[<Name-Of-Offload-Header>]
  * @param int $configCall number of times config->getValue is expected to be called
  */
 public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $headerOffloadValue, $configCall)
 {
     $this->_model = $this->getModel();
     $configOffloadHeader = 'Header-From-Proxy';
     $configMock = $this->getMockBuilder('Magento\\Framework\\App\\Config')->disableOriginalConstructor()->setMethods(['getValue'])->getMock();
     $configMock->expects($this->exactly($configCall))->method('getValue')->with(\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, ScopeConfigInterface::SCOPE_TYPE_DEFAULT)->willReturn($configOffloadHeader);
     $this->objectManager->expects($this->exactly($configCall))->method('get')->with('Magento\\Framework\\App\\Config')->will($this->returnValue($configMock));
     $this->_model->getServer()->set($headerOffloadKey, $headerOffloadValue);
     $this->_model->getServer()->set('HTTPS', $serverHttps);
     $this->assertSame($isSecure, $this->_model->isSecure());
 }
開發者ID:IlyaGluschenko,項目名稱:test001,代碼行數:20,代碼來源:HttpTest.php

示例3: __construct

 /**
  * @param \Magento\Framework\App\Request\Http $request
  */
 public function __construct(\Magento\Framework\App\Request\Http $request)
 {
     $data = [$request->isSecure(), $request->getRequestUri(), $request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING)];
     $this->value = md5(serialize($data));
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:8,代碼來源:Identifier.php

示例4: getValue

 /**
  * Return unique page identifier
  *
  * @return string
  */
 public function getValue()
 {
     $data = [$this->request->isSecure(), $this->request->getUriString(), $this->request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING) ?: $this->context->getVaryString()];
     return md5(serialize($data));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:10,代碼來源:Identifier.php


注:本文中的Magento\Framework\App\Request\Http::isSecure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。