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

Class: Net_UserAgent_Mobile

Source Location: /Net_UserAgent_Mobile-0.31.0/Mobile.php

Class Overview


HTTP mobile user agent string parser


Author(s):

Version:

  • Release: 0.31.0

Copyright:

  • 2003-2008 KUBO Atsuhiro <iteman@users.sourceforge.net>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 95]
HTTP mobile user agent string parser

Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) mobile HTTP user agents. It'll be useful in page dispatching by user agents. This package was ported from Perl's HTTP::MobileAgent. See http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent The author of the HTTP::MobileAgent module is Tatsuhiko Miyagawa <miyagawa@bulknews.net>

SYNOPSIS:

  1.  require_once 'Net/UserAgent/Mobile.php';
  2.  
  3.  $agent &Net_UserAgent_Mobile::factory($agent_string);
  4.  // or $agent = &Net_UserAgent_Mobile::factory(); // to get from $_SERVER
  5.  
  6.  if ($agent->isDoCoMo()) {
  7.      // or if ($agent->getName() == 'DoCoMo')
  8.      // or if (strtolower(get_class($agent)) == 'http_mobileagent_docomo')
  9.      // it's NTT DoCoMo i-mode
  10.      // see what's available in Net_UserAgent_Mobile_DoCoMo
  11.  elseif ($agent->isVodafone()) {
  12.      // it's Vodafone(J-PHONE)
  13.      // see what's available in Net_UserAgent_Mobile_Vodafone
  14.  elseif ($agent->isEZweb()) {
  15.      // it's KDDI/EZWeb
  16.      // see what's available in Net_UserAgent_Mobile_EZweb
  17.  else {
  18.      // may be PC
  19.      // $agent is Net_UserAgent_Mobile_NonMobile
  20.  }
  21.  
  22.  $display $agent->getDisplay();    // Net_UserAgent_Mobile_Display
  23.  if ($display->isColor()) {
  24.     ...
  25.  }



[ Top ]


Method Detail

errorMessage   [line 236]

string errorMessage( integer $value)

return a textual error message for a Net_UserAgent_Mobile error code
  • Return: error message, or false if the error code was not recognized
  • Access: public

Parameters:

integer   $value     error code

[ Top ]

factory   [line 131]

mixed &factory( [string $userAgent = null])

create a new Net_UserAgent_Mobile_Common subclass instance

parses HTTP headers and constructs Net_UserAgent_Mobile_Common subclass instance. If no argument is supplied, $_SERVER{'HTTP_*'} is used.

  • Return: a newly created Net_UserAgent_Mobile object, or a PEAR error object on error
  • Access: public

Parameters:

string   $userAgent     User-Agent string

[ Top ]

isDoCoMo   [line 294]

boolean isDoCoMo( [string $userAgent = null])

Checks whether or not the user agent is DoCoMo by a given user agent string.
  • Since: Method available since Release 0.31.0
  • Access: public

Parameters:

string   $userAgent     

[ Top ]

isError   [line 221]

boolean isError( integer $value)

tell whether a result code from a Net_UserAgent_Mobile method is an error

Parameters:

integer   $value     result code

[ Top ]

isEZweb   [line 318]

boolean isEZweb( [string $userAgent = null])

Checks whether or not the user agent is EZweb by a given user agent string.
  • Since: Method available since Release 0.31.0
  • Access: public

Parameters:

string   $userAgent     

[ Top ]

isMobile   [line 268]

boolean isMobile( [string $userAgent = null])

Checks whether or not the user agent is mobile by a given user agent string.
  • Since: Method available since Release 0.31.0
  • Access: public

Parameters:

string   $userAgent     

[ Top ]

isSoftBank   [line 344]

boolean isSoftBank( [string $userAgent = null])

Checks whether or not the user agent is SoftBank by a given user agent string.
  • Since: Method available since Release 0.31.0
  • Access: public

Parameters:

string   $userAgent     

[ Top ]

isWillcom   [line 382]

boolean isWillcom( [string $userAgent = null])

Checks whether or not the user agent is Willcom by a given user agent string.
  • Since: Method available since Release 0.31.0
  • Access: public

Parameters:

string   $userAgent     

[ Top ]

singleton   [line 192]

mixed &singleton( [string $userAgent = null])

creates a new Net_UserAgent_Mobile_Common subclass instance or returns a instance from existent ones

Parameters:

string   $userAgent     User-Agent string

[ Top ]


Documentation generated on Sun, 10 Feb 2008 07:00:10 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.