mirror of
https://github.com/kokororin/typecho-plugin-Access.git
synced 2025-03-14 11:50:24 +08:00
爬虫版本检测代码优化
This commit is contained in:
parent
ad0b5301a4
commit
8cdd62dcfe
@ -102,14 +102,13 @@ class Access_UA
|
||||
{
|
||||
if ($this->robotID === null) {
|
||||
if (!empty($this->ua)) {
|
||||
if (preg_match('#([a-zA-Z0-9]+\s*(?:bot|spider))[ /]*([0-9.]*)#i', $this->ua, $matches)) {
|
||||
if (preg_match('#([a-zA-Z0-9]+\s*(?:bot|spider))[ /v]*([0-9.]*)#i', $this->ua, $matches)) {
|
||||
$this->robotID = $this->robotName = $matches[1];
|
||||
$this->robotVersion = $matches[2];
|
||||
}
|
||||
foreach (self::$robots as $val) {
|
||||
if (strpos($this->ual, $this->filter($val)) !== false) {
|
||||
$this->robotID = $this->robotName = $val;
|
||||
$this->robotVersion = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user