You are here

function _linkchecker_link_check_status_filter in Link checker 7

Same name and namespace in other branches
  1. 5.2 linkchecker.module \_linkchecker_link_check_status_filter()
  2. 6.2 linkchecker.module \_linkchecker_link_check_status_filter()

Verifies against blacklists, if the link status should be checked or not.

3 calls to _linkchecker_link_check_status_filter()
_linkchecker_add_block_custom_links in ./linkchecker.module
Add custom block links to database.
_linkchecker_add_comment_links in ./linkchecker.module
Add comment links to database.
_linkchecker_add_node_links in ./linkchecker.module
Add node links to database.

File

./linkchecker.module, line 2441
This module periodically check links in given node types, blocks etc.

Code

function _linkchecker_link_check_status_filter($url) {
  $status = TRUE;

  // Is url in domain blacklist?
  $urls = variable_get('linkchecker_disable_link_check_for_urls', LINKCHECKER_RESERVED_DOCUMENTATION_DOMAINS);
  if (!empty($urls) && preg_match('/' . implode('|', array_map(function ($links) {
    return preg_quote($links, '/');
  }, preg_split('/(\\r\\n?|\\n)/', $urls))) . '/', $url)) {
    $status = FALSE;
  }

  // Protocol whitelist check (without curl, only http/https is supported).
  if (!preg_match('/^(https?):\\/\\//i', $url)) {
    $status = FALSE;
  }
  return $status;
}