/** * Returns true if the give $userAgent is from a robot * @param string $userAgent * @return bool */ public static function isRobot($userAgent) { if (self::$_is_robot !== null) { return self::$_is_robot; } self::$_is_robot = false; $userAgent = strtolower($userAgent); foreach (self::$robots as $key) { if (strpos($userAgent, $key) !== false) { self::$_is_robot = true; break; } } return self::$_is_robot; }