\BEAR_Agent

エージェント

UAコードの確定やUAコードに応じたAgentアダプターをセットします。
確定したUAコードはUAスニッフィングやUA別のインジェクター等に用いられます。
UAコードはBEARの自動判別の他に$config['ua_inject']に外部インジェクタークラスを指定してアプリケーションがUAコードをインジェクトすることがあります。
BEAR_Agent_Adapter_(UAコード)でUAアダプタークラスが用意されてないものはグローバルレジストリに先にセットしておきます。
AgentアダプターはBEAR_Agent_Adapter_*で定義されUAの継承関係や、ビューの時のconfigを設定します。

Summary

Methods
Properties
Constants
__construct()
onInject()
setConfig()
getConfig()
setService()
__toString()
getUa()
getSerialNumber()
getDisplaySize()
getDisplayByteSize()
getAgentRole()
getRoleFile()
$agentMobile
$adapter
UA_DEFAULT
UA_MOBILE
UA_DOCOMO
UA_EZWEB
UA_SOFTBANK
UA_BOT
UA_APPLE
UA_IPHONE
UA_IPAD
UA_ANDROID
_exception()
$_config
$_agentMobile
$_ua
N/A
No private methods found
No private properties found
N/A

Constants

UA_DEFAULT

UA_DEFAULT

PC

UA_MOBILE

UA_MOBILE

Mobile

UA_DOCOMO

UA_DOCOMO

Docomo iモード

UA_EZWEB

UA_EZWEB

AU Ezweb

UA_SOFTBANK

UA_SOFTBANK

Softbank 3GC

UA_BOT

UA_BOT

BOTクライアント

UA_APPLE

UA_APPLE

Apple

UA_IPHONE

UA_IPHONE

Apple iPhone/iPod touch

UA_IPAD

UA_IPAD

Apple iPad

UA_ANDROID

UA_ANDROID

Google Android

Properties

$agentMobile

$agentMobile : 

Type

$_config

$_config : array

Class config

Type

array

$_agentMobile

$_agentMobile : mixed

モバイルエージェント

PEAR::Net_UserAgent_Mobileオブジェクト

Type

mixed

$_ua

$_ua : string

UAコード

Type

string

Methods

__construct()

__construct(array  $config) 

Universal constructor

設定を_configプロパティに代入します。

Parameters

array $config

ユーザー設定値

onInject()

onInject() : void

Inject

user_agentによって以下のプロパティを注入します。 独自のエージェント判別ロジックを入れたいときはインジェクタを変更します。

Net_UserAgent_Mobile agentMobile string _ua UAコード mixed adapter エージェントアダプター

setConfig()

setConfig(mixed  $config, mixed  $values = null) : self

Set config

Parameters

mixed $config

(string) 設定キー | (array) 設定配列

mixed $values

(string) $configの時の設定値

Returns

self

getConfig()

getConfig(string  $key = null) : mixed

Get config

Parameters

string $key

設定キー、指定なければ全ての設定を取得

Returns

mixed

setService()

setService(string  $name, mixed  $service) : void

Set service

Parameters

string $name

サービスキー

mixed $service

サービス

__toString()

__toString() : string

__toString

文字列として扱うとUAコードを返す

Returns

string

getUa()

getUa() : string

ユーザーエージェントコードの取得

Returns

string

getSerialNumber()

getSerialNumber() : string

携帯のユニークIDを取得

Returns

string

getDisplaySize()

getDisplaySize() : array

画面サイズの縦、横のサイズを取得

Returns

array —

array(width, height)

getDisplayByteSize()

getDisplayByteSize() : array

携帯の表示可能文字数を取得

携帯の表示可能文字数を取得します。。

Returns

array —

array(width, height)

getAgentRole()

getAgentRole() : array

エージェントロールの取得

Returns

array

getRoleFile()

getRoleFile(string  $dir, string  $fileNameBase, string  $ext = 'tpl') : string

エージェントロールに対応したファイルを取得

配列でロールに応じたファイルを返します

ex)
roleが'Docomo'の場合

index.docomo.html
index.mobile.html
index.html

というファイルに順にスキャンしてあればそれが使われます。

                                    

Parameters

string $dir

ディレクトリパス

string $fileNameBase

拡張子なしファイル名

string $ext

ファイル名拡張子

Returns

string

_exception()

_exception(string  $msg, array  $config = array()) : \BEAR_Exception

例外の作成

Parameters

string $msg

例外メッセージ

array $config

例外config

Returns

\BEAR_Exception