Class: Net_UserAgent_Detect
Source Location: /Net_UserAgent_Detect-2.2.0/Detect.php
The Net_UserAgent_Detect object does a number of tests on an HTTP user
Author(s):
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Method Detail
Net_UserAgent_Detect (Constructor) [line 59]
Net_UserAgent_Detect Net_UserAgent_Detect(
[
$in_userAgent = null], [
$in_detect = null])
|
|
Parameters:
detect [line 105]
void detect(
[string
$in_userAgent = null], [mixed
$in_detect = null])
|
|
Detect the user agent and prepare flags, features and quirks based on what is found This is the core of the Net_UserAgent_Detect class. It moves its way through the user agent string setting up the flags based on the vendors and versions of the browsers, determining the OS and setting up the features and quirks owned by each of the relevant clients. Note that if you are going to be calling methods of this class statically then set all the parameters using th setOption()
Parameters:
getAcceptType [line 830]
string getAcceptType(
string
$in_expectList, string
$in_type)
|
|
Retrive the accept type for the current browser. To keep track of the mime-types, languages, charsets and encodings that each browser accepts we use associative arrays for each type. This function works like getBrowser() as it takes an expect list and returns the first match. For instance, to find the language you would pass in your allowed languages and see if any of the languages set in the browser match.
Parameters:
getBrowser [line 483]
string getBrowser(
array
$in_expectList)
|
|
Since simply returning the "browser" is somewhat ambiguous since there are different ways to classify the browser, this function works by taking an expect list and returning the string of the first match, so put the important ones first in the array.
Parameters:
getBrowserString [line 511]
string getBrowserString(
[array
$in_vendorStrings = array (
'ie' => 'Microsoft Internet Explorer',
'ie4up' => 'Microsoft Internet Explorer 4.x',
'ie5up' => 'Microsoft Internet Explorer 5.x',
'ie6up' => 'Microsoft Internet Explorer 6.x',
'opera4' => 'Opera 4.x',
'opera5up' => 'Opera 5.x',
'nav' => 'Netscape Navigator',
'ns4' => 'Netscape 4.x',
'ns6up' => 'Mozilla/Netscape 6.x',
'firefox0.x' => 'Firefox 0.x',
'firefox1.x' => 'Firefox 1.x',
'konq' => 'Konqueror/Safari',
'netgem' => 'Netgem/iPlayer',
)])
|
|
This function returns the vendor string corresponding to the flag. Either use the default matches or pass in an associative array of flags and corresponding vendor strings. This function will find the highest version flag and return the vendor string corresponding to the appropriate flag. Be sure to pass in the flags in ascending order if you want a basic matches first, followed by more detailed matches.
Parameters:
getFeature [line 804]
string getFeature(
string
$in_feature)
|
|
Get the capabilities for the current browser. Since the capabilities of client browsers vary widly, this interface helps keep track of the core features of a client, such as if the client supports dhtml, dom, javascript, etc.
Parameters:
getOS [line 629]
string getOS(
$in_expectList)
|
|
Since simply returning the "os" is somewhat ambiguous since there are different ways to classify the browser, this function works by taking an expect list and returning the string of the first match, so put the important ones first in the array.
Parameters:
getOSString [line 657]
string getOSString(
[array
$in_osStrings = array(
'win' => 'Microsoft Windows',
'win9x' => 'Microsoft Windows 9x',
'winme' => 'Microsoft Windows Millenium',
'win2k' => 'Microsoft Windows 2000',
'winnt' => 'Microsoft Windows NT',
'winxp' => 'Microsoft Windows XP',
'win2003' => 'Microsoft Windows 2003',
'mac' => 'Macintosh',
'unix' => 'Linux/Unix',
)])
|
|
This function returns the os string corresponding to the flag. Either use the default matches or pass in an associative array of flags and corresponding os strings. This function will find the highest version flag and return the os string corresponding to the appropriate flag. Be sure to pass in the flags in ascending order if you want a basic matches first, followed by more detailed matches.
Parameters:
getQuirk [line 740]
string getQuirk(
string
$in_quirk)
|
|
Get the unique behavior for the current browser. Many client browsers do some really funky things, and this mechanism allows the coder to determine if an excepetion must be made with the current client.
Parameters:
getUserAgent [line 907]
Return the user agent string that is being worked on
hasAcceptType [line 893]
bool hasAcceptType(
string
$in_value, string
$in_type)
|
|
Check the accept types for the current browser. To keep track of the mime-types, languages, charsets and encodings that each browser accepts we use associative arrays for each type. This function checks the array for the given type and determines if the browser accepts it.
Parameters:
hasFeature [line 784]
bool hasFeature(
string
$in_feature)
|
|
Check the capabilities for the current browser. Since the capabilities of client browsers vary widly, this interface helps keep track of the core features of a client, such as if the client supports dhtml, dom, javascript, etc.
Parameters:
hasQuirk [line 720]
bool hasQuirk(
string
$in_quirk)
|
|
Check a unique behavior for the current browser. Many client browsers do some really funky things, and this mechanism allows the coder to determine if an excepetion must be made with the current client.
Parameters:
isBrowser [line 462]
boolean isBrowser(
string
$in_match)
|
|
Look up the provide browser flag and return a boolean value Given one of the flags listed in the properties, this function will return the value associated with that flag.
Parameters:
isIE [line 553]
Determine if the browser is an Internet Explorer browser
isNavigator [line 569]
Determine if the browser is a Netscape Navigator browser
isNetscape [line 589]
Determine if the browser is a Netscape or Mozilla browser Note that this function is not the same as isNavigator, since the new Mozilla browsers are still sponsered by Netscape, and hence are Netscape products, but not the original Navigators
isOS [line 610]
boolean isOS(
string
$in_match)
|
|
Look up the provide OS flag and return a boolean value Given one of the flags listed in the properties, this function will return the value associated with that flag for the operating system.
Parameters:
setAcceptType [line 864]
void setAcceptType(
array
$in_values, string
$in_type)
|
|
Set the accept types for the current browser. To keep track of the mime-types, languages, charsets and encodings that each browser accepts we use associative arrays for each type. This function takes and array of accepted values for the type and records them for retrieval.
Parameters:
setFeature [line 763]
void setFeature(
string
$in_feature, [string
$in_hasFeature = true])
|
|
Set capabilities for the current browser. Since the capabilities of client browsers vary widly, this interface helps keep track of the core features of a client, such as if the client supports dhtml, dom, javascript, etc.
Parameters:
setOption [line 442]
void setOption(
string
$in_field, mixed
$in_value)
|
|
Sets a class option. The available settings are: - 'userAgent' => The user agent string to detect (useful for
checking a string manually). - 'detectOptions' => The level of checking to do. A single level
- r an array of options. Default is NET_USERAGENT_DETECT_ALL.
Parameters:
setQuirk [line 698]
void setQuirk(
string
$in_quirk, [string
$in_hasQuirk = true])
|
|
Set a unique behavior for the current browser. Many client browsers do some really funky things, and this mechanism allows the coder to determine if an excepetion must be made with the current client.
Parameters:
singleton [line 73]
To be used in place of the contructor to return only open instance.
Parameters:
Documentation generated on Mon, 11 Mar 2019 14:39:28 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|