
Mathieu Clément - 2007-01-14 18:34:55
Hello !
After testing your wonderful class on a normal Ubuntu Linux System, I've seen that the Ubuntu Build change the Version number to "x.y (Ubuntu Edgy)".
And it can be useful to just have the "x.y" (version number without the OS), for example for statistics.
So, I think the following code can be useful.
class browser {
/* ... */
function isFirefox()
{
if(eregi("Firefox", $this->useragent))
{
$this->browsertype = "Firefox";
$val = stristr($this->useragent, "Firefox");
$val = explode("/",$val);
$this->versionString = $val[1];
$this->versionNumber = strspn($this->versionString, "1234567890ab."); // see the strspn function on php.net. ab is there because there are Alpha and Beta versions named 2.0b1 for example.
$this->version = substr($this->versionString, 0, $this->versionNumber);
return TRUE;
}
else {
return FALSE;
}
}
/* ... */
} // end of the browser class
Just a little suggestion but it works very well without.
In the OS section I added "bsd" and "solaris" that were missing...