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


PHP RequestInterface::isSecure方法代码示例

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


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

示例1: getViewFileUrl

 /**
  * Retrieve url of a view file
  *
  * @param string $fileId
  * @param array $params
  * @return string
  */
 public function getViewFileUrl($fileId, array $params = [])
 {
     try {
         $params = array_merge(['_secure' => $this->_request->isSecure()], $params);
         return $this->_assetRepo->getUrlWithParams($fileId, $params);
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         return '';
     }
 }
开发者ID:smart2pay,项目名称:magento20,代码行数:16,代码来源:ConfigProvider.php

示例2: getViewFileUrl

 /**
  * Retrieve url of a view file
  *
  * @param string $fileId
  * @param array $params
  * @return string
  */
 protected function getViewFileUrl($fileId, array $params = [])
 {
     try {
         $params = array_merge(['_secure' => $this->request->isSecure()], $params);
         return $this->assetRepo->getUrlWithParams($fileId, $params);
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->logger->critical($e);
         return $this->urlBuilder->getUrl('', ['_direct' => 'core/index/notFound']);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:Page.php

示例3: __construct

 /**
  * @param \Magento\Framework\ValidatorFactory $validatorFactory
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Framework\Stdlib\StringUtils $stringHelper
  * @param \Magento\Framework\App\RequestInterface $request
  * @param Filesystem $filesystem
  * @param DeploymentConfig $deploymentConfig
  * @param string $scopeType
  * @param string $lifetimePath
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function __construct(\Magento\Framework\ValidatorFactory $validatorFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Stdlib\StringUtils $stringHelper, \Magento\Framework\App\RequestInterface $request, Filesystem $filesystem, DeploymentConfig $deploymentConfig, $scopeType, $lifetimePath = self::XML_PATH_COOKIE_LIFETIME)
 {
     $this->_validatorFactory = $validatorFactory;
     $this->_scopeConfig = $scopeConfig;
     $this->_stringHelper = $stringHelper;
     $this->_httpRequest = $request;
     $this->_scopeType = $scopeType;
     $this->lifetimePath = $lifetimePath;
     /**
      * Session path
      */
     $savePath = $deploymentConfig->get(self::PARAM_SESSION_SAVE_PATH);
     if (!$savePath && !ini_get('session.save_path')) {
         $sessionDir = $filesystem->getDirectoryWrite(DirectoryList::SESSION);
         $savePath = $sessionDir->getAbsolutePath();
         $sessionDir->create();
     }
     if ($savePath) {
         $this->setSavePath($savePath);
     }
     /**
      * Session cache limiter
      */
     $cacheLimiter = $deploymentConfig->get(self::PARAM_SESSION_CACHE_LIMITER);
     if ($cacheLimiter) {
         $this->setOption('session.cache_limiter', $cacheLimiter);
     }
     /**
      * Cookie settings: lifetime, path, domain, httpOnly. These govern settings for the session cookie.
      */
     $this->configureCookieLifetime();
     $path = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_PATH, $this->_scopeType);
     $path = empty($path) ? $this->_httpRequest->getBasePath() : $path;
     $this->setCookiePath($path, $this->_httpRequest->getBasePath());
     $domain = $this->_scopeConfig->getValue(self::XML_PATH_COOKIE_DOMAIN, $this->_scopeType);
     $domain = empty($domain) ? $this->_httpRequest->getHttpHost() : $domain;
     $this->setCookieDomain((string) $domain, $this->_httpRequest->getHttpHost());
     $this->setCookieHttpOnly($this->_scopeConfig->getValue(self::XML_PATH_COOKIE_HTTPONLY, $this->_scopeType));
     $secureURL = $this->_scopeConfig->getValue('web/secure/base_url', $this->_scopeType);
     $unsecureURL = $this->_scopeConfig->getValue('web/unsecure/base_url', $this->_scopeType);
     $isFullySecuredURL = $secureURL == $unsecureURL;
     $this->setCookieSecure($isFullySecuredURL && $this->_httpRequest->isSecure());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:54,代码来源:Config.php

示例4: _isSecure

 /**
  * Retrieve is secure mode URL
  *
  * @return bool
  */
 protected function _isSecure()
 {
     if ($this->_request->isSecure()) {
         return true;
     }
     if ($this->getRouteParamsResolver()->hasData('secure_is_forced')) {
         return (bool) $this->getRouteParamsResolver()->getData('secure');
     }
     if (!$this->_getScope()->isUrlSecure()) {
         return false;
     }
     if (!$this->getRouteParamsResolver()->hasData('secure')) {
         if ($this->_getType() == UrlInterface::URL_TYPE_LINK) {
             $pathSecure = $this->_urlSecurityInfo->isSecure('/' . $this->_getActionPath());
             $this->getRouteParamsResolver()->setData('secure', $pathSecure);
         } elseif ($this->_getType() == UrlInterface::URL_TYPE_STATIC) {
             $isRequestSecure = $this->_getRequest()->isSecure();
             $this->getRouteParamsResolver()->setData('secure', $isRequestSecure);
         } else {
             $this->getRouteParamsResolver()->setData('secure', true);
         }
     }
     return $this->getRouteParamsResolver()->getData('secure');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:29,代码来源:Url.php

示例5: _checkShouldBeSecure

 /**
  * Check that request uses https protocol if it should.
  * Function redirects user to correct URL if needed.
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $path
  * @return void
  */
 protected function _checkShouldBeSecure(\Magento\Framework\App\RequestInterface $request, $path = '')
 {
     if ($request->getPost()) {
         return;
     }
     if ($this->_shouldBeSecure($path) && !$request->isSecure()) {
         $url = $this->_getCurrentSecureUrl($request);
         if ($this->_shouldRedirectToSecure()) {
             $url = $this->_url->getRedirectUrl($url);
         }
         $this->_responseFactory->create()->setRedirect($url)->sendResponse();
         exit;
     }
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:22,代码来源:Base.php

示例6: isCurrentlySecure

 /**
  * Check if request was secure
  *
  * @return boolean
  */
 public function isCurrentlySecure()
 {
     if ($this->_request->isSecure()) {
         return true;
     }
     $secureBaseUrl = $this->_config->getValue(self::XML_PATH_SECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
     $secureFrontend = $this->_config->getValue(self::XML_PATH_SECURE_IN_FRONTEND, ScopeInterface::SCOPE_STORE);
     if (!$secureBaseUrl || !$secureFrontend) {
         return false;
     }
     $uri = \Zend_Uri::factory($secureBaseUrl);
     $port = $uri->getPort();
     $serverPort = $this->_request->getServer('SERVER_PORT');
     $isSecure = $uri->getScheme() == 'https' && isset($serverPort) && $port == $serverPort;
     return $isSecure;
 }
开发者ID:mrbadao,项目名称:magento-ce,代码行数:21,代码来源:Store.php

示例7: getSaveOrderUrl

 /**
  * Retrieve save order url on front
  *
  * @return string
  */
 protected function getSaveOrderUrl()
 {
     return $this->urlBuilder->getUrl('checkout/onepage/saveOrder', ['_secure' => $this->request->isSecure()]);
 }
开发者ID:kid17,项目名称:magento2,代码行数:9,代码来源:IframeConfigProvider.php

示例8: getSurveyUrl

 /**
  * Return survey url
  *
  * @return string
  */
 public function getSurveyUrl()
 {
     $host = $this->_request->isSecure() ? 'https://' : 'http://';
     return $host . self::SURVEY_URL;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Survey.php

示例9: isAvailable

 /**
  * is payment method available?
  *
  * @param \Magento\Quote\Api\Data\CartInterface|null $quote
  *
  * @return bool
  */
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     $parent = parent::isAvailable($quote);
     if (!$this->_accessToken) {
         $this->_accessToken = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_ACCESS_TOKEN);
     }
     if (!$this->_publicKey) {
         $this->_publicKey = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_PUBLIC_KEY);
     }
     $custom = !empty($this->_publicKey) && !empty($this->_accessToken);
     if (!$parent || !$custom) {
         return false;
     }
     $debugMode = $this->_scopeConfig->getValue('payment/mercadopago/debug_mode');
     $secure = $this->_request->isSecure();
     if (!$secure && !$debugMode) {
         return false;
     }
     return $this->_helperData->isValidAccessToken($this->_accessToken);
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:27,代码来源:Payment.php

示例10: createAsset

 /**
  * Create a file asset that's subject of fallback system
  *
  * @param string $fileId
  * @param array $params
  * @return \Magento\Framework\View\Asset\File
  */
 public function createAsset($fileId, array $params = [])
 {
     $params = array_merge(['_secure' => $this->request->isSecure()], $params);
     return $this->assetRepo->createAsset($fileId, $params);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CcConfig.php

示例11: updateSecureValue

 /**
  * Update secure value, set it to request setting if it has no explicit value assigned.
  *
  * @return void
  */
 private function updateSecureValue()
 {
     if (null === $this->get(self::KEY_SECURE)) {
         $this->set(self::KEY_SECURE, $this->request->isSecure());
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:SensitiveCookieMetadata.php


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