1 | <?php /* -*- tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */ |
---|
2 | /***************************************************************\ |
---|
3 | * This is 'Empreinte', a plugin for Dotclear 2 * |
---|
4 | * * |
---|
5 | * Copyright (c) 2007,2008 * |
---|
6 | * Oleksandr Syenchuk and contributors. * |
---|
7 | * * |
---|
8 | * This is an open source software, distributed under the GNU * |
---|
9 | * General Public License (version 2) terms and conditions. * |
---|
10 | * * |
---|
11 | * You should have received a copy of the GNU General Public * |
---|
12 | * License along with 'Empreinte' (see COPYING.txt); * |
---|
13 | * if not, write to the Free Software Foundation, Inc., * |
---|
14 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
15 | \***************************************************************/ |
---|
16 | |
---|
17 | class empreinte |
---|
18 | { |
---|
19 | private static $browsers = array( |
---|
20 | 'Epiphany', |
---|
21 | 'Firefox', |
---|
22 | 'Flock', |
---|
23 | 'Iceweasel', |
---|
24 | 'Konqueror', |
---|
25 | 'Links', |
---|
26 | 'Lynx', |
---|
27 | 'Minimo', |
---|
28 | 'MSIE', |
---|
29 | 'Netscape', |
---|
30 | 'Opera', |
---|
31 | 'Safari', |
---|
32 | 'Seamonkey', |
---|
33 | 'wget'); |
---|
34 | |
---|
35 | private static $systems = array( |
---|
36 | 'Blackberry', |
---|
37 | 'BSD', |
---|
38 | 'Java', |
---|
39 | 'Linux', |
---|
40 | 'Macintosh', |
---|
41 | 'Nokia', |
---|
42 | 'OS/2', |
---|
43 | 'Palmos', |
---|
44 | 'Playstation', |
---|
45 | 'Smartphone', |
---|
46 | 'SonyEricsson', |
---|
47 | 'Sun', |
---|
48 | 'Windows'); |
---|
49 | |
---|
50 | public static function getUserAgentInfo(&$browser,&$system) |
---|
51 | { |
---|
52 | $browser = $system = ''; |
---|
53 | $user_agent = @$_SERVER['HTTP_USER_AGENT']; |
---|
54 | if (empty($user_agent)) { |
---|
55 | return; |
---|
56 | } |
---|
57 | |
---|
58 | foreach (self::$browsers as $v) |
---|
59 | { |
---|
60 | if (preg_match('#'.$v.'#i',$user_agent)) { |
---|
61 | $browser = $v; |
---|
62 | break; |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | foreach (self::$systems as $v) |
---|
67 | { |
---|
68 | if (preg_match('#'.$v.'#i',$user_agent)) { |
---|
69 | $system = $v; |
---|
70 | break; |
---|
71 | } |
---|
72 | } |
---|
73 | } |
---|
74 | } |
---|
75 | ?> |
---|