本文整理汇总了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 '';
}
}
示例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']);
}
}
示例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());
}
示例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');
}
示例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;
}
}
示例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;
}
示例7: getSaveOrderUrl
/**
* Retrieve save order url on front
*
* @return string
*/
protected function getSaveOrderUrl()
{
return $this->urlBuilder->getUrl('checkout/onepage/saveOrder', ['_secure' => $this->request->isSecure()]);
}
示例8: getSurveyUrl
/**
* Return survey url
*
* @return string
*/
public function getSurveyUrl()
{
$host = $this->_request->isSecure() ? 'https://' : 'http://';
return $host . self::SURVEY_URL;
}
示例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);
}
示例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);
}
示例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());
}
}