[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Net/UserAgent/ -> Detect.php (sommaire)

(pas de description)

Poids: 934 lignes (40 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Net_UserAgent_Detect:: (24 méthodes):
  Net_UserAgent_Detect()
  singleton()
  detect()
  setOption()
  isBrowser()
  getBrowser()
  getBrowserString()
  isIE()
  isNavigator()
  isNetscape()
  isOS()
  getOS()
  getOSString()
  setQuirk()
  hasQuirk()
  getQuirk()
  setFeature()
  hasFeature()
  getFeature()
  getAcceptType()
  setAcceptType()
  hasAcceptType()
  getUserAgent()
  _getStaticProperty()


Classe: Net_UserAgent_Detect  - X-Ref

The Net_UserAgent_Detect object does a number of tests on an HTTP user
agent string.  The results of these tests are available via methods of
the object.  Note that all methods in this class can be called
statically.  The constructor and singleton methods are only retained
for BC.

This module is based upon the JavaScript browser detection code
available at http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html.
This module had many influences from the lib/Browser.php code in
version 1.3 of Horde.

Net_UserAgent_Detect($in_userAgent = null, $in_detect = null)   X-Ref
Pas de description

singleton($in_userAgent = null, $in_detect = null)   X-Ref
To be used in place of the contructor to return only open instance.

return: object Net_UserAgent_Detect instance

detect($in_userAgent = null, $in_detect = null)   X-Ref
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()

param: string $in_userAgent (optional) User agent override.  
param: mixed $in_detect (optional) The level of checking to do.
return: void

setOption($in_field, $in_value)   X-Ref
Sets a class option.  The available settings are:
o 'userAgent' => The user agent string to detect (useful for
checking a string manually).
o 'detectOptions' => The level of checking to do.  A single level
or an array of options.  Default is NET_USERAGENT_DETECT_ALL.

param: string $in_field The option field (userAgent or detectOptions)
param: mixed $in_value The value for the field

isBrowser($in_match)   X-Ref
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.

param: string $in_match flag to lookup
return: boolean whether or not the browser satisfies this flag

getBrowser($in_expectList)   X-Ref
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.

param: array $in_expectList the browser flags to search for
return: string first flag that matches

getBrowserString($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',)   X-Ref
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.

param: array $in_vendorStrings (optional) array of flags matched with vendor strings
return: string vendor string matches appropriate flag

isIE()   X-Ref
Determine if the browser is an Internet Explorer browser

return: bool whether or not this browser is an ie browser

isNavigator()   X-Ref
Determine if the browser is a Netscape Navigator browser

return: bool whether or not this browser is a Netscape Navigator browser

isNetscape()   X-Ref
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

return: bool whether or not this browser is a Netscape product

isOS($in_match)   X-Ref
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.

param: string $in_match flag to lookup
return: boolean whether or not the OS satisfies this flag

getOS($in_expectList)   X-Ref
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.

return: string first flag that matches

getOSString($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',)   X-Ref
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.

param: array $in_osStrings (optional) array of flags matched with os strings
return: string os string matches appropriate flag

setQuirk($in_quirk, $in_hasQuirk = true)   X-Ref
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.

param: string $in_quirk The quirk to set
param: string $in_hasQuirk (optional) Does the browser have the quirk?
return: void

hasQuirk($in_quirk)   X-Ref
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.

param: string $in_quirk The quirk to detect
return: bool whether or not browser has this quirk

getQuirk($in_quirk)   X-Ref
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.

param: string $in_quirk The quirk to detect
return: string value of the quirk, in this case usually a boolean

setFeature($in_feature, $in_hasFeature = true)   X-Ref
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.

param: string $in_feature The feature to set
param: string $in_hasFeature (optional) Does the browser have the feature?
return: void

hasFeature($in_feature)   X-Ref
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.

param: string $in_feature The feature to detect
return: bool whether or not the current client has this feature

getFeature($in_feature)   X-Ref
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.

param: string $in_feature The feature to detect
return: string value of the feature requested

getAcceptType($in_expectList, $in_type)   X-Ref
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.

param: string $in_expectList values to check
param: string $in_type type of accept
return: string the first matched value

setAcceptType($in_values, $in_type)   X-Ref
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.

param: array $in_values values of the accept type
param: string $in_type type of accept
return: void

hasAcceptType($in_value, $in_type)   X-Ref
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.

param: string $in_value values to check
param: string $in_type type of accept
return: bool whether or not the value is accept for this type

getUserAgent()   X-Ref
Return the user agent string that is being worked on

return: string user agent

_getStaticProperty($var)   X-Ref
Copy of getStaticProperty() from PEAR.php to avoid having to
include PEAR.php

param: string $var    The variable to retrieve.
return: mixed   A reference to the variable. If not set it will be



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7