mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
Add ability to customize robot user agents
This commit is contained in:
parent
72651ed095
commit
82213ce11a
5 changed files with 28 additions and 0 deletions
|
|
@ -151,6 +151,16 @@ class UA
|
|||
return self::$_robot_cache[$ua] = true;
|
||||
}
|
||||
|
||||
// Use the custom user-agent list.
|
||||
$customlist = Config::get('security.robot_user_agents') ?: array();
|
||||
foreach ($customlist as $item)
|
||||
{
|
||||
if (strpos($ua, $item) !== false)
|
||||
{
|
||||
return self::$_robot_cache[$ua] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're here, it's probably not a robot.
|
||||
return self::$_robot_cache[$ua] = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue