You are here

private function AntiCrawler::is_redirected in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/Common/Firewall/Modules/AntiCrawler.php \Cleantalk\Common\Firewall\Modules\AntiCrawler::is_redirected()
1 call to AntiCrawler::is_redirected()
AntiCrawler::check in src/lib/Cleantalk/Common/Firewall/Modules/AntiCrawler.php
Use this method to execute main logic of the module.

File

src/lib/Cleantalk/Common/Firewall/Modules/AntiCrawler.php, line 171

Class

AntiCrawler

Namespace

Cleantalk\Common\Firewall\Modules

Code

private function is_redirected() {
  $is_redirect = false;
  if (Server::get('HTTP_REFERER') !== '' && Server::get('HTTP_HOST') !== '' && $this
    ->is_cloudflare()) {
    $parse_referer = parse_url(Server::get('HTTP_REFERER'));
    if ($parse_referer && isset($parse_referer['host'])) {
      $is_redirect = Server::get('HTTP_HOST') !== $parse_referer['host'];
    }
  }
  return http_response_code() === 301 || http_response_code() === 302 || $is_redirect;
}