You are here

public static function HttpblEvaluator::projectLink in http:BL 8

Creates a link to Project Honey Pot IP Address Inspector.

This function is used after a lookup, before a host entity has been created, to enable an operations link in the log entry.

Parameters

string $ip: The IP address that was looked up.

string $text: The link text.

Return value

string The formatted link.

1 call to HttpblEvaluator::projectLink()
HttpblEvaluator::evaluateVisitor in src/HttpblEvaluator.php
Manages remote and local lookups on visiting host IPs, evaluates their remote status as safe or suspicious and determines a locally stored status (safe / white-listed, grey-listed, or blacklisted) which is used (by other functions) to determine an…

File

src/HttpblEvaluator.php, line 703

Class

HttpblEvaluator
HttpblEvaluator evaluates visitor/host page requests.

Namespace

Drupal\httpbl

Code

public static function projectLink($ip, $text = 'Project Honeypot') {
  $url = \Drupal\Core\Url::fromUri('http://www.projecthoneypot.org/search_ip.php?ip=' . $ip);
  $url_options = [
    'attributes' => [
      'target' => '_blank',
      'title' => t('Project Honey Pot IP Address Inspector.'),
    ],
  ];
  $url
    ->setOptions($url_options);

  // Break this line up for debugging.

  //$operations = \Drupal\Core\Link::fromTextAndUrl(t($text), $url )->toString();
  $operations = \Drupal\Core\Link::fromTextAndUrl(t($text), $url);

  // Below fails (intermittently) in core url_generator, when page_cache
  // is enabled.
  $operations = $operations
    ->toString();
  return $operations;
}