re-add the CSS file and rework the UA tests not to rely on outdated non-public includes
[php-utility-classes.git] / tests / ua_list.php
CommitLineData
4a778b7e 1<?php
39814159 2include('../classes/useragent.php-class');
4a778b7e 3
4// read string from this file
5$uafile = 'ua_list_raw.txt';
6
39814159
RK
7print("<!DOCTYPE html>\n");
8print("<html>\n<head>\n");
9print(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
10print(" <link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\">\n");
11print(" <title>".'User Agents'."</title>\n");
12print("</head>\n<body>\n");
4a778b7e 13
14print('<h1>User Agents</h1>'."\n");
15
16$ualist = is_readable($uafile)?file($uafile):array();
17
18if (count($ualist)) {
39814159 19 print('<table class="border" id="ualist">'."\n");
4a778b7e 20 print(' <tr>'."\n");
21 print(' <th>User Agent string</th>'."\n");
22 print(' <th>Brand</th>'."\n");
23 print(' <th>Version</th>'."\n");
24 print(' <th>Bot</th>'."\n");
31fe75cc 25 print(' <th>Mob</th>'."\n");
4a778b7e 26 print(' <th>Engine</th>'."\n");
27 print(' <th>eVer</th>'."\n");
28 print(' <th>OS</th>'."\n");
29 print(' <th>Platform</th>'."\n");
30 print(' <th>Lang</th>'."\n");
31 print(' </tr>'."\n");
32
33 foreach ($ualist as $uastring) {
34 $uastring = trim($uastring);
35 if (substr($uastring, 0, 1) == '#') {
36 // comment
37 print(' <tr>'."\n");
d09178b6 38 print(' <td colspan="10" class="comment">'.substr($uastring, 1).'</td>'."\n");
4a778b7e 39 print(' </tr>'."\n");
40 }
41 else {
42 $ua = new userAgent($uastring);
43 print(' <tr>'."\n");
44 print(' <td class="ua">'.$ua->getUAString().'</td>'."\n");
45 print(' <td>'.$ua->getBrand().'</td>'."\n");
46 print(' <td>'.$ua->getVersion().'</td>'."\n");
47 print(' <td>'.($ua->isBot()?'x':'-').'</td>'."\n");
31fe75cc 48 print(' <td>'.($ua->isMobile()?'x':'-').'</td>'."\n");
4a778b7e 49 print(' <td>'.$ua->getEngine().'</td>'."\n");
50 print(' <td>'.$ua->getEngineVersion().'</td>'."\n");
51 print(' <td>'.$ua->getOS().'</td>'."\n");
52 print(' <td>'.$ua->getPlatform().'</td>'."\n");
53 print(' <td>'.$ua->getLanguage().'</td>'."\n");
54 print(' </tr>'."\n");
55 }
56 }
57 print('</table>'."\n");
58}
59else {
60 print('No User Agent strings found in file "'.$uafile.'".'."\n");
61}
62
39814159
RK
63print("<div id=\"copyright\">\n");
64print("Page code under Mozilla Public License, code available at <a href=\"https://github.com/KaiRo-at/php-utility-classes\">GitHub</a>.\n");
65print("</div>\n");
66print("</body></html>\n");
4a778b7e 67?>