mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
Merge pull request #761 from xabbuh/patch-1
extract browser detection regex into a constant
This commit is contained in:
@@ -32,6 +32,11 @@ class ChromePHPHandler extends AbstractProcessingHandler
|
|||||||
* Header name
|
* Header name
|
||||||
*/
|
*/
|
||||||
const HEADER_NAME = 'X-ChromeLogger-Data';
|
const HEADER_NAME = 'X-ChromeLogger-Data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)
|
||||||
|
*/
|
||||||
|
const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
|
||||||
|
|
||||||
protected static $initialized = false;
|
protected static $initialized = false;
|
||||||
|
|
||||||
@@ -177,8 +182,7 @@ class ChromePHPHandler extends AbstractProcessingHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// matches any Chrome, or Firefox 43+
|
return preg_match(self::USER_AGENT_REGEX, $_SERVER['HTTP_USER_AGENT']);
|
||||||
return preg_match('{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}', $_SERVER['HTTP_USER_AGENT']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user