TeraWurfl
[ class tree: TeraWurfl ] [ index: TeraWurfl ] [ all elements ]

Class: UserAgentUtils

Source Location: /UserAgentUtils.php

Class Overview


Provides static functions for working with User Agents


Variables

Methods



Class Details

[line 20]
Provides static functions for working with User Agents



[ Top ]


Class Variables

static $WORST_MATCH =  7

[line 22]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


static method checkIfContains [line 189]

static Bool checkIfContains( String $ua, Mixed $find)

Check if user agent contains string or array of strings



Tags:

access:  public


Parameters:

String   $ua   User agent
Mixed   $find   String or Array of strings

[ Top ]

static method cleanUserAgent [line 140]

static String cleanUserAgent( String $ua)

Removes garbage from user agent string



Tags:

return:  User agent
access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method firstOpenParen [line 131]

static int firstOpenParen( String $userAgent)

The character position of the first open parenthisis. If there are no open parenthisis, returns string length



Tags:

return:  Character position
access:  public


Parameters:

String   $userAgent   User Agent

[ Top ]

static method firstSlash [line 101]

static int firstSlash( String $userAgent)

The character position of the first slash. If there are no slashes, returns string length



Tags:

return:  Character position
access:  public


Parameters:

String   $userAgent   User Agent

[ Top ]

static method firstSpace [line 121]

static int firstSpace( String $userAgent)

The character position of the first space. If there are no spaces, returns string length



Tags:

return:  Character position
access:  public


Parameters:

String   $userAgent   User Agent

[ Top ]

static method indexOfOrLength [line 209]

static int indexOfOrLength( String $ua, String $target, int $startingIndex)

Returns the character position (index) of the target string in the given user agent, starting from a given index. If target is not in user agent, returns length of user agent.



Tags:

return:  Character position (index) or user agent length
access:  public


Parameters:

String   $ua   User agent
String   $target   Target string to search for
int   $startingIndex   Character postition in the user agent at which to start looking for the target

[ Top ]

static method isDesktopBrowser [line 297]

static Bool isDesktopBrowser( String $ua)

The given user agent is definitely from a desktop browser



Tags:

access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method isMobileBrowser [line 275]

static Bool isMobileBrowser( String $ua)

The given user agent is definitely from a mobile device



Tags:

access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method isRobot [line 310]

static Bool isRobot( String $ua)

The given user agent is definitely from a bot/crawler



Tags:

access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method lastAttempts [line 246]

static String lastAttempts( String $ua)

Checks for traces of mobile device signatures and returns an appropriate generic WURFL Device ID



Tags:

return:  WURFL ID
access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method LD [line 319]

static void LD( $s, $t)



Tags:

access:  public


Parameters:

   $s  
   $t  

[ Top ]

static method ldMatch [line 65]

static string ldMatch( string $ua, [int $tolerance = null], UserAgentMatcher $matcher)

Find the matching Device ID for a given User Agent using LD (Leveshtein Distance)



Tags:

return:  WURFL ID
access:  public


Parameters:

string   $ua   User Agent
int   $tolerance   Tolerance that is still considered a match
UserAgentMatcher   $matcher   The UserAgentMatcher instance that is matching the User Agent

[ Top ]

static method normalizeBlackberry [line 155]

static String normalizeBlackberry( String $ua)

Normalizes BlackBerry user agent strings



Tags:

return:  User agent
access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method numSlashes [line 93]

static int numSlashes( String $userAgent)

Number of slashes ('/') found in the given user agent



Tags:

return:  Count
access:  public


Parameters:

String   $userAgent   User Agent

[ Top ]

static method ordinalIndexOf [line 224]

static int ordinalIndexOf( String $ua, String $needle, int $ordinal)

The character postition of the Nth occurance of a target string in a user agent



Tags:

return:  Character position
access:  public


Parameters:

String   $ua   User agent
String   $needle   Target string to search for in user agent
int   $ordinal   The Nth occurence to find

[ Top ]

static method removeUPLinkFromUA [line 165]

static String removeUPLinkFromUA( String $ua)

Removes UP.Link traces from user agent strings



Tags:

return:  User agent
access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method removeVodafonePrefix [line 180]

static String removeVodafonePrefix( String $ua)

Removes Vodafone garbage from user agent string



Tags:

return:  User agent
access:  public


Parameters:

String   $ua   User agent

[ Top ]

static method risMatch [line 34]

static string risMatch( string $ua, int $tolerance, $matcher)

Find the matching Device ID for a given User Agent using RIS (Reduction in String)



Tags:

return:  WURFL ID
access:  public


Parameters:

string   $ua   User Agent
int   $tolerance   How short the strings are allowed to get before a match is abandoned
UserAgentMatcher   $matcher   The UserAgentMatcher instance that is matching the User Agent

[ Top ]

static method secondSlash [line 110]

static int secondSlash( String $userAgent)

The character position of the second slash. If there is no second slash, returns string length



Tags:

return:  Character position
access:  public


Parameters:

String   $userAgent   User Agent

[ Top ]

constructor __construct [line 24]

UserAgentUtils __construct( )



Tags:

access:  public


[ Top ]


Documentation generated on Sun, 19 Sep 2010 00:16:08 +0000 by phpDocumentor 1.4.3