[blockbot] Update Composer dependency ahead of release

- Updating jaybizzle/crawler-detect (v1.2.80 => v1.2.116)
This commit is contained in:
Hypolite Petovan 2024-03-19 22:51:17 -04:00
parent b0ee9fdf2a
commit d838fc6421
20 changed files with 686 additions and 194 deletions

View file

@ -20,9 +20,9 @@ class CrawlerDetect
/**
* The user agent.
*
* @var null
* @var string|null
*/
protected $userAgent = null;
protected $userAgent;
/**
* Headers that contain a user agent.
@ -93,7 +93,7 @@ class CrawlerDetect
* Compile the regex patterns into one regex string.
*
* @param array
*
*
* @return string
*/
public function compileRegex($patterns)
@ -138,7 +138,7 @@ class CrawlerDetect
/**
* Set the user agent.
*
* @param string $userAgent
* @param string|null $userAgent
*/
public function setUserAgent($userAgent)
{
@ -165,20 +165,14 @@ class CrawlerDetect
$agent = trim(preg_replace(
"/{$this->compiledExclusions}/i",
'',
$userAgent ?: $this->userAgent
$userAgent ?: $this->userAgent ?: ''
));
if ($agent == '') {
if ($agent === '') {
return false;
}
$result = preg_match("/{$this->compiledRegex}/i", $agent, $matches);
if ($matches) {
$this->matches = $matches;
}
return (bool) $result;
return (bool) preg_match("/{$this->compiledRegex}/i", $agent, $this->matches);
}
/**
@ -190,4 +184,13 @@ class CrawlerDetect
{
return isset($this->matches[0]) ? $this->matches[0] : null;
}
/**
* @return string|null
*/
public function getUserAgent()
{
return $this->userAgent;
}
}

View file

@ -15,14 +15,14 @@ abstract class AbstractProvider
{
/**
* The data set.
*
*
* @var array
*/
protected $data;
/**
* Return the data set.
*
*
* @return array
*/
public function getAll()

File diff suppressed because it is too large Load diff

View file

@ -67,6 +67,8 @@ class Exclusions extends AbstractProvider
'; IDbot',
'; ID bot',
'; POWER BOT',
';', // Remove the following characters ;
'OCTOPUS-CORE',
'htc_botdugls',
'super\/\d+\/Android\/\d+',
);
}