You are here

function _simpleads_bot_detect in SimpleAds 7

Helper function. Return TRUE if the visitor is a bot.

Return value

boolean

2 calls to _simpleads_bot_detect()
simpleads_simpleads_ad_click in ./simpleads.module
Implements hook_simpleads_ad_click().
simpleads_simpleads_ad_impression in ./simpleads.module
Implements hook_simpleads_ad_impression().

File

includes/simpleads.helper.inc, line 254
SimpleAds Helper functions.

Code

function _simpleads_bot_detect() {
  if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}