support new version code of Win10
[php-utility-classes.git] / testbed / ua_list.php
CommitLineData
4a778b7e 1<?php
2$inc_class_util = true;
3$inc_class_ua = true;
4include('inchandler.inc');
5
6// read string from this file
7$uafile = 'ua_list_raw.txt';
8
9$mycss = "th { font-size: 0.75em; }\n";
10$mycss .= "td.comment { font-size: 0.75em; text-align: center; font-weight: bold; }\n";
11$mycss .= "td.ua { font-size: 0.75em; }\n";
12
13$wrapper->pgtop('User Agents', $mycss);
14
15print('<h1>User Agents</h1>'."\n");
16
17$ualist = is_readable($uafile)?file($uafile):array();
18
19if (count($ualist)) {
20 print('<table class="border">'."\n");
21 print(' <tr>'."\n");
22 print(' <th>User Agent string</th>'."\n");
23 print(' <th>Brand</th>'."\n");
24 print(' <th>Version</th>'."\n");
25 print(' <th>Bot</th>'."\n");
31fe75cc 26 print(' <th>Mob</th>'."\n");
4a778b7e 27 print(' <th>Engine</th>'."\n");
28 print(' <th>eVer</th>'."\n");
29 print(' <th>OS</th>'."\n");
30 print(' <th>Platform</th>'."\n");
31 print(' <th>Lang</th>'."\n");
32 print(' </tr>'."\n");
33
34 foreach ($ualist as $uastring) {
35 $uastring = trim($uastring);
36 if (substr($uastring, 0, 1) == '#') {
37 // comment
38 print(' <tr>'."\n");
d09178b6 39 print(' <td colspan="10" class="comment">'.substr($uastring, 1).'</td>'."\n");
4a778b7e 40 print(' </tr>'."\n");
41 }
42 else {
43 $ua = new userAgent($uastring);
44 print(' <tr>'."\n");
45 print(' <td class="ua">'.$ua->getUAString().'</td>'."\n");
46 print(' <td>'.$ua->getBrand().'</td>'."\n");
47 print(' <td>'.$ua->getVersion().'</td>'."\n");
48 print(' <td>'.($ua->isBot()?'x':'-').'</td>'."\n");
31fe75cc 49 print(' <td>'.($ua->isMobile()?'x':'-').'</td>'."\n");
4a778b7e 50 print(' <td>'.$ua->getEngine().'</td>'."\n");
51 print(' <td>'.$ua->getEngineVersion().'</td>'."\n");
52 print(' <td>'.$ua->getOS().'</td>'."\n");
53 print(' <td>'.$ua->getPlatform().'</td>'."\n");
54 print(' <td>'.$ua->getLanguage().'</td>'."\n");
55 print(' </tr>'."\n");
56 }
57 }
58 print('</table>'."\n");
59}
60else {
61 print('No User Agent strings found in file "'.$uafile.'".'."\n");
62}
63
64$wrapper->pgbottom();
65?>