Source for file Vodafone.php
Documentation is available at Vodafone.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: KUBO Atsuhiro <kubo@isite.co.jp> |
// +----------------------------------------------------------------------+
// $Id: Vodafone.php,v 1.1 2004/09/25 12:17:42 kuboa Exp $
require_once(dirname (__FILE__ ) . '/Common.php');
require_once(dirname (__FILE__ ) . '/Display.php');
* Vodafone implementation
* Net_UserAgent_Mobile_Vodafone is a subclass of
* {@link Net_UserAgent_Mobile_Common}, which implements Vodafone user agents.
* require_once('Net/UserAgent/Mobile.php');
* $_SERVER['HTTP_USER_AGENT'] = 'J-PHONE/2.0/J-DN02';
* $agent = &Net_UserAgent_Mobile::factory();
* printf("Name: %s\n", $agent->getName()); // 'J-PHONE'
* printf("Version: %s\n", $agent->getVersion()); // 2.0
* printf("Model: %s\n", $agent->getModel()); // 'J-DN02'
* if ($agent->isPacketCompliant()) {
* print "Packet is compliant.\n"; // false
* // only availabe in Java compliant
* // e.g.) 'J-PHONE/4.0/J-SH51/SNXXXXXXXXX SH/0001a Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0'
* printf("Serial: %s\n", $agent->getSerialNumber()); // XXXXXXXXX
* printf("Vendor: %s\n", $agent->getVendor()); // 'SH'
* printf("Vendor Version: %s\n", $agent->getVendorVersion()); // '0001a'
* $info = $agent->getJavaInfo(); // array
* foreach ($info as $key => $value) {
* print "$key: $value\n";
* @package Net_UserAgent_Mobile
* @author KUBO Atsuhiro <kubo@isite.co.jp>
* @version $Revision: 1.1 $
* @see Net_UserAgent_Mobile_Common
* @link http://developers.vodafone.jp/dp/tool_dl/web/useragent.php
* @link http://developers.vodafone.jp/dp/tool_dl/web/position.php
* name of the model like 'J-DN02'
* whether the agent is packet connection complicant or not
var $_packetCompliant = false;
* terminal unique serial number
var $_serialNumber = null;
* vendor version like '0001a'
var $_vendorVersion = null;
var $_javaInfo = array ();
* parse HTTP_USER_AGENT string
* @return mixed void, or a PEAR error object on error
// J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0
$this->_packetCompliant = true;
$serialNumber) = explode('/', $agent[0 ]);
$this->_serialNumber = $matches[1 ];
list ($this->_vendor, $this->_vendorVersion) =
for ($i = 2; $i < $count; ++ $i) {
list ($key, $value) = explode('/', $agent[$i]);
$this->_javaInfo[$key] = $value;
$this->_model = (string) $model;
preg_match('/J-([A-Z]+)/', $this->_model, $matches);
$this->_vendor = $matches[1 ];
* create a new {@link Net_UserAgent_Mobile_Display} class instance
* @return object a newly created {@link Net_UserAgent_Mobile_Display}
* @see Net_UserAgent_Mobile_Display
if ($color_string = $this->getHeader('x-jphone-color')) {
preg_match('/^([CG])(\d+)$/', $color_string, $matches);
$color = $matches[1 ] === 'C' ? true : false;
* returns name of the model like 'J-DN02'
// {{{ isPacketCompliant()
* returns whether the agent is packet connection complicant or not
return $this->_packetCompliant;
* return terminal unique serial number. returns null if user forbids to
* send his/her serial number.
return $this->_serialNumber;
* returns vendor code like 'SH'
// {{{ getVendorVersion()
* returns vendor version like '0001a'. returns null if unknown.
return $this->_vendorVersion;
* returns array of Java profiles
* Array structure is something like:
* - 'Profile' => 'MIDP-1.0',
* - 'Configuration' => 'CLDC-1.0',
* - 'Ext-Profile' => 'JSCL-1.1.0'
// {{{ getCarrierShortName()
* returns the short name of the carrier
// {{{ getCarrierLongName()
* returns the long name of the carrier
* returns true if the type is C
* returns true if the type is P
* returns true if the type is W
* c-hanging-comment-ender-p: nil
Documentation generated on Mon, 11 Mar 2019 13:55:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|