/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Validator/Url.php
37 строк
812 B
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2016 Adobe * All Rights Reserved. */ namespace Magento\Framework\Validator; /** * Class Url validates URL and checks that it has allowed scheme */ class Url { /** * Validate URL and check that it has allowed scheme * * @param string $value * @param array $allowedSchemes * @return bool */ public function isValid($value, array $allowedSchemes = []) { $isValid = true; if (!filter_var($value, FILTER_VALIDATE_URL)) { $isValid = false; } if ($isValid && !empty($allowedSchemes)) { $url = parse_url($value); if (empty($url['scheme']) || !in_array($url['scheme'], $allowedSchemes)) { $isValid = false; } } return $isValid; } }