You are here: Re: Need a simple database for name and email only « All PHP « IT news, forums, messages
Re: Need a simple database for name and email only

Posted by Steve on 03/24/07 21:37

========== browser.class.php

<?
class browser
{
const LINUX = 0;
const MACINTOSH = 1;
const OTHER = 2;
const UNIX = 4;
const WINDOWS = 8;

const IE = 16;
const NETSCAPE = 32;
const OPERA = 64;

static private $_properties = array();
static private $_instance = null;

private function __clone(){}

private function __construct()
{
$userAgent = $_SERVER['HTTP_USER_AGENT'];
switch (true)
{
case strstr($userAgent, 'Linux') : self::$_properties['PLATFORM'] =
LINUX; break;
case strstr($userAgent, 'Mac') : self::$_properties['PLATFORM'] =
MACINTOSH; break;
case strstr($userAgent, 'Unix') : self::$_properties['PLATFORM'] =
UNIX; break;
case strstr($userAgent, 'Win') : self::$_properties['PLATFORM'] =
WINDOWS; break;
default : self::$_properties['PLATFORM'] =
OTHER; break;
}
switch (true)
{
case ereg('MSIE ([0-9].[0-9]{1,2})' , $userAgent, $version) :
self::$_properties['AGENT'] = IE; break;
case ereg('Mozilla/([0-9].[0-9]{1,2})', $userAgent, $version) :
self::$_properties['AGENT'] = NETSCAPE; break;
case ereg('Opera ([0-9].[0-9]{1,2})' , $userAgent, $version) :
self::$_properties['AGENT'] = OPERA; break;
default :
self::$_properties['AGENT'] = OTHER; break;
}
self::$_properties['VERSION'] = $version[1] != '' ? $version[1] : 0;
switch (true)
{
case self::$_properties['PLATFORM'] == WINDOWS:
if (self::$_properties['AGENT'] == IE)
{
self::$_properties['FONT']['LARGEST'] = 'medium';
self::$_properties['FONT']['LARGE'] = 'small';
self::$_properties['FONT']['NORMAL'] = 'x-small';
self::$_properties['FONT']['SMALL'] = 'xx-small';
self::$_properties['FONT']['SMALLEST'] = '7pt';
}
else
{
self::$_properties['FONT']['LARGEST'] = 'large';
self::$_properties['FONT']['LARGE'] = 'medium';
self::$_properties['FONT']['NORMAL'] = 'small';
self::$_properties['FONT']['SMALL'] = 'x-small';
self::$_properties['FONT']['SMALLEST'] = 'xx-small';
}
break;
case self::$_properties['PLATFORM'] == MACINTOSH:
self::$_properties['FONT']['LARGEST'] = 'x-large';
self::$_properties['FONT']['LARGE'] = 'large';
self::$_properties['FONT']['NORMAL'] = 'medium';
self::$_properties['FONT']['SMALL'] = 'small';
self::$_properties['FONT']['SMALLEST'] = 'x-small';
break;
default:
self::$_properties['FONT']['LARGEST'] = 'large';
self::$_properties['FONT']['LARGE'] = 'medium';
self::$_properties['FONT']['NORMAL'] = 'small';
self::$_properties['FONT']['SMALL'] = 'x-small';
self::$_properties['FONT']['SMALLEST'] = 'xx-small';
break;
}
}

static function getInstance()
{
if (is_null(self::$_instance)){ self::$_instance = new browser(); }
return self::$_instance;
}

static function getProperties(){ return self::$_properties; }

static function getFonts($size = '')
{
$size = strtoupper($size);
if ($size == ''){ return self::$_properties['FONT']; }
if (!array_key_exists($size, self::$_properties['FONT'])){ $size =
'NORMAL'; }
return self::$_properties['FONT'][$size];
}
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация