Commit | Line | Data |
---|---|---|
4a778b7e | 1 | <?php |
880bcb60 RK |
2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, | |
4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
5 | ||
39814159 | 6 | include('../classes/useragent.php-class'); |
4a778b7e | 7 | |
8 | // read string from this file | |
9 | $uafile = 'ua_list_raw.txt'; | |
10 | ||
39814159 RK |
11 | print("<!DOCTYPE html>\n"); |
12 | print("<html>\n<head>\n"); | |
13 | print(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"); | |
14 | print(" <link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\">\n"); | |
15 | print(" <title>".'User Agents'."</title>\n"); | |
16 | print("</head>\n<body>\n"); | |
4a778b7e | 17 | |
18 | print('<h1>User Agents</h1>'."\n"); | |
19 | ||
20 | $ualist = is_readable($uafile)?file($uafile):array(); | |
21 | ||
22 | if (count($ualist)) { | |
39814159 | 23 | print('<table class="border" id="ualist">'."\n"); |
4a778b7e | 24 | print(' <tr>'."\n"); |
25 | print(' <th>User Agent string</th>'."\n"); | |
26 | print(' <th>Brand</th>'."\n"); | |
27 | print(' <th>Version</th>'."\n"); | |
28 | print(' <th>Bot</th>'."\n"); | |
31fe75cc | 29 | print(' <th>Mob</th>'."\n"); |
4a778b7e | 30 | print(' <th>Engine</th>'."\n"); |
31 | print(' <th>eVer</th>'."\n"); | |
32 | print(' <th>OS</th>'."\n"); | |
33 | print(' <th>Platform</th>'."\n"); | |
34 | print(' <th>Lang</th>'."\n"); | |
35 | print(' </tr>'."\n"); | |
36 | ||
37 | foreach ($ualist as $uastring) { | |
38 | $uastring = trim($uastring); | |
39 | if (substr($uastring, 0, 1) == '#') { | |
40 | // comment | |
41 | print(' <tr>'."\n"); | |
d09178b6 | 42 | print(' <td colspan="10" class="comment">'.substr($uastring, 1).'</td>'."\n"); |
4a778b7e | 43 | print(' </tr>'."\n"); |
44 | } | |
45 | else { | |
46 | $ua = new userAgent($uastring); | |
47 | print(' <tr>'."\n"); | |
48 | print(' <td class="ua">'.$ua->getUAString().'</td>'."\n"); | |
49 | print(' <td>'.$ua->getBrand().'</td>'."\n"); | |
50 | print(' <td>'.$ua->getVersion().'</td>'."\n"); | |
51 | print(' <td>'.($ua->isBot()?'x':'-').'</td>'."\n"); | |
31fe75cc | 52 | print(' <td>'.($ua->isMobile()?'x':'-').'</td>'."\n"); |
4a778b7e | 53 | print(' <td>'.$ua->getEngine().'</td>'."\n"); |
54 | print(' <td>'.$ua->getEngineVersion().'</td>'."\n"); | |
55 | print(' <td>'.$ua->getOS().'</td>'."\n"); | |
56 | print(' <td>'.$ua->getPlatform().'</td>'."\n"); | |
57 | print(' <td>'.$ua->getLanguage().'</td>'."\n"); | |
58 | print(' </tr>'."\n"); | |
59 | } | |
60 | } | |
61 | print('</table>'."\n"); | |
62 | } | |
63 | else { | |
64 | print('No User Agent strings found in file "'.$uafile.'".'."\n"); | |
65 | } | |
66 | ||
39814159 RK |
67 | print("<div id=\"copyright\">\n"); |
68 | print("Page code under Mozilla Public License, code available at <a href=\"https://github.com/KaiRo-at/php-utility-classes\">GitHub</a>.\n"); | |
69 | print("</div>\n"); | |
70 | print("</body></html>\n"); | |
4a778b7e | 71 | ?> |