protected function LinkExtractorService::isUrlBlacklisted in Link checker 8
Verifies against blacklists, if the link status should be checked or not.
Parameters
string $url: The URL to check.
Return value
bool TRUE if URL should be checked.
1 call to LinkExtractorService::isUrlBlacklisted()
- LinkExtractorService::getLinks in src/
LinkExtractorService.php - Filters URL that do not need to check.
File
- src/
LinkExtractorService.php, line 410
Class
- LinkExtractorService
- Class LinkExtractor.
Namespace
Drupal\linkcheckerCode
protected function isUrlBlacklisted($url) {
// Is url in domain blacklist?
$urls = $this->linkcheckerSetting
->get('check.disable_link_check_for_urls');
if (!empty($urls) && preg_match('/' . implode('|', array_map(function ($links) {
return preg_quote($links, '/');
}, preg_split('/(\\r\\n?|\\n)/', $urls))) . '/', $url)) {
return TRUE;
}
// Protocol whitelist check (without curl, only http/https is supported).
if (!preg_match('/^(https?):\\/\\//i', $url)) {
return TRUE;
}
return FALSE;
}