Conditions | 7 |
Paths | 7 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | public function getBrowser() |
||
7 | { |
||
8 | // The order of the below user agent checks matters |
||
9 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#browser_name |
||
10 | $agent_string = strtolower($_SERVER['HTTP_USER_AGENT']); |
||
11 | if (strpos($agent_string, 'chromium')) return 'chromium'; |
||
12 | if (strpos($agent_string, 'opr/')) return 'opera'; |
||
13 | if (strpos($agent_string, 'chrome')) return 'chrome'; |
||
14 | if (strpos($agent_string, 'seamonkey')) return 'seamonkey'; |
||
15 | if (strpos($agent_string, 'firefox')) return 'firefox'; |
||
16 | if (strpos($agent_string, 'version/')) return 'safari'; |
||
17 | return ''; |
||
18 | } |
||
21 |