You are here

function linkchecker_redirect_update in Link checker 8

Same name and namespace in other branches
  1. 7 linkchecker.redirect.inc \linkchecker_redirect_update()

Implements hook_redirect_update().

1 call to linkchecker_redirect_update()
linkchecker_redirect_insert in ./linkchecker.redirect.inc
Implements hook_redirect_insert().

File

./linkchecker.redirect.inc, line 20
Redirect interface to linkchecker functionalities.

Code

function linkchecker_redirect_update($redirect) {

  // Get Source URL.
  $source = $redirect
    ->getSourceUrl();

  // Get host domain.
  $host = \Drupal::request()
    ->getSchemeAndHttpHost();

  // It's unknown if this is a redirect for HTTP/HTTPS or the encoded urls.
  $url_http = Url::fromUri('internal:' . $source)
    ->toString();
  $url_https = Url::fromUri('internal:' . $source, [
    'https' => TRUE,
  ])
    ->toString();
  $full_url_http = Url::fromUri($host . $source, [
    'https' => FALSE,
  ])
    ->toString();
  $full_url_https = Url::fromUri($host . $source, [
    'https' => TRUE,
  ])
    ->toString();
  $urls = [
    $source,
    $url_http,
    $url_https,
    $full_url_http,
    $full_url_https,
    rawurldecode($source),
    rawurldecode($url_http),
    rawurldecode($url_https),
    rawurldecode($full_url_http),
    rawurldecode($full_url_https),
  ];
  _linkchecker_redirect_reset($urls);
}