add a quick comment on using Bugzilla instead of GitHub issues
[php-utility-classes.git] / tests / ua_list.php
... / ...
CommitLineData
1<?php
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
6include('../classes/useragent.php-class');
7
8// read string from this file
9$uafile = 'ua_list_raw.txt';
10
11print("<!DOCTYPE html>\n");
12print("<html>\n<head>\n");
13print(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
14print(" <link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\">\n");
15print(" <title>".'User Agents'."</title>\n");
16print("</head>\n<body>\n");
17
18print('<h1>User Agents</h1>'."\n");
19
20$ualist = is_readable($uafile)?file($uafile):array();
21
22if (count($ualist)) {
23 print('<table class="border" id="ualist">'."\n");
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");
29 print(' <th>Mob</th>'."\n");
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");
42 print(' <td colspan="10" class="comment">'.substr($uastring, 1).'</td>'."\n");
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");
52 print(' <td>'.($ua->isMobile()?'x':'-').'</td>'."\n");
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}
63else {
64 print('No User Agent strings found in file "'.$uafile.'".'."\n");
65}
66
67print("<div id=\"copyright\">\n");
68print("Page code under Mozilla Public License, code available at <a href=\"https://github.com/KaiRo-at/php-utility-classes\">GitHub</a>.\n");
69print("</div>\n");
70print("</body></html>\n");
71?>