Stash::_is_bot PHP Метод

_is_bot() приватный Метод

Check if the user agent is a bot
private _is_bot ( ) : void
Результат void
    private function _is_bot()
    {
        $bot_test = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : (php_sapi_name() === 'cli' ? 'cli' : 'other');
        $is_bot = FALSE;
        if (empty($bot_test)) {
            $is_bot = TRUE;
            // no UA string, assume it's a bot
        } else {
            // Most active *legitimate* bots will contain one of these strings in the UA
            $bot_list = $this->EE->config->item('stash_bots') ? $this->EE->config->item('stash_bots') : array('bot', 'crawl', 'spider', 'archive', 'search', 'java', 'yahoo', 'teoma');
            foreach ($bot_list as $bot) {
                if (strpos($bot_test, $bot) !== FALSE) {
                    $is_bot = TRUE;
                    break;
                    // stop right away to save processing
                }
            }
        }
        return $is_bot;
    }