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

Class: Net_UserAgent_Mobile

Source Location: /Net_UserAgent_Mobile-1.0.0/Net/UserAgent/Mobile.php

Class Overview


HTTP mobile user agent string parser


Author(s):

Version:

  • Release: 1.0.0

Copyright:

  • 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 100]
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

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->isSoftBank()) {
  12.      // it's SoftBank
  13.      // see what's available in Net_UserAgent_Mobile_SoftBank
  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.  }

  • Author: KUBO Atsuhiro <kubo@iteman.jp>
  • Version: Release: 1.0.0
  • Copyright: 2003-2009 KUBO Atsuhiro <kubo@iteman.jp>
  • Since: Class available since Release 0.1
  • License: New BSD License


[ Top ]


Method Detail

errorMessage   [line 244]

string errorMessage( integer $value)

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

Parameters:

integer   $value     error code

[ Top ]

factory   [line 137]

Net_UserAgent_Mobile_Common &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 or an existing Net_UserAgent_Mobile_Common object
  • Throws: Net_UserAgent_Mobile_Error
  • Access: public

Parameters:

string   $userAgent     User-Agent string

[ Top ]

isDoCoMo   [line 300]

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 228]

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 323]

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 275]

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 348]

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 385]

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 200]

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

creates a new Net_UserAgent_Mobile_Common subclass instance or returns a instance from existent ones
  • Return: a newly created or an existing Net_UserAgent_Mobile_Common object
  • Throws: Net_UserAgent_Mobile_Error
  • Access: public

Parameters:

string   $userAgent     User-Agent string

[ Top ]


Documentation generated on Tue, 23 Jun 2009 10:00:05 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.