mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
move more into request
This commit is contained in:
parent
2550cc09eb
commit
f37366b2d0
3 changed files with 12 additions and 16 deletions
|
@ -2,19 +2,4 @@
|
|||
|
||||
class Actions
|
||||
{
|
||||
public static function param($key, $default = null)
|
||||
{
|
||||
return $_POST[$key] ?? $_GET[$key] ?? $default;
|
||||
}
|
||||
|
||||
protected static function isForRobot()
|
||||
{
|
||||
$bots = [
|
||||
'bot', 'spider', 'crawler', 'siteexplorer', 'yahoo', 'slurp', 'dataaccessd', 'facebook', 'twitter', 'coccoc',
|
||||
'calendar', 'curl', 'wget', 'panopta', 'blogtrottr', 'zapier', 'newrelic', 'luasocket',
|
||||
'okhttp', 'python'
|
||||
];
|
||||
|
||||
return preg_match('/(' . join('|', $bots) . ')/i', Request::getUserAgent());
|
||||
}
|
||||
}
|
|
@ -89,4 +89,15 @@ class Request
|
|||
{
|
||||
return static::getHttpHeader('Accept-Encoding') && strpos(strtolower(static::getHttpHeader('Accept-Encoding')), 'gzip') !== false;
|
||||
}
|
||||
|
||||
public static function isRobot()
|
||||
{
|
||||
$bots = [
|
||||
'bot', 'spider', 'crawler', 'siteexplorer', 'yahoo', 'slurp', 'dataaccessd', 'facebook', 'twitter', 'coccoc',
|
||||
'calendar', 'curl', 'wget', 'panopta', 'blogtrottr', 'zapier', 'newrelic', 'luasocket',
|
||||
'okhttp', 'python'
|
||||
];
|
||||
|
||||
return preg_match('/(' . join('|', $bots) . ')/i', static::getUserAgent());
|
||||
}
|
||||
}
|
|
@ -178,7 +178,7 @@ class DownloadActions extends Actions
|
|||
}
|
||||
}
|
||||
|
||||
if (static::isForRobot())
|
||||
if (Request::isRobot())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue