X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=include%2Fclasses%2Fuseragent.php-class;h=dbcad2737e6d74de9a860a577208cc155c722f07;hp=eba3ed2a308a5c1a3329dce344edf70b18cb962e;hb=a3e499ad3709e3d59996f3f0bb22f7983f64fcc2;hpb=24883b0f434dbaeba84985ad55e6e368e665f236 diff --git a/include/classes/useragent.php-class b/include/classes/useragent.php-class index eba3ed2..dbcad27 100755 --- a/include/classes/useragent.php-class +++ b/include/classes/useragent.php-class @@ -97,6 +97,9 @@ class userAgent { // public function getGeckoDate() // returns the Gecko date for Gecko-based browsers, null for others // + // public function getGeckoTime() + // returns the Gecko build date/time as a unix epoch time number for Gecko-based browsers, null for others + // // *** functions for compat to older versions of this class *** // // public function isns() @@ -1099,6 +1102,24 @@ class userAgent { return $this->uadata['geckodate']; } + public function getGeckoTime() { + if (!isset($this->uadata['geckotime'])) { + $this->uadata['geckotime'] = null; + if (!is_null($this->getGeckoDate())) { + $use_time = (strlen($this->getGeckoDate()) > 8); + $gd_str = substr($this->getGeckoDate(),0,4).'-'.substr($this->getGeckoDate(),4,2).'-'.substr($this->getGeckoDate(),6,2); + if ($use_time) { + $gd_str .= substr($this->getGeckoDate(),8,2).':00'; + $old_tz = date_default_timezone_get(); + date_default_timezone_set("America/Los_Angeles"); + } + $this->uadata['geckotime'] = strtotime($gd_str); + if ($use_time) { date_default_timezone_set($old_tz); } + } + } + return $this->uadata['geckotime']; + } + public function isBot() { return $this->bot; } public function isns() {