You are here

private function RateBotDetector::isLocal in Rate 8.2

Check if the given IP is a local IP-address.

Return value

bool True if local IP; false otherwise.

1 call to RateBotDetector::isLocal()
RateBotDetector::checkIsBot in src/Plugin/RateBotDetector.php
Check if the current user is blocked.

File

src/Plugin/RateBotDetector.php, line 99

Class

RateBotDetector
The rate.bot_detector service.

Namespace

Drupal\rate\Plugin

Code

private function isLocal() {
  $match = explode('.', $this->ip);
  if ($match[0] == 10 || $match[0] == 127 || $match[0] == 192 && $match[1] == 168 || $match[0] == 172 && $match[1] >= 16 && $match[1] <= 31) {
    return TRUE;
  }
  return FALSE;
}