/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Url/SecurityInfo.php
68 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ namespace Magento\Framework\Url; /** * Url security information */ class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface { /** * List of secure url patterns * * @var array */ protected $secureUrlsList = []; /** * List of patterns excluded form secure url list * * @var array */ protected $excludedUrlsList = []; /** * List of already checked urls * * @var array */ protected $secureUrlsCache = []; /** * @param string[] $secureUrlList * @param string[] $excludedUrlList */ public function __construct($secureUrlList = [], $excludedUrlList = []) { $this->secureUrlsList = $secureUrlList; $this->excludedUrlsList = $excludedUrlList; } /** * Check whether url is secure * * @param string $url * @return bool */ public function isSecure($url) { if (!isset($this->secureUrlsCache[$url])) { $this->secureUrlsCache[$url] = false; foreach ($this->excludedUrlsList as $match) { if (strpos((string)$url, (string)$match) === 0) { return $this->secureUrlsCache[$url]; } } foreach ($this->secureUrlsList as $match) { if (strpos((string)$url, (string)$match) === 0) { $this->secureUrlsCache[$url] = true; break; } } } return $this->secureUrlsCache[$url]; } }