diff --git a/system/src/Grav/Common/Browser.php b/system/src/Grav/Common/Browser.php index 051f2c1ef..3577d0409 100644 --- a/system/src/Grav/Common/Browser.php +++ b/system/src/Grav/Common/Browser.php @@ -38,4 +38,20 @@ class Browser $version = explode('.', $this->getLongVersion()); return intval($version[0]); } + + /** + * Determine if the request comes from a human, or from a bot/crawler + */ + public function isHuman() + { + if (empty($this->getBrowser())) { + return false; + } + + if (preg_match('~(bot|crawl)~i', $this->getBrowser())) { + return false; + } + + return true; + } }