X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=tests%2Fua_test.php;fp=tests%2Fua_test.php;h=97309b3b84102bbcfa2b93d37603a335544bf793;hp=0000000000000000000000000000000000000000;hb=7b9ebce7d25e4eaa557e8a64f8b1ed15aad1a9bb;hpb=6638efd5690cd46471a3e01c164e572956a34aa3
diff --git a/tests/ua_test.php b/tests/ua_test.php
new file mode 100644
index 0000000..97309b3
--- /dev/null
+++ b/tests/ua_test.php
@@ -0,0 +1,48 @@
+pgtop("KaiRo's Browser-Test");
+
+// set default time zone - right now, always the one the server is in!
+date_default_timezone_set('Europe/Vienna');
+
+$httpvars = $util->getHTTPvars();
+if (strlen($httpvars["ua"])) {
+ $ua = new userAgent($httpvars["ua"]);
+}
+else {
+ $ua = new userAgent;
+}
+
+print("
KaiRo's Browser-Test
\n");
+
+print("I read the following user agent string from ".(strlen($httpvars["ua"])?"your input":"your browser").":\n
");
+print("".$ua->getUAString()."\n");
+
+print("
The browser brand is reported as "".$ua->getBrand().""\n");
+print("
The browser version is reported as "".$ua->getVersion().""\n");
+print("
The browser engine is reported as "".$ua->getEngine().""\n");
+print("
The engine version is reported as "".$ua->getEngineVersion().""\n");
+print("
The operating system is reported as "".$ua->getOS().""\n");
+print("
The system platform is reported as "".$ua->getPlatform().""\n");
+print("
The browser language is reported as "".$ua->getLanguage().""\n");
+if ($ua->hasEngine('gecko')) {
+ print("
The Gecko date is reported as "".$ua->getGeckoDate().""\n");
+ print("
The full Gecko date/time is reported as "".date('r',$ua->getGeckoTime()).""\n");
+}
+print("
I conclude this must be ".$ua->getBrand()." ".$ua->getVersion()."\n");
+print("
This is ".($ua->isBot()?"an":"no")." automated robot.\n");
+
+$acclang = $ua->getAcceptLanguages();
+print("
Accepted Languages: ");
+foreach ($acclang as $lang=>$q) { print($lang."(".$q.") "); }
+print("\n");
+
+print("
Test the following UA string (leave empty to read it from your browser):\n");
+print("\n");
+$wrapper->pgbottom();
+?>