You are here

function _linkchecker_link_check_status_filter in Link checker 6.2

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

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

3 calls to _linkchecker_link_check_status_filter()
_linkchecker_add_box_links in ./linkchecker.module
Add 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 1776
This module periodically check links in given node types, blocks, cck fields, etc.

Code

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

  // Domain blacklist check
  $urls = variable_get('linkchecker_disable_link_check_for_urls', LINKCHECKER_RESERVED_DOCUMENTATION_DOMAINS);
  if (!empty($urls) && preg_match('/' . implode('|', array_map(create_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;
}